diff --git a/.gitignore b/.gitignore index 24b99ed..3ca62fc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,4 @@ config.php .buildpath .project .settings/ -.idea/ coverage/ -src/application/cache/* -src/application/configs/local.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..29a0909 --- /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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +require_once dirname(__FILE__) .'/application/bootstrap.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 96% rename from src/admin/ElementQueueFixer.php rename to admin/ElementQueueFixer.php index be19843..542b7f9 100644 --- a/src/admin/ElementQueueFixer.php +++ b/admin/ElementQueueFixer.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/QueryExecute.php b/admin/QueryExecute.php similarity index 93% rename from src/admin/QueryExecute.php rename to admin/QueryExecute.php index 9e75ebf..6ec9889 100644 --- a/src/admin/QueryExecute.php +++ b/admin/QueryExecute.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/autounban.php b/admin/ShowFlyingFleets.php similarity index 68% rename from src/admin/autounban.php rename to admin/ShowFlyingFleets.php index 5d9a6a9..89f1eb1 100644 --- a/src/admin/autounban.php +++ b/admin/ShowFlyingFleets.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -33,15 +33,18 @@ define('INSTALL' , false); define('IN_ADMIN', true); require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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 98% rename from src/admin/XNovaResetUnivers.php rename to admin/XNovaResetUnivers.php index e789d4d..e8d1026 100644 --- a/src/admin/XNovaResetUnivers.php +++ b/admin/XNovaResetUnivers.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/admin/activeplanet.php b/admin/activeplanet.php new file mode 100644 index 0000000..e8bf1b5 --- /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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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..96d8a21 --- /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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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..142acd7 --- /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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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 95% rename from src/admin/add_moon.php rename to admin/add_moon.php index 63c2851..6607d27 100644 --- a/src/admin/add_moon.php +++ b/admin/add_moon.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/ShowFlyingFleets.php b/admin/autounban.php similarity index 66% rename from src/admin/ShowFlyingFleets.php rename to admin/autounban.php index c41270d..c5afbe6 100644 --- a/src/admin/ShowFlyingFleets.php +++ b/admin/autounban.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -33,18 +33,16 @@ define('INSTALL' , false); define('IN_ADMIN', true); require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php'; -include(ROOT_PATH . 'includes/functions/BuildFlyingFleetTable.'.PHPEXT); + 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'] ); + } -if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { - includeLang('admin/fleets'); - $PageTPL = gettemplate('admin/fleet_body'); +?> - $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'] ); -} diff --git a/src/admin/banned.php b/admin/banned.php similarity index 96% rename from src/admin/banned.php rename to admin/banned.php index 89b6f01..f053aa8 100644 --- a/src/admin/banned.php +++ b/admin/banned.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/changelog.php b/admin/changelog.php similarity index 93% rename from src/admin/changelog.php rename to admin/changelog.php index 6ef7ced..5b63eaa 100644 --- a/src/admin/changelog.php +++ b/admin/changelog.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/chat.php b/admin/chat.php similarity index 95% rename from src/admin/chat.php rename to admin/chat.php index b6ca379..3618898 100644 --- a/src/admin/chat.php +++ b/admin/chat.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/credit.php b/admin/credit.php similarity index 96% rename from src/admin/credit.php rename to admin/credit.php index 00c282d..bccba11 100644 --- a/src/admin/credit.php +++ b/admin/credit.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/declare_list.php b/admin/declare_list.php similarity index 90% rename from src/admin/declare_list.php rename to admin/declare_list.php index 6ecc761..961bf04 100644 --- a/src/admin/declare_list.php +++ b/admin/declare_list.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -36,11 +36,7 @@ require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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/deletuser.php b/admin/deletuser.php similarity index 93% rename from src/admin/deletuser.php rename to admin/deletuser.php index 370ddcb..70b9966 100644 --- a/src/admin/deletuser.php +++ b/admin/deletuser.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/errors.php b/admin/errors.php similarity index 95% rename from src/admin/errors.php rename to admin/errors.php index 0ff6a7b..c57083c 100644 --- a/src/admin/errors.php +++ b/admin/errors.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/leftmenu.php b/admin/leftmenu.php similarity index 79% rename from src/admin/leftmenu.php rename to admin/leftmenu.php index cce8699..180034a 100644 --- a/src/admin/leftmenu.php +++ b/admin/leftmenu.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -36,13 +36,13 @@ require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php'; includeLang('leftmenu'); if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { - $parse = $lang; - $parse['mf'] = "Hauptframe"; - $parse['dpath'] = $dpath; + $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['servername'] = Wootook; + $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..43998cf --- /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 Wootook. + * + */ + +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 94% rename from src/admin/md5changepass.php rename to admin/md5changepass.php index 71bf636..46c43d5 100644 --- a/src/admin/md5changepass.php +++ b/admin/md5changepass.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/md5enc.php b/admin/md5enc.php similarity index 94% rename from src/admin/md5enc.php rename to admin/md5enc.php index ba3c4e5..b4a96b7 100644 --- a/src/admin/md5enc.php +++ b/admin/md5enc.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/messagelist.php b/admin/messagelist.php similarity index 98% rename from src/admin/messagelist.php rename to admin/messagelist.php index a4c75cf..49c207c 100644 --- a/src/admin/messagelist.php +++ b/admin/messagelist.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/admin/messall.php b/admin/messall.php new file mode 100644 index 0000000..fb7b834 --- /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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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 95% rename from src/admin/moonlist.php rename to admin/moonlist.php index 932e607..645d086 100644 --- a/src/admin/moonlist.php +++ b/admin/moonlist.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/multi.php b/admin/multi.php similarity index 94% rename from src/admin/multi.php rename to admin/multi.php index 4b41308..e174971 100644 --- a/src/admin/multi.php +++ b/admin/multi.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/admin/overview.php b/admin/overview.php new file mode 100644 index 0000000..1a7c5d3 --- /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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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 = $Last15Mins->fetch(PDO::FETCH_ASSOC) ) { + 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 98% rename from src/admin/paneladmina.php rename to admin/paneladmina.php index 1ea59d8..f4097b7 100644 --- a/src/admin/paneladmina.php +++ b/admin/paneladmina.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/planetlist.php b/admin/planetlist.php similarity index 95% rename from src/admin/planetlist.php rename to admin/planetlist.php index 4a154a5..0d3eacc 100644 --- a/src/admin/planetlist.php +++ b/admin/planetlist.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/admin/settings.php b/admin/settings.php new file mode 100644 index 0000000..5466aa1 --- /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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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 90% rename from src/admin/statbuilder.php rename to admin/statbuilder.php index 97caec7..7f02140 100644 --- a/src/admin/statbuilder.php +++ b/admin/statbuilder.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -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 90% rename from src/admin/statfunctions.php rename to admin/statfunctions.php index db1a760..36cfe93 100644 --- a/src/admin/statfunctions.php +++ b/admin/statfunctions.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -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 94% rename from src/admin/unbanned.php rename to admin/unbanned.php index 8b0967d..cfc9027 100644 --- a/src/admin/unbanned.php +++ b/admin/unbanned.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/admin/userlist.php b/admin/userlist.php similarity index 91% rename from src/admin/userlist.php rename to admin/userlist.php index 84fb74f..ecb19df 100644 --- a/src/admin/userlist.php +++ b/admin/userlist.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -36,11 +36,7 @@ require_once dirname(dirname(__FILE__)) .'/application/bootstrap.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 93% rename from src/admin/variables.php rename to admin/variables.php index bcc6642..527af4c 100644 --- a/src/admin/variables.php +++ b/admin/variables.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/ainfo.php b/ainfo.php new file mode 100644 index 0000000..4f12f4f --- /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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +require_once dirname(__FILE__) .'/application/bootstrap.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/src/alliance.php b/alliance.php similarity index 89% rename from src/alliance.php rename to alliance.php index 6b815fd..3c90d3c 100644 --- a/src/alliance.php +++ b/alliance.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -32,8 +32,8 @@ define('INSTALL' , false); define('INSIDE' , true); require_once dirname(__FILE__) .'/application/bootstrap.php'; -$user = Wootook_Player_Model_Session::getSingleton()->getPlayer(); -$db = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection(Wootook_Core_Database_ConnectionManager::DEFAULT_CONNECTION_NAME); +$user = Wootook_Empire_Model_User::getSingleton(); +$db = Wootook_Database::getSingleton(); if(!$user->getId()){ echo ''; } -$request = Wootook::getRequest(); +$mode = isset($_GET['mode']) ? $_GET['mode'] : null; +$yes = isset($_GET['yes']) ? $_GET['yes'] : null; +$edit = isset($_GET['edit']) ? $_GET['edit'] : null; +$allyid = isset($_GET['allyid']) ? intval($_GET['allyid']) : null; +$kick = isset($_GET['kick']) ? $_GET['kick'] : null; +$show = isset($_GET['show']) ? intval($_GET['show']) : null; +$sort = isset($_GET['sort']) ? intval($_GET['sort']) : null; +$sendmail = isset($_GET['sendmail']) ? intval($_GET['sendmail']) : null; +$rank = isset($_GET['rank']) ? intval($_GET['rank']) : null; +$t = isset($_GET['t']) ? $_GET['t'] : null; +$a = isset($_GET['a']) ? intval($_GET['a']) : null; +$tag = isset($_GET['tag']) ? $db->quote($_GET['tag']) : null; +$page = isset($page) ? $page : null; +$d = isset($_GET['d']) ? $_GET['d'] : null; +$id = isset($_GET['id']) ? $_GET['id'] : null; -$mode = $request->getQuery('mode'); -$yes = $request->getQuery('yes'); -$edit = $request->getQuery('edit'); -$allyid = intval($request->getQuery('allyid')); -$kick = $request->getQuery('kick'); -$show = intval($request->getQuery('show')); -$sort = intval($request->getQuery('sort')); -$sendmail = intval($request->getQuery('sendmail')); -$rank = intval($request->getQuery('rank')); -$t = $request->getQuery('t'); -$allianceId = intval($request->getQuery('a')); -$tag = $request->getQuery('tag'); -$page = $request->getQuery('page'); -$d = $request->getQuery('d'); -$id = $request->getQuery('id'); - -$allianceIds = $request->getPost('id'); -$actionType = $request->getPost('t'); -$options = $request->getPost('options'); -$action = $request->getPost('action'); +$_POST['id'] = isset($_POST['id']) ? $_POST['id'] : null; +$_POST['t'] = isset($_POST['t']) ? $_POST['t'] : null; +$_POST['options'] = isset($_POST['options']) ? $_POST['options'] : null; +$_POST['action'] = isset($_POST['action']) ? $_POST['action'] : null; includeLang('alliance'); + /** *Alliance information display. */ @@ -74,9 +73,9 @@ if ($mode == 'ainfo') { $lang['Alliance_information'] = "Information Alliance"; if ($tag) { - $allyrow = doquery("SELECT * FROM {{table}} WHERE ally_tag={$db->quote($tag)}", "alliance", true); - } elseif (is_numeric($allianceId) && $allianceId != 0) { - $allyrow = doquery("SELECT * FROM {{table}} WHERE id='{$allianceId}'", "alliance", true); + $allyrow = doquery("SELECT * FROM {{table}} WHERE ally_tag={$tag}", "alliance", true); + } elseif (is_numeric($a) && $a != 0) { + $allyrow = doquery("SELECT * FROM {{table}} WHERE id='{$a}'", "alliance", true); } else { message("Cette alliance n'existe pas !", "Information Alliance (1)"); } @@ -139,17 +138,17 @@ if ($user->getData('ally_id') == 0) { /* * Creation of the alliance */ - if ($yes == 1 && $request->isPost()) { + if ($yes == 1 && isset($_POST)) { - if ($request->getPost('atag') !== null) { + if (empty($_POST['atag'])) { message($lang['have_not_tag'], $lang['make_alliance']); } - if ($request->getPost('aname') !== null) { + if (empty($_POST['aname'])) { message($lang['have_not_name'], $lang['make_alliance']); } - $alliance_name = $db->quote($request->getPost('aname')); - $alliance_tag = $db->quote($request->getPost('atag')); + $alliance_name = $db->quote($_POST['aname']); + $alliance_tag = $db->quote($_POST['atag']); $tagquery = doquery("SELECT * FROM {{table}} WHERE ally_tag=" .$alliance_tag. ";", 'alliance', true); @@ -157,7 +156,7 @@ if ($user->getData('ally_id') == 0) { message(str_replace('%s', $alliance_tag, $lang['always_exist']), $lang['make_alliance']); } $ranks = ''; - $allianz_raenge[] = array('name' => 'Novice', + $allianz_raenge[] = array('name' => 'Novice', 'mails' => 0, 'delete' => 0, 'kick' => 0, @@ -176,7 +175,7 @@ if ($user->getData('ally_id') == 0) { `ally_tag`=" . $alliance_tag . " , `ally_owner`='" .$user->getId(). "', `ally_owner_range`='Leader', - `ally_ranks`='" . $ranks . "', + `ally_ranks`='" . $ranks . "', `ally_members`='1', `ally_register_time`=" . time() , "alliance"); @@ -201,11 +200,11 @@ if ($user->getData('ally_id') == 0) { if ($mode == 'search' && $user->getData('ally_request') == 0) { $parse = $lang; - $search_text = $request->getPost('searchtext'); + $search_text = isset($_POST['searchtext']) ? $_POST['searchtext'] : null; $lang['searchtext'] = $search_text; $page = parsetemplate(gettemplate('alliance_searchform'), $lang); - if ($request->getPost('searchtext') !== null) { + if (isset($_POST['searchtext'])) { $stmt = $db->prepare("SELECT * FROM {$db->getTable('alliance')} WHERE ally_name LIKE :search_field OR ally_tag LIKE :search_field LIMIT 30"); $stmt->execute(array(':search_field' => '%' .$search_text. '%')); if ($stmt->rowCount() != 0) { @@ -245,8 +244,8 @@ if ($user->getData('ally_id') == 0) { extract($allyrow); - if ($request->getPost('further') !== null && $request->getPost('further') == $lang['Send']) { - doquery("UPDATE {{table}} SET `ally_request`='" . $allyid . "', ally_request_text=" . $db->quote($request->getPost('text')) . ", ally_register_time='" . time() . "' WHERE `id`='" . $user->getId(). "'", "users"); + if (isset($_POST['further']) && $_POST['further'] == $lang['Send']) { + doquery("UPDATE {{table}} SET `ally_request`='" . $allyid . "', ally_request_text=" . $db->quote($_POST['text']) . ", ally_register_time='" . time() . "' WHERE `id`='" . $user->getId(). "'", "users"); message($lang['apply_registered'], $lang['your_apply']); } else { $text_apply = ($ally_request) ? $ally_request : $lang['There_is_no_a_text_apply']; @@ -270,7 +269,7 @@ if ($user->getData('ally_id') == 0) { $allyquery = doquery("SELECT ally_tag FROM {{table}} WHERE id='" . $user->getData('ally_request') . "' ORDER BY `id`", "alliance", true); extract($allyquery); - if ($request->getPost('bcancel') !== null) { + if (isset($_POST['bcancel'])) { doquery("UPDATE {{table}} SET `ally_request`=0 WHERE `id`=" . $user->getId('id'), "users"); $lang['request_text'] = str_replace('%s', $ally_tag, $lang['Canceled_a_request_text']); @@ -395,9 +394,9 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { message($lang['Denied_access'], $lang['Members_list']); } // Order of displaying the different users - $sort2 = intval($request->getQuery('sort2')); + $sort2 = isset($_GET['sort2']) ? intval($_GET['sort2']) : null; if ($sort2) { - $sort1 = intval($request->getQuery('sort1')); + $sort1 = isset($_GET['sort1']) ? intval($_GET['sort1']) : null; switch($sort1){ case 1: $sort = " ORDER BY `username`"; @@ -507,9 +506,9 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { } if ($sendmail == 1) { - if ($request->getPost('r') !== null && is_numeric($request->getPost('r'))){ - $group_rank = intval($request->getPost('r')); - $message_text = $db->quote($request->getPost('text')); + if (isset($_POST['r']) && is_numeric($_POST['r'])){ + $group_rank = intval($_POST['r']); + $message_text = $db->quote($_POST['text']); if ($group_rang == 0) { $sq = doquery("SELECT id,username FROM {{table}} WHERE ally_id='{$user['ally_id']}'", "users"); } else { @@ -559,8 +558,8 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { if ($ally['ally_owner'] != $user->getId() && !$user_can_edit_rights) { message($lang['Denied_access'], $lang['Members_list']); - } else if ($request->getPost('newrangname') != '') { - $name = strip_tags($request->getPost('newrangname')); + } elseif (!empty($_POST['newrangname'])) { + $name = strip_tags($_POST['newrangname']); $allianz_raenge[] = array('name' => $name, 'mails' => 0, @@ -582,63 +581,63 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { header("Location: " . $goto); exit(); - } elseif (is_array($allianceIds) && !empty($allianceIds)) { + } elseif ($_POST['id'] != '' && is_array($_POST['id'])) { $ally_ranks_new = array(); - foreach ($allianceIds as $id) { + foreach ($_POST['id'] as $id) { $name = $allianz_raenge[$id]['name']; $ally_ranks_new[$id]['name'] = $name; - if ($request->getPost('u' . $id . 'r0') !== null) { + if (isset($_POST['u' . $id . 'r0'])) { $ally_ranks_new[$id]['delete'] = 1; } else { $ally_ranks_new[$id]['delete'] = 0; } - if ($request->getPost('u' . $id . 'r1') !== null && $ally['ally_owner'] == $user->getId()) { + if (isset($_POST['u' . $id . 'r1']) && $ally['ally_owner'] == $user->getId()) { $ally_ranks_new[$id]['kick'] = 1; } else { $ally_ranks_new[$id]['kick'] = 0; } - if ($request->getPost('u' . $id . 'r2') !== null) { + if (isset($_POST['u' . $id . 'r2'])) { $ally_ranks_new[$id]['bewerbungen'] = 1; } else { $ally_ranks_new[$id]['bewerbungen'] = 0; } - if ($request->getPost('u' . $id . 'r3') !== null) { + if (isset($_POST['u' . $id . 'r3'])) { $ally_ranks_new[$id]['memberlist'] = 1; } else { $ally_ranks_new[$id]['memberlist'] = 0; } - if ($request->getPost('u' . $id . 'r4') !== null) { + if (isset($_POST['u' . $id . 'r4'])) { $ally_ranks_new[$id]['bewerbungenbearbeiten'] = 1; } else { $ally_ranks_new[$id]['bewerbungenbearbeiten'] = 0; } - if ($request->getPost('u' . $id . 'r5') !== null) { + if (isset($_POST['u' . $id . 'r5'])) { $ally_ranks_new[$id]['administrieren'] = 1; } else { $ally_ranks_new[$id]['administrieren'] = 0; } - if ($request->getPost('u' . $id . 'r6') !== null) { + if (isset($_POST['u' . $id . 'r6'])) { $ally_ranks_new[$id]['onlinestatus'] = 1; } else { $ally_ranks_new[$id]['onlinestatus'] = 0; } - if ($request->getPost('u' . $id . 'r7') !== null) { + if (isset($_POST['u' . $id . 'r7'])) { $ally_ranks_new[$id]['mails'] = 1; } else { $ally_ranks_new[$id]['mails'] = 0; } - if ($request->getPost('u' . $id . 'r8') !== null) { + if (isset($_POST['u' . $id . 'r8'])) { $ally_ranks_new[$id]['rechtehand'] = 1; } else { $ally_ranks_new[$id]['rechtehand'] = 0; @@ -672,6 +671,7 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { foreach($ally_ranks as $a => $b) { if ($ally['ally_owner'] == $user->getId()) { $lang['id'] = $a; + $lang['delete'] = "\"{$lang['Delete_range']}\""; $lang['r0'] = $b['name']; $lang['a'] = $a; $lang['r1'] = ""; //{$b[1]} @@ -688,6 +688,7 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { } else { $lang['id'] = $a; $lang['r0'] = $b['name']; + $lang['delete'] = "\"{$lang['Delete_range']}\""; $lang['a'] = $a; $lang['r1'] = "-"; $lang['r2'] = ""; @@ -720,18 +721,24 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { if ($t != 1 && $t != 2 && $t != 3) { $t = 1; } + if (!get_magic_quotes_gpc()) { + $_POST['owner_range'] = isset($_POST['owner_range']) ? stripslashes($_POST['owner_range']) : null; + $_POST['web'] = isset($_POST['web']) ? stripslashes($_POST['web']) : null; + $_POST['image'] = isset($_POST['image']) ? stripslashes($_POST['image']) : null; + $_POST['text'] = isset($_POST['text']) ? stripslashes($_POST['text']) : null; + } - if ($options) { - $ally['ally_owner_range'] = htmlspecialchars(strip_tags($request->getPost('owner_range'))); + if ($_POST['options']) { + $ally['ally_owner_range'] = htmlspecialchars(strip_tags($_POST['owner_range'])); - $ally['ally_web'] = htmlspecialchars(strip_tags($request->getPost('web'))); + $ally['ally_web'] = htmlspecialchars(strip_tags($_POST['web'])); - $ally['ally_image'] = htmlspecialchars(strip_tags($request->getPost('image'))); + $ally['ally_image'] = htmlspecialchars(strip_tags($_POST['image'])); - $ally['ally_request_notallow'] = intval($request->getPost('request_notallow')); + $ally['ally_request_notallow'] = intval($_POST['request_notallow']); if ($ally['ally_request_notallow'] != 0 && $ally['ally_request_notallow'] != 1) { - message("Aller � \"Candidature\" et sur une option dans le formulaire!", "Erreur"); + message("Aller � \"Candidature\" et sur une option dans le formulaire!", "Erreur"); exit; } @@ -741,20 +748,20 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { `ally_web`={$db->quote($ally['ally_web'])}, `ally_request_notallow`='{$ally['ally_request_notallow']}' WHERE `id`='{$ally['id']}'", "alliance"); - } elseif ($actionType) { + } elseif ($_POST['t']) { if ($t == 3) { - $ally['ally_request'] = strip_tags($request->getPost('text')); + $ally['ally_request'] = strip_tags($_POST['text']); doquery("UPDATE {{table}} SET `ally_request`={$db->quote($ally['ally_request'])} WHERE `id`='{$ally['id']}'", "alliance"); } elseif ($t == 2) { - $ally['ally_text'] = strip_tags($request->getPost('text')); + $ally['ally_text'] = strip_tags($_POST['text']); doquery("UPDATE {{table}} SET `ally_text`={$db->quote($ally['ally_text'])} WHERE `id`='{$ally['id']}'", "alliance"); } else { - $ally['ally_description'] = strip_tags($request->getPost('text')); + $ally['ally_description'] = strip_tags($_POST['text']); doquery("UPDATE {{table}} SET `ally_description`=" . $db->quote($ally['ally_description']) . " @@ -801,8 +808,8 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { } if ($mode == 'admin' && $edit == 'give') { - if ($request->getPost('id')) { - doquery("update {{table}} set `ally_owner`=".$db->quote($request->getPost('id'))." where `id`='".$user['ally_id']."'",'alliance'); + if ($_POST["id"]) { + doquery("update {{table}} set `ally_owner`=".$db->quote($_POST["id"])." where `id`='".$user['ally_id']."'",'alliance'); } else { $selection=doquery("SELECT * FROM {{table}} where ally_id='".$user['ally_id']."'",'users'); $select=''; @@ -841,12 +848,12 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { if ($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) { doquery("UPDATE {{table}} SET `ally_id`='0', `ally_name`='', `ally_rank_id` = '0' WHERE `id`='{$u['id']}'", 'users'); } - } else if ($request->getPost('newrang') !== null) { - $newrank = $request->getPost('newrang'); - $selectedUser = Wootook_Player_Model_Entity::factory($id); + } elseif (isset($_POST['newrang'])) { + $newrank = isset($_POST['newrang']) ? intval($_POST['newrang']) : null; + $q = doquery("SELECT * FROM {{table}} WHERE id='{intval($id}' LIMIT 1", 'users', true); - if ($newrank !== null && isset($ally_ranks[$newrank]) && $selectedUser->getId() != $ally['ally_owner']) { - $selectedUser->setData('ally_rank_id', $newrank)->save(); + if (isset($ally_ranks[$newrank]) && $q['id'] != $ally['ally_owner']) { + doquery("UPDATE {{table}} SET `ally_rank_id`=" . $newrank . " WHERE `id`='" . intval($id) . "'", 'users'); } } @@ -854,9 +861,9 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { $f_template = gettemplate('alliance_admin_members_function'); // Order of displaying the different users - $sort2 = intval($request->getQuery('sort2')); + $sort2 = isset($_GET['sort2']) ? intval($_GET['sort2']) : null; if ($sort2) { - $sort1 = intval($request->getQuery('sort1')); + $sort1 = isset($_GET['sort1']) ? intval($_GET['sort1']) : null; switch($sort1){ case 1: $sort = " ORDER BY `username`"; @@ -992,7 +999,9 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { message($lang['Denied_access'], $lang['Check_the_requests']); } - if ($action == "Accepter") { + if ($_POST['action'] == "Accepter") { + $_POST['text'] = strip_tags($_POST['text']); + $u = doquery("SELECT * FROM {{table}} WHERE id=$show", 'users', true); // add points from the user who join the alliance doquery("UPDATE {{table}} SET @@ -1008,7 +1017,7 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { mnl_alliance=mnl_alliance+1 WHERE id='{$show}'", 'users'); - $message = "Bonjour,
L'Alliance {$ally['ally_name']} a accepté votre candidature.
Charte:
{$request->getPost('text')}"; + $message = "Bonjour,
L'Alliance {$ally['ally_name']} a accepté votre candidature.
Charte:
{$_POST['text']}"; // Send a message to the new member of the alliance doquery("INSERT INTO {{table}} SET `message_owner`=" .$db->quote($show).", @@ -1022,10 +1031,12 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { header('Location: alliance.php?mode=admin&edit=requests'); die(); - } elseif ($action == "Refuser" && $action != '') { + } elseif ($_POST['action'] == "Refuser" && $_POST['action'] != '') { + $_POST['text'] = strip_tags($_POST['text']); + doquery("UPDATE {{table}} SET ally_request_text='',ally_request='0',ally_id='0',new_message=new_message+1, mnl_alliance=mnl_alliance+1 WHERE id={$db->quote($show)}", 'users'); - $message = "Bonjour,
L'Alliance {$ally['ally_name']} a refusé votre candidature.
Raison:
{$request->getPost('text')}"; + $message = "Bonjour,
L'Alliance {$ally['ally_name']} a refusé votre candidature.
Raison:
{$_POST['text']}"; // Send a polite message to the player that he is too noobish for that alliance. doquery("INSERT INTO {{table}} SET `message_owner`=" .$db->quote($show).", @@ -1093,10 +1104,10 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { message($lang['Denied_access'], $lang['Members_list']); } - if ($request->getPost('newname') !== null) { + if (isset($_POST['newname'])) { // Y a le nouveau Nom // New name so lets update all - $ally['ally_name'] = strip_tags($request->getPost('newname')); + $ally['ally_name'] = strip_tags($_POST['newname']); doquery("UPDATE {{table}} SET `ally_name` = ". $db->quote($ally['ally_name']) ." WHERE `id` = '". $user->getData('ally_id') ."';", 'alliance'); doquery("UPDATE {{table}} SET `ally_name` = ". $db->quote($ally['ally_name']) ." WHERE `ally_id` = '". $ally['id'] ."';", 'users'); } @@ -1121,10 +1132,10 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) { message($lang['Denied_access'], $lang['Members_list']); } - if ($request->getPost('newtag') !== null) { + if (isset($_POST['newtag'])) { // Y a le nouveau TAG // new TAG, lets update the table - $ally['ally_tag'] = strip_tags($request->getPost('newtag')); + $ally['ally_tag'] = strip_tags($_POST['newtag']); doquery("UPDATE {{table}} SET `ally_tag` = ". $db->quote($ally['ally_tag']) ." WHERE `id` = '". $user->getData('ally_id') ."';", 'alliance'); } diff --git a/src/annonce.php b/annonce.php similarity index 68% rename from src/annonce.php rename to annonce.php index 9c0b506..169ca4d 100644 --- a/src/annonce.php +++ b/annonce.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -31,26 +31,35 @@ define('INSIDE' , true); define('INSTALL' , false); require_once dirname(__FILE__) .'/application/bootstrap.php'; - -$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read'); -$writeAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write'); - -$action = isset($_GET['action']) ? $_GET['action'] : null; +$users = doquery("SELECT * FROM {{table}} WHERE id='".$user['id']."';", 'users'); +$annonce = doquery("SELECT * FROM {{table}} ", 'annonce'); +$action = $_GET['action']; if ($action == 5) { - $writeAdapter->insert() - ->into($writeAdapter->getTable('annonce')) - ->set('user', $user->getUsername()) - ->set('galaxie', $planet->getGalaxy()) - ->set('systeme', $planet->getSystem()) - ->set('metala', Wootook::getRequest()->getParam('metalvendre')) - ->set('cristala', Wootook::getRequest()->getParam('cristalvendre')) - ->set('deuta', Wootook::getRequest()->getParam('deutvendre')) - ->set('metals', Wootook::getRequest()->getParam('metalsouhait')) - ->set('cristals', Wootook::getRequest()->getParam('cristalsouhait')) - ->set('deuts', Wootook::getRequest()->getParam('deutsouhait')) - ->execute() - ; + $metalvendre = $_POST['metalvendre']; + $cristalvendre = $_POST['cristalvendre']; + $deutvendre = $_POST['deutvendre']; + + $metalsouhait = $_POST['metalsouhait']; + $cristalsouhait = $_POST['cristalsouhait']; + $deutsouhait = $_POST['deutsouhait']; + + while ($v_annonce = $users->fetch(PDO::FETCH_BOTH)) { + $user = $v_annonce['username']; + $galaxie = $v_annonce['galaxy']; + $systeme = $v_annonce['system']; + } + + doquery("INSERT INTO {{table}} SET +user='{$user}', +galaxie='{$galaxie}', +systeme='{$systeme}', +metala='{$metalvendre}', +cristala='{$cristalvendre}', +deuta='{$deutvendre}', +metals='{$metalsouhait}', +cristals='{$cristalsouhait}', +deuts='{$deutsouhait}'" , "annonce"); $page2 .= << @@ -64,7 +73,7 @@ HTML; } if ($action != 5) { - $statement = $readAdapter->select()->from(array('annonce' => $readAdapter->getTable('annonce')))->order('id', 'DESC')->prepare(); + $annonce = doquery("SELECT * FROM {{table}} ORDER BY `id` DESC ", "annonce"); $page2 = "
@@ -73,9 +82,12 @@ if ($action != 5) { Petites Annonces Infos de livraisonRessources à vendreRessources souhaitéesAction VendeurGalaxieSystèmeMétalCristalDeuteriumMétalCristalDeuteriumDelet -"; - foreach ($statement as $b) { + + + +"; + while ($b = $annonce->fetch(PDO::FETCH_BOTH)) { $page2 .= ' '; $page2 .= $b["user"] ; $page2 .= ''; @@ -107,3 +119,4 @@ if ($action != 5) { display($page2); } +?> \ No newline at end of file diff --git a/src/annonce2.php b/annonce2.php similarity index 95% rename from src/annonce2.php rename to annonce2.php index 29baec1..7f90582 100644 --- a/src/annonce2.php +++ b/annonce2.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/application/bootstrap.php b/application/bootstrap.php similarity index 66% rename from src/application/bootstrap.php rename to application/bootstrap.php index b0b3c9c..b6eda0d 100644 --- a/src/application/bootstrap.php +++ b/application/bootstrap.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -28,11 +28,9 @@ * */ -if (!defined('PHP_VERSION_ID')) { - $version = explode('.',PHP_VERSION); - define('PHP_VERSION_ID', (((int)$version[0]) * 10000 + ((int)$version[1]) * 100 + ((int)$version[2]))); - unset($version); -} +defined('BCNUMBERS') || define('BCNUMBERS', true); +defined('DEPRECATION') || define('DEPRECATION', true); +defined('DEBUG') || define('DEBUG', true); if (!defined('DEBUG') && ($env = getenv('DEBUG')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) { define('DEBUG', true); @@ -62,9 +60,9 @@ if (!defined('DEBUG')) { defined('ROOT_PATH') || define('ROOT_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR); defined('APPLICATION_PATH') || define('APPLICATION_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR); -defined('PHPEXT') || define('PHPEXT', 'php'); +defined('PHPEXT') || define('PHPEXT', require 'extension.inc'); -defined('VERSION') || define('VERSION', '1.5.0-beta2'); +defined('VERSION') || define('VERSION', '2011.1'); set_include_path(implode(PATH_SEPARATOR, array( APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'libraries', @@ -78,36 +76,25 @@ function __autoload($class) { include_once str_replace('_', '/', $class) . '.php'; } -if (defined('IN_ADMIN')) { - $website = new Wootook_Core_Model_Website(); - $website->setId(0)->setData('code', 'admin'); - Wootook::addWebsite($website); - Wootook::setDefaultWebsite($website); +Wootook_Core_Time::init(); +Wootook_Core_ErrorProfiler::register(); +Wootook_Core_Model_Config_Events::registerEvents(); - $game = new Wootook_Core_Model_Game(); - $game->setId(0)->setData('code', 'admin')->setData('website_id', $website->getId()); - Wootook::addGame($game); - Wootook::setDefaultGame($game); -} - -include ROOT_PATH . 'includes/constants.php'; - -if (defined('DEBUG')) { - Wootook_Core_ErrorProfiler::register(); -} -Wootook_Core_Helper_Config_Events::registerEvents(); - -if (!Wootook::$isInstalled) { - Wootook::getResponse() - ->setRedirect(Wootook::getStaticUrl('install/'), Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_TEMPORARY) - ->sendHeaders(); - exit(0); +if (0 === filesize(ROOT_PATH . 'config.php')) { + header('Location: install/'); + die(); } $lang = array(); +define('TEMPLATE_DIR', realpath(ROOT_PATH . '/templates/')); +define('TEMPLATE_NAME', 'OpenGame'); define('DEFAULT_LANG', 'fr'); +include(ROOT_PATH . 'includes/debug.class.'.PHPEXT); +$debug = new Debug(); + +include(ROOT_PATH . 'includes/constants.' . PHPEXT); include(ROOT_PATH . 'includes/functions.' . PHPEXT); include(ROOT_PATH . 'includes/unlocalised.' . PHPEXT); include(ROOT_PATH . 'includes/todofleetcontrol.' . PHPEXT); @@ -115,26 +102,20 @@ include(ROOT_PATH . 'language/' . DEFAULT_LANG . '/lang_info.cfg'); include(ROOT_PATH . 'includes/vars.' . PHPEXT); include(ROOT_PATH . 'includes/strings.' . PHPEXT); -$user = Wootook_Player_Model_Session::getSingleton()->getPlayer(); +$gameConfig = Wootook_Core_Model_Config::getSingleton(); +if (isset($gameConfig['cookie_name']) && !empty($gameConfig['cookie_name'])) { + Wootook_Empire_Model_User::setCookieName($gameConfig['cookie_name']); +} +$user = Wootook_Empire_Model_User::getSingleton(); if (!defined('DISABLE_IDENTITY_CHECK')) { - if ($user === null || !$user->getId()) { - Wootook::getResponse() - ->setRedirect(Wootook::getUrl('player/account/login')) - ->sendHeaders(); + if (($user === null || !$user->getId())) { + header('Location: login.php'); exit(0); } - //var_dump(Wootook::getGameConfig('game/general/active')); - if (!Wootook::getGameConfig('game/general/active')/* && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))*/) { - $layout = new Wootook_Core_Model_Layout(Wootook_Core_Model_Layout::DOMAIN_FRONTEND); - $layout->load('message'); - - $block = $layout->getBlock('message'); - $block['title'] = Wootook::__('Game is disabled.'); - $block['message'] = Wootook::getGameConfig('game/general/closing-message'); - - echo $layout->render(); + if ($gameConfig->isEnabled() && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) { + message(stripslashes($gameConfig->getData('close_reason')), $gameConfig->getData('game_name')); exit(0); } } @@ -160,4 +141,4 @@ if (($user !== null && $user->getId())) { 'planet' => $planet )); $planet->save(); -} +} \ No newline at end of file diff --git a/src/application/cache/.placeholder b/application/code/community/.placeholder similarity index 100% rename from src/application/cache/.placeholder rename to application/code/community/.placeholder diff --git a/src/application/code/core/Legacies/Empire.php b/application/code/core/Legacies/Empire.php similarity index 95% rename from src/application/code/core/Legacies/Empire.php rename to application/code/core/Legacies/Empire.php index eb5b24b..f0c44b0 100644 --- a/src/application/code/core/Legacies/Empire.php +++ b/application/code/core/Legacies/Empire.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -99,7 +99,6 @@ class Legacies_Empire const ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK = 123; const ID_RESEARCH_EXPEDITION_TECHNOLOGY = 124; const ID_RESEARCH_ASTROPHYSICS = 124; - const ID_RESEARCH_ORE_MINING = 125; const ID_RESEARCH_GRAVITON_TECHNOLOGY = 199; const ID_SHIP_LIGHT_TRANSPORT = 202; @@ -117,7 +116,6 @@ class Legacies_Empire const ID_SHIP_DEATH_STAR = 214; const ID_SHIP_BATTLECRUISER = 215; const ID_SHIP_SUPERNOVA = 216; - const ID_SHIP_ORE_MININER = 217; const ID_DEFENSE_ROCKET_LAUNCHER = 401; const ID_DEFENSE_LIGHT_LASER = 402; @@ -146,11 +144,10 @@ class Legacies_Empire const ID_MISSION_DESTROY = 9; const ID_MISSION_MISSILES = 10; const ID_MISSION_EXPEDITION = 15; - const ID_MISSION_ORE_MINING = 16; public static function getFieldName($id) { - $fieldsAlias = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); + $fieldsAlias = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); if (!isset($fieldsAlias[$id])) { return null; @@ -158,4 +155,4 @@ class Legacies_Empire return $fieldsAlias[$id]; } -} +} \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab.php b/application/code/core/Legacies/Empire/Block/Planet/ResearchLab.php similarity index 92% rename from src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab.php rename to application/code/core/Legacies/Empire/Block/Planet/ResearchLab.php index 1c995b4..841f1a1 100644 --- a/src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab.php +++ b/application/code/core/Legacies/Empire/Block/Planet/ResearchLab.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -49,7 +49,7 @@ class Legacies_Empire_Block_Planet_ResearchLab public function getPlanet() { if ($this->_planet === null) { - $this->_planet = Wootook_Player_Model_Session::getSingleton()->getPlayer() + $this->_planet = Wootook_Empire_Model_User::getSingleton() ->getCurrentPlanet() ; } @@ -58,7 +58,7 @@ class Legacies_Empire_Block_Planet_ResearchLab public function _initChildBlocks() { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); /** @var Wootook_Core_Block_Concat $parentBlock */ $parentBlock = $this->getLayout()->getBlock('item-list.items'); diff --git a/src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Item.php b/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Item.php similarity index 96% rename from src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Item.php rename to application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Item.php index 8d5e448..4068617 100644 --- a/src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Item.php +++ b/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Item.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -27,7 +27,6 @@ * documentation for further information about customizing Wootook. * */ - /** * * Enter description here ... @@ -39,7 +38,7 @@ class Legacies_Empire_Block_Planet_ResearchLab_Item { public function getLevel() { - return $this->getPlayer()->getElement($this->getItemId()); + return $this->getUser()->getElement($this->getItemId()); } public function getResourcesNeeded($level) diff --git a/src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue.php b/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue.php rename to application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue.php index a880688..f69418e 100644 --- a/src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue.php +++ b/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue/Item.php b/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue/Item.php similarity index 86% rename from src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue/Item.php rename to application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue/Item.php index a825cfa..a95ee9a 100644 --- a/src/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue/Item.php +++ b/application/code/core/Legacies/Empire/Block/Planet/ResearchLab/Queue/Item.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -37,11 +37,11 @@ class Legacies_Empire_Block_Planet_ResearchLab_Queue_Item extends Wootook_Empire_Block_Planet_Builder_Queue_ItemAbstract { - protected $_itemIdField = 'technology_id'; + protected $_itemIdField = 'research_id'; public function getLevel() { - return $this->getPlayer()->getElement($this->getItemId()); + return $this->getUser()->getElement($this->getItemId()); } public function getResourcesNeeded($level) @@ -49,6 +49,11 @@ class Legacies_Empire_Block_Planet_ResearchLab_Queue_Item return $this->getPlanet()->getResearchLab()->getResourcesNeeded($this->getItemId(), $this->getQueuedLevel() + 1); } + public function getItemQueuedLevel() + { + return $this->getItem()->getData('level'); + } + public function getQueuedLevel() { return $this->getPlanet()->getResearchLab()->getResearchLevelQueued($this->getItemId()); @@ -59,15 +64,6 @@ class Legacies_Empire_Block_Planet_ResearchLab_Queue_Item return $this->getPlanet()->getResearchLab()->getBuildingTime($this->getItemId(), $level); } - public function getBuildingRemainingTime() - { - $totalTime = $this->getPlanet()->getResearchLab() - ->getResearchTime($this->getItemId(), $this->getItemQueuedLevel()); - $item = $this->getItem(); - - return $totalTime - ($item->getData('created_at') - $item->getData('updated_at')); - } - public function getResourcesConfigForLevel($level) { $resources = $this->getResourcesNeeded($level); @@ -98,4 +94,4 @@ class Legacies_Empire_Block_Planet_ResearchLab_Queue_Item { return $this->getBuildingTime($this->getNextLevel()); } -} +} \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard.php b/application/code/core/Legacies/Empire/Block/Planet/Shipyard.php similarity index 91% rename from src/application/code/core/Legacies/Empire/Block/Planet/Shipyard.php rename to application/code/core/Legacies/Empire/Block/Planet/Shipyard.php index c33a6e4..f84b8d1 100644 --- a/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard.php +++ b/application/code/core/Legacies/Empire/Block/Planet/Shipyard.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -54,7 +54,7 @@ class Legacies_Empire_Block_Planet_Shipyard public function getPlanet() { if ($this->_planet === null) { - $this->_planet = Wootook_Player_Model_Session::getSingleton()->getPlayer() + $this->_planet = Wootook_Empire_Model_User::getSingleton() ->getCurrentPlanet() ; } @@ -97,11 +97,7 @@ class Legacies_Empire_Block_Planet_Shipyard public function _initChildBlocks() { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); - - if (!$this->getPlanet() || !$this->getPlanet()->getShipyard()) { - return $this; - } + $types = Wootook_Empire_Model_Game_Types::getSingleton(); /** @var Wootook_Core_Block_Concat $parentBlock */ $parentBlock = $this->getLayout()->getBlock('item-list.items'); @@ -116,4 +112,4 @@ class Legacies_Empire_Block_Planet_Shipyard return $this; } -} +} \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php b/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php similarity index 95% rename from src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php rename to application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php index 0b42ac2..e5d9768 100644 --- a/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php +++ b/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -42,11 +42,6 @@ class Legacies_Empire_Block_Planet_Shipyard_Item return $this->getPlanet()->getElement($this->getItemId()); } - public function getClass() - { - return $this->getLabel('class'); - } - public function getResourcesNeeded($qty) { return $this->getPlanet()->getShipyard()->getResourcesNeeded($this->getItemId(), $qty); @@ -82,4 +77,4 @@ class Legacies_Empire_Block_Planet_Shipyard_Item } return $resourceConfig; } -} +} \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Queue.php b/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Queue.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Queue.php rename to application/code/core/Legacies/Empire/Block/Planet/Shipyard/Queue.php index ea621fa..1bcd0c0 100644 --- a/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Queue.php +++ b/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Queue.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/core/Legacies/Empire/Exception.php b/application/code/core/Legacies/Empire/Exception.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Exception.php rename to application/code/core/Legacies/Empire/Exception.php index 6527b43..70fcf02 100644 --- a/src/application/code/core/Legacies/Empire/Exception.php +++ b/application/code/core/Legacies/Empire/Exception.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/CristalMine.php b/application/code/core/Legacies/Empire/Model/Planet/Building/CristalMine.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/CristalMine.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/CristalMine.php index ef720df..2cd8971 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/CristalMine.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/CristalMine.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -36,7 +36,7 @@ class Legacies_Empire_Model_Planet_Building_CristalMine implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface { - public function getProductionRatios($level, $produtionRatio, $planet, $player) + public function getProductionRatios($level, $produtionRatio, $planet, $user) { return array( Legacies_Empire::RESOURCE_CRISTAL => 10 + 20 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio), diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/DeuteriumSynthetiser.php b/application/code/core/Legacies/Empire/Model/Planet/Building/DeuteriumSynthetiser.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/DeuteriumSynthetiser.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/DeuteriumSynthetiser.php index 5556a4c..69447dc 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/DeuteriumSynthetiser.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/DeuteriumSynthetiser.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -36,7 +36,7 @@ class Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface { - public function getProductionRatios($level, $produtionRatio, $planet, $player) + public function getProductionRatios($level, $produtionRatio, $planet, $user) { return array( Legacies_Empire::RESOURCE_DEUTERIUM => 10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio), diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/FusionReactor.php b/application/code/core/Legacies/Empire/Model/Planet/Building/FusionReactor.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/FusionReactor.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/FusionReactor.php index e3d32aa..923a6eb 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/FusionReactor.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/FusionReactor.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -36,7 +36,7 @@ class Legacies_Empire_Model_Planet_Building_FusionReactor implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface { - public function getProductionRatios($level, $produtionRatio, $planet, $player) + public function getProductionRatios($level, $produtionRatio, $planet, $user) { return array( Legacies_Empire::RESOURCE_DEUTERIUM => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio), diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/MetalMine.php b/application/code/core/Legacies/Empire/Model/Planet/Building/MetalMine.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/MetalMine.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/MetalMine.php index e67f459..884a964 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/MetalMine.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/MetalMine.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -37,7 +37,7 @@ class Legacies_Empire_Model_Planet_Building_MetalMine implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface { - public function getProductionRatios($level, $produtionRatio, $planet, $player) + public function getProductionRatios($level, $produtionRatio, $planet, $user) { return array( Legacies_Empire::RESOURCE_METAL => 20 + 30 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio), diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/NaniteFactory.php b/application/code/core/Legacies/Empire/Model/Planet/Building/NaniteFactory.php similarity index 76% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/NaniteFactory.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/NaniteFactory.php index 05f1163..08554ec 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/NaniteFactory.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/NaniteFactory.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -36,16 +36,17 @@ class Legacies_Empire_Model_Planet_Building_NaniteFactory implements Wootook_Empire_Model_Planet_BuildingInterface { - public static function buildingEnhancementListener(Wootook_Core_Event $event) + public static function buildingTimeListener($event) { - /** @var float $enhancement */ - $enhancement = $event->getData('enhancement'); - - /** @var Wootook_Empire_Model_Planet $planet */ $planet = $event->getData('planet'); - $level = $planet->getElement(Legacies_Empire::ID_BUILDING_NANITE_FACTORY); + if (!$planet->getId() || ($level = $planet->getElement(Legacies_Empire::ID_BUILDING_NANITE_FACTORY)) <= 0) { + return; + } - $event->setData('enhancement', $enhancement * pow(.5, $level)); + $time = $event->getData('time'); + + $speedFactor = pow(2, $level); + $event->setData('time', $time / $speedFactor); } -} +} \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab.php b/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab.php similarity index 78% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab.php index 6c5ff41..31789d2 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -38,8 +38,7 @@ * @subpackage Legacies_Empire */ class Legacies_Empire_Model_Planet_Building_ResearchLab - implements Wootook_Empire_Model_Planet_BuildingInterface, - Wootook_Empire_Model_Planet_QueueInterface + implements Wootook_Empire_Model_Planet_BuildingInterface { private $_eventPrefix = 'planet.laboratory.'; @@ -50,14 +49,14 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab protected $_currentPlanet = null; /** - * Player instance - * @var Woootook_Player_Model_Entity + * User instance + * @var Legacies_Empire_Model_User */ - protected $_currentPlayer = null; + protected $_currentUser = null; /** * construction queue - * @var Legacies_Empire_Model_Planet_Building_ResearchLab_Builder + * @var array */ protected $_builder = null; @@ -72,17 +71,17 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab * it doesn't yet exist. * * @param Legacies_Empire_Model_Planet $currentPlanet - * @param Woootook_Player_Model_Entity $currentPlayer + * @param Legacies_Empire_Model_User $currentUser * @return Legacies_Empire_Model_Planet_Building_ResearchLab */ - public static function factory($currentPlanet, $currentPlayer) + public static function factory($currentPlanet, $currentUser) { if ($currentPlanet->getId()) { return null; } if (!isset(self::$_instances[$currentPlanet->getId()])) { - self::$_instances[$currentPlanet->getId()] = new self($currentPlanet, $currentPlayer); + self::$_instances[$currentPlanet->getId()] = new self($currentPlanet, $currentUser); } return self::$_instances[$currentPlanet->getId()]; } @@ -93,14 +92,14 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab * @see Legacies_Empire_Model_Planet_Building_ResearchLab::factory() * * @param Legacies_Empire_Model_Planet $currentPlanet - * @param Woootook_Player_Model_Entity $currentPlayer + * @param Legacies_Empire_Model_User $currentUser */ - public function __construct($currentPlanet, $currentPlayer) + public function __construct($currentPlanet, $currentUser) { $this->_currentPlanet = $currentPlanet; - $this->_currentPlayer = $currentPlayer; + $this->_currentUser = $currentUser; - $this->_builder = new Legacies_Empire_Model_Planet_Building_ResearchLab_Builder($currentPlanet, $currentPlayer); + $this->_builder = new Legacies_Empire_Model_Planet_Building_ResearchLab_Builder($currentPlanet, $currentUser); } /** @@ -120,14 +119,16 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab * @param int|string $level * @return Legacies_Empire_Model_Planet_Building_ResearchLab */ - public function appendQueue($researchId, $level = null, Wootook_Core_DateTime $time = null) + public function appendQueue($researchId, $destroy = false, $time = null) { if ($time === null) { - $time = new Wootook_Core_DateTime(); + $time = Wootook::now(); } - if ($level === null) { - $level = $this->_currentPlayer->getElement($researchId) + 1; + if ($destroy === false) { + $level = $this->_currentUser->getElement($researchId) + 1; + } else { + $level = max($this->_currentUser->getElement($researchId) - 1, 0); } // Dispatch event @@ -137,7 +138,7 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab 'time' => &$time, 'laboratory' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); $this->_builder->appendQueue($researchId, $level, $time); @@ -149,7 +150,7 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab 'time' => $time, 'laboratory' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); return $this; @@ -160,10 +161,10 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab * * @return Legacies_Empire_Model_Planet_Building_ResearchLab */ - public function updateQueue(Wootook_Core_DateTime $time = null) + public function updateQueue($time = null) { if ($time === null) { - $time = new Wootook_Core_DateTime(); + $time = Wootook::now(); } // Dispatch event @@ -171,7 +172,7 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab 'time' => &$time, 'laboratory' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); $this->_builder->updateQueue($time); @@ -181,7 +182,7 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab 'time' => $time, 'laboratory' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); return $this; @@ -208,22 +209,18 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab public function checkAvailability($researchId) { try { - if (!$this->_builder->checkAvailability($researchId)) { - return false; - } - // Dispatch event Wootook::dispatchEvent($this->_eventPrefix . 'check-availability', array( 'research_id' => $researchId, 'laboratory' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); } catch (Legacies_Core_Event_Break $e) { return false; } - return true; + return $this->_builder->checkAvailability($researchId); } public function getResourcesNeeded($researchId, $level) @@ -233,12 +230,12 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab public function getResearchTime($researchId, $level) { - return $this->_builder->getBuildingTime($researchId, $level); + $this->_builder->getBuildingTime($researchId, $level); } public function getResearchLevelQueued($researchId) { - $level = $this->_currentPlayer->getElement($researchId); + $level = $this->_currentUser->getElement($researchId); foreach ($this->_builder as $item) { if ($item->getData('research_id') != $researchId) { continue; @@ -263,9 +260,9 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab $time = $eventData['time']; } - $researchLab = $planet->getResearchLab(); - if ($researchLab !== null) { - $researchLab->updateQueue(); + $shipyard = $planet->getResearchLab(); + if ($shipyard !== null) { + $shipyard->updateQueue(); } } } diff --git a/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php b/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php new file mode 100644 index 0000000..82777f1 --- /dev/null +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php @@ -0,0 +1,252 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero 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 Wootook. + * + */ +/** + * + * Enter description here ... + * @author Greg + * + */ +class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder + extends Wootook_Empire_Model_BuilderAbstract +{ + /** + * @var int + */ + protected $_maxLength = 0; + + public function init() + { + $this->_unserializeQueue($this->_currentUser->getData('b_laboratory_id')); + } + + /** + * @param int $buildingId + * @param int $level + * @param int $time + */ + protected function _initItem(Array $params) + { + if (!isset($params['technology_id']) || !isset($params['level'])) { + return null; + } + + $technologyId = $params['technology_id']; + $level = $params['level']; + if (!isset($params['created_at'])) { + $createdAt = time(); + } else { + $createdAt = $params['created_at']; + } + if (!isset($params['updated_at'])) { + $updatedAt = $createdAt; + } else { + $updatedAt = $params['updated_at']; + } + + return new Legacies_Empire_Model_Planet_Building_ResearchLab_Item(array( + 'technology_id' => $technologyId, + 'level' => $level, + 'created_at' => $createdAt, + 'updated_at' => $updatedAt + )); + } + + /** + * Check if a technology type is actually buildable on the current + * planet, depending on the technology and buildings requirements. + * + * @param int $technologyId + * @return bool + */ + public function checkAvailability($technologyId) + { + $types = Wootook_Empire_Model_Game_Types::getSingleton(); + + if (!$types->is($technologyId, Legacies_Empire::TYPE_RESEARCH)) { + return false; + } + + parent::checkAvailability($technologyId); + + return true; + } + + /** + * Returns the time needed to build $level of $technologyId + * + * @param int $technologyId + * @param int $level + */ + public function getBuildingTime($technologyId, $level) + { + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); + $gameConfig = Wootook_Core_Model_Config::getSingleton(); + + Math::setPrecision(50); + + // FIXME: Resource dependency + $totalCost = Math::mul(Math::add($prices[$technologyId][Legacies_Empire::RESOURCE_METAL], $prices[$technologyId][Legacies_Empire::RESOURCE_CRISTAL]), $level); + $speedFactor = $gameConfig->getData('game_speed'); + + // FIXME: Building & Technology dependency + $extraLaboratoriesLevels = 0; + $researchNetworkLevel = $this->_currentUser->getElement(Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK); + if ($researchNetworkLevel > 0) { + $laboratoriesLevels = array(); + foreach ($this->_currentUser->getPlanetCollection() as $planet) { + if ($this->_currentPlanet->getId() == $planet->getId()) { + continue; + } + $level = $planet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB); + if ($level > 0) { + $laboratoriesLevels[] = (int) $level; + } + } + sort($laboratoriesLevels, SORT_NUMERIC); + $extraLaboratoriesLevels = array_sum(array_slice(array_reverse($laboratoriesLevels), 0, $researchNetworkLevel)); + } + + $laboratorySpeedup = Math::div($totalCost, ($this->_currentPlanet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB) + 1 + $extraLaboratoriesLevels)); + + Math::setPrecision(); + + $baseTime = ($totalCost / $speedFactor) * $laboratorySpeedup; + + return (int) Math::floor($baseTime * 3600); + } + + /** + * (non-PHPdoc) + * @see Legacies_Empire_Model_BuilderAbstract::getResourcesNeeded() + */ + public function getResourcesNeeded($technologyId, $level) + { + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); + + if (!isset($prices[$technologyId])) { + return array(); + } + $resourcesNeeded = array(); + foreach ($resources as $resourceId => $resourceConfig) { + if (!isset($prices[$technologyId][$resourceId])) { + continue; + } + if (Math::isPositive($prices[$technologyId][$resourceId])) { + $firstLevelCost = $prices[$technologyId][$resourceId]; + $partialLevelCost = Math::mul($firstLevelCost, Math::pow($prices[$technologyId][Legacies_Empire::RESOURCE_MULTIPLIER], $level)); + $resourcesNeeded[$resourceId] = Math::sub($partialLevelCost, $firstLevelCost); + } + } + + return $resourcesNeeded; + } + + /** + * Update the contruction queue. + * + * @return Legacies_Empire_Model_Planet_Building_ResearchLab + */ + public function updateQueue($time) + { + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); + + $elapsedTime = $time - $this->_currentUser->getData('b_laboratory'); + + foreach ($this->getQueue() as $element) { + $technologyId = $element->getData('research_id'); + $level = $element->getData('level'); + $buildTime = $this->getBuildingTime($technologyId, $level); + + if ($elapsedTime >= $buildTime) { + $this->_currentUser[$fields[$technologyId]] = Math::add($this->_currentUser[$fields[$technologyId]], $level); + $elapsedTime -= $buildTime; + $this->dequeue($element); + continue; + } + + $timeRatio = $elapsedTime / $buildTime; + $itemsBuilt = Math::mul($timeRatio, $level); + + $element->setData('updated_at', $time); + $element->setData('level', Math::sub($level, $itemsBuilt)); + $this->_currentUser->setData($fields[$technologyId], Math::add($this->_currentUser->getData($fields[$technologyId]), $itemsBuilt)); + break; + } + + $this->_currentUser->setData('b_laboratory_id', $this->serialize()); + $this->_currentUser->setData('b_laboratory', $time); + + return $this; + } + + /** + * Append items to build to the construction list + * + * @param int $technologyId + * @param int|string $level + * @return Legacies_Empire_Model_Planet_Building_ResearchLab + */ + public function appendQueue($technologyId, $level, $time) + { + if ($this->_maxLength > 0 && $this->count() >= $this->_maxLength) { + return $this; + } + + if (!Math::isPositive($level)) { + return $this; + } + + $types = Wootook_Empire_Model_Game_Types::getSingleton(); + if (!$types->is($technologyId, Legacies_Empire::TYPE_RESEARCH)) { + return $this; + } + + if (!$this->checkAvailability($technologyId)) { + return $this; + } + + $resourcesNeeded = $this->getResourcesNeeded($technologyId, $level); + $remainingAmounts = $this->_calculateResourceRemainingAmounts($resourcesNeeded); + if ($remainingAmounts === false) { + return $this; + } + + $this->enqueue($technologyId, $level, $time); + $this->_currentUser->setData('b_laboratory_id', $this->serialize()); + + foreach ($remainingAmounts as $resourceId => $resourceAmount) { + $this->_currentPlanet[$resourceId] = $resourceAmount; + } + + return $this; + } +}; \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Item.php b/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Item.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Item.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Item.php index c70a8fa..557c257 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Item.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Item.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/RoboticFactory.php b/application/code/core/Legacies/Empire/Model/Planet/Building/RoboticFactory.php similarity index 76% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/RoboticFactory.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/RoboticFactory.php index 5e6b3c8..574156b 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/RoboticFactory.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/RoboticFactory.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -36,16 +36,17 @@ class Legacies_Empire_Model_Planet_Building_RoboticFactory implements Wootook_Empire_Model_Planet_BuildingInterface { - public static function buildingEnhancementListener(Wootook_Core_Event $event) + public static function buildingTimeListener($event) { - /** @var float $enhancement */ - $enhancement = $event->getData('enhancement'); - - /** @var Wootook_Empire_Model_Planet $planet */ $planet = $event->getData('planet'); - $level = $planet->getElement(Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY); + if (!$planet->getId() || ($level = $planet->getElement(Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY)) <= 0) { + return; + } - $event->setData('enhancement', $enhancement * (2 / (1 + $level))); + $time = $event->getData('time'); + + $speedFactor = 1 + $level; + $event->setData('time', $time / $speedFactor); } -} +} \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard.php b/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard.php similarity index 84% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard.php index b8c93b9..c41bcca 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -38,8 +38,7 @@ * @subpackage Legacies_Empire */ class Legacies_Empire_Model_Planet_Building_Shipyard - implements Wootook_Empire_Model_Planet_BuildingInterface, - Wootook_Empire_Model_Planet_QueueInterface + implements Wootook_Empire_Model_Planet_BuildingInterface { private $_eventPrefix = 'planet.shipyard.'; @@ -50,10 +49,10 @@ class Legacies_Empire_Model_Planet_Building_Shipyard protected $_currentPlanet = null; /** - * Player instance - * @var Woootook_Player_Model_Entity + * User instance + * @var Legacies_Empire_Model_User */ - protected $_currentPlayer = null; + protected $_currentUser = null; /** * construction queue @@ -84,17 +83,17 @@ class Legacies_Empire_Model_Planet_Building_Shipyard * it doesn't yet exist. * * @param Legacies_Empire_Model_Planet $currentPlanet - * @param Woootook_Player_Model_Entity $currentPlayer + * @param Legacies_Empire_Model_User $currentUser * @return Legacies_Empire_Model_Planet_Building_Shipyard */ - public static function factory($currentPlanet, $currentPlayer) + public static function factory($currentPlanet, $currentUser) { if ($currentPlanet->getId()) { return null; } if (!isset(self::$_instances[$currentPlanet->getId()])) { - self::$_instances[$currentPlanet->getId()] = new self($currentPlanet, $currentPlayer); + self::$_instances[$currentPlanet->getId()] = new self($currentPlanet, $currentUser); } return self::$_instances[$currentPlanet->getId()]; } @@ -105,14 +104,25 @@ class Legacies_Empire_Model_Planet_Building_Shipyard * @see Legacies_Empire_Model_Planet_Building_Shipyard::factory() * * @param Legacies_Empire_Model_Planet $currentPlanet - * @param Woootook_Player_Model_Entity $currentPlayer + * @param Legacies_Empire_Model_User $currentUser */ - public function __construct($currentPlanet, $currentPlayer) + public function __construct($currentPlanet, $currentUser) { $this->_currentPlanet = $currentPlanet; - $this->_currentPlayer = $currentPlayer; + $this->_currentUser = $currentUser; - $this->_builder = new Legacies_Empire_Model_Planet_Building_Shipyard_Builder($currentPlanet, $currentPlayer); + $this->_builder = new Legacies_Empire_Model_Planet_Building_Shipyard_Builder($currentPlanet, $currentUser); + } + + /** + * Returns the timestamp at the instance creation. + * + * @deprecated + * @return int + */ + protected function _now() + { + return Wootook::now(); } /** @@ -132,10 +142,10 @@ class Legacies_Empire_Model_Planet_Building_Shipyard * @param int|string $qty * @return Legacies_Empire_Model_Planet_Building_Shipyard */ - public function appendQueue($shipId, $qty, Wootook_Core_DateTime $time = null) + public function appendQueue($shipId, $qty, $time = null) { if ($time === null) { - $time = new Wootook_Core_DateTime(); + $time = Wootook::now(); } // Dispatch event @@ -145,7 +155,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard 'time' => &$time, 'shipyard' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); $this->_builder->appendQueue($shipId, $qty, $time); @@ -157,7 +167,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard 'time' => $time, 'shipyard' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); return $this; @@ -168,10 +178,10 @@ class Legacies_Empire_Model_Planet_Building_Shipyard * * @return Legacies_Empire_Model_Planet_Building_Shipyard */ - public function updateQueue(Wootook_Core_DateTime $time = null) + public function updateQueue($time = null) { if ($time === null) { - $time = new Wootook_Core_DateTime(); + $time = Wootook::now(); } // Dispatch event @@ -179,7 +189,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard 'time' => &$time, 'shipyard' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); $this->_builder->updateQueue($time); @@ -189,7 +199,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard 'time' => $time, 'shipyard' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); return $this; @@ -221,7 +231,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard 'ship_id' => $shipId, 'shipyard' => $this, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer + 'user' => $this->_currentUser )); } catch (Legacies_Core_Event_Break $e) { return false; @@ -266,7 +276,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard $time = $eventData['time']; } - $shipyard = self::factory($planet, $planet->getPlayer()); + $shipyard = self::factory($planet, $planet->getUser()); if ($shipyard !== null) { $shipyard->updateQueue(); } diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php b/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php similarity index 82% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php index a9bee0b..f5a7299 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Builder.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -42,11 +42,6 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder */ protected $_maxLength = 0; - /** - * @var float - */ - protected $_speedEnhancement = null; - public function init() { $this->_unserializeQueue($this->_currentPlanet->getData('b_hangar_id')); @@ -66,7 +61,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder $shipId = $params['ship_id']; $qty = $params['qty']; if (!isset($params['created_at'])) { - $createdAt = new Wootook_Core_DateTime(); + $createdAt = time(); } else { $createdAt = $params['created_at']; } @@ -84,21 +79,6 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder )); } - public function getSpeedEnhancement() - { - if ($this->_speedEnhancement === null) { - $event = Wootook::dispatchEvent('planet.shipyard.speed-enhancement', array( - 'player' => $this->_currentPlanet, - 'planet' => $this->_currentPlanet, - 'enhancement' => 1 - )); - - $this->_speedEnhancement = $event->getData('enhancement'); - } - - return $this->_speedEnhancement; - } - /** * Check if a ship or defense type is actually buildable on the current * planet, depending on the technology and buildings requirements. @@ -108,13 +88,15 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder */ public function checkAvailability($shipId) { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); if (!$types->is($shipId, Legacies_Empire::TYPE_SHIP) && !$types->is($shipId, Legacies_Empire::TYPE_DEFENSE)) { return false; } - return parent::checkAvailability($shipId); + parent::checkAvailability($shipId); + + return true; } /** @@ -126,9 +108,9 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder */ public function getMaximumBuildableElementsCount($shipId) { - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); - $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); $qty = 0; foreach ($resources as $resourceId => $_) { @@ -202,20 +184,22 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder */ public function getBuildingTime($shipId, $qty) { - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); + $gameConfig = Wootook_Core_Model_Config::getSingleton(); Math::setPrecision(50); - $buildingTime = Math::mul($prices[$shipId][Legacies_Empire::BASE_BUILDING_TIME], intval($qty)); + $buildingTime = Math::mul($prices[$shipId][Legacies_Empire::BASE_BUILDING_TIME], $qty); + + $speedFactor = $gameConfig->getData('game_speed'); + $baseTime = Math::div($buildingTime, $speedFactor); - $speedFactor = Wootook::getGameConfig('game/speed/general') / 1000; - $baseTime = Math::mul(Math::div($buildingTime, 5000), Math::mul($speedFactor, $this->getSpeedEnhancement())); Math::setPrecision(); $event = Wootook::dispatchEvent('planet.shipyard.building-time', array( 'time' => $baseTime, 'base_time' => $baseTime, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer, + 'user' => $this->_currentUser, 'ship_id' => $shipId, 'qty' => $qty )); @@ -229,8 +213,8 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder */ public function getResourcesNeeded($shipId, $qty) { - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); - $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); if (!isset($prices[$shipId])) { return array(); @@ -266,11 +250,11 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder * * @return Legacies_Empire_Model_Planet_Building_Shipyard */ - public function updateQueue(Wootook_Core_DateTime $time) + public function updateQueue($time) { - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); - $elapsedTime = $time->getTimestamp() - $this->_currentPlanet->getData('b_hangar')->getTimestamp(); + $elapsedTime = $time - $this->_currentPlanet->getData('b_hangar'); foreach ($this->getQueue() as $element) { $shipId = $element->getData('ship_id'); @@ -287,7 +271,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder $timeRatio = $elapsedTime / $buildTime; $itemsBuilt = Math::mul($timeRatio, $qty); - $element->setData('updated_at', $time->getTimestamp()); + $element->setData('updated_at', $time); $element->setData('qty', Math::sub($qty, $itemsBuilt)); $this->_currentPlanet->setData($fields[$shipId], Math::add($this->_currentPlanet->getData($fields[$shipId]), $itemsBuilt)); break; @@ -306,7 +290,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder * @param int|string $qty * @return Legacies_Empire_Model_Planet_Building_Shipyard */ - public function appendQueue($shipId, $qty, Wootook_Core_DateTime $time) + public function appendQueue($shipId, $qty, $time) { if ($this->_maxLength > 0 && $this->count() >= $this->_maxLength) { return $this; @@ -316,7 +300,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder return $this; } - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); if (!$types->is($shipId, Legacies_Empire::TYPE_SHIP) && !$types->is($shipId, Legacies_Empire::TYPE_DEFENSE)) { return $this; } @@ -341,12 +325,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder return $this; } - $this->enqueue(array( - 'ship_id' => $shipId, - 'qty' => $qty, - 'created_at' => $time->getTimestamp(), - 'updated_at' => $time->getTimestamp() - )); + $this->enqueue($shipId, $qty, $time); $this->_currentPlanet->setData('b_hangar_id', $this->serialize()); foreach ($remainingAmounts as $resourceId => $resourceAmount) { @@ -355,4 +334,4 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder return $this; } -} +} \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Item.php b/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Item.php similarity index 97% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Item.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Item.php index 6dac60d..9bc8df3 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Item.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/Shipyard/Item.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/SolarPlant.php b/application/code/core/Legacies/Empire/Model/Planet/Building/SolarPlant.php similarity index 96% rename from src/application/code/core/Legacies/Empire/Model/Planet/Building/SolarPlant.php rename to application/code/core/Legacies/Empire/Model/Planet/Building/SolarPlant.php index e4cab3b..7e57176 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/SolarPlant.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Building/SolarPlant.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -31,7 +31,7 @@ class Legacies_Empire_Model_Planet_Building_SolarPlant implements Wootook_Empire_Model_Planet_ResourceProductionInterface, Wootook_Empire_Model_Planet_BuildingInterface { - public function getProductionRatios($level, $produtionRatio, $planet, $player) + public function getProductionRatios($level, $produtionRatio, $planet, $user) { return array( Legacies_Empire::RESOURCE_ENERGY => 20 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio) diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Ship/LargeTransport.php b/application/code/core/Legacies/Empire/Model/Planet/Ship/LargeTransport.php similarity index 81% rename from src/application/code/core/Legacies/Empire/Model/Planet/Ship/LargeTransport.php rename to application/code/core/Legacies/Empire/Model/Planet/Ship/LargeTransport.php index f0d31e4..6e2c7db 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Ship/LargeTransport.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Ship/LargeTransport.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -39,15 +39,15 @@ class Legacies_Empire_Model_Planet_Ship_LargeTransport { const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE = 4; - public function getBaseSpeed(Wootook_Player_Model_Entity $player) + public function getBaseSpeed(Wootook_Empire_Model_User $user) { - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); return $prices[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_PRIMARY]; } - public function getSpeedMultiplier(Wootook_Player_Model_Entity $player) + public function getSpeedMultiplier(Wootook_Empire_Model_User $user) { - return pow(1.1, $player->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE)); + return pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE)); } } \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Ship/LightTransport.php b/application/code/core/Legacies/Empire/Model/Planet/Ship/LightTransport.php similarity index 70% rename from src/application/code/core/Legacies/Empire/Model/Planet/Ship/LightTransport.php rename to application/code/core/Legacies/Empire/Model/Planet/Ship/LightTransport.php index 15be57f..e08f79e 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Ship/LightTransport.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Ship/LightTransport.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -39,23 +39,23 @@ class Legacies_Empire_Model_Planet_Ship_LightTransport { const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE = 4; - public function getBaseSpeed(Wootook_Player_Model_Entity $player) + public function getBaseSpeed(Wootook_Empire_Model_User $user) { - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); - if ($player->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) { + if ($user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) { return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_PRIMARY]; } else { return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_SECONDARY]; } } - public function getSpeedMultiplier(Wootook_Player_Model_Entity $player) + public function getSpeedMultiplier(Wootook_Empire_Model_User $user) { - if ($player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) { - return pow(1.1, $player->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE)); + if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) { + return pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE)); } else { - return pow(1.2, $player->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE)); + return pow(1.2, $user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE)); } } } \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Ship/SolarSatellite.php b/application/code/core/Legacies/Empire/Model/Planet/Ship/SolarSatellite.php similarity index 83% rename from src/application/code/core/Legacies/Empire/Model/Planet/Ship/SolarSatellite.php rename to application/code/core/Legacies/Empire/Model/Planet/Ship/SolarSatellite.php index b6f132c..39848de 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Ship/SolarSatellite.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Ship/SolarSatellite.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -37,29 +37,29 @@ class Legacies_Empire_Model_Planet_Ship_SolarSatellite extends Wootook_Empire_Model_Planet_ShipAbstract implements Wootook_Empire_Model_Planet_ResourceProductionInterface { - public function getProductionRatios($quantity, $produtionRatio, $planet, $player) + public function getProductionRatios($quantity, $produtionRatio, $planet, $user) { return array( Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity) ); } - public function getBaseSpeed(Wootook_Player_Model_Entity $player) + public function getBaseSpeed(Wootook_Empire_Model_User $user) { return 0; } - public function getSpeedMultiplier(Wootook_Player_Model_Entity $player) + public function getSpeedMultiplier(Wootook_Empire_Model_User $user) { return 0; } - public function getActualSpeed(Wootook_Player_Model_Entity $player) + public function getActualSpeed(Wootook_Empire_Model_User $user) { return 0; } - public function getBaseConsumption(Wootook_Player_Model_Entity $player) + public function getBaseConsumption(Wootook_Empire_Model_User $user) { return 0; } diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Ship/Supernova.php b/application/code/core/Legacies/Empire/Model/Planet/Ship/Supernova.php similarity index 63% rename from src/application/code/core/Legacies/Empire/Model/Planet/Ship/Supernova.php rename to application/code/core/Legacies/Empire/Model/Planet/Ship/Supernova.php index 7025166..ade59ad 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Ship/Supernova.php +++ b/application/code/core/Legacies/Empire/Model/Planet/Ship/Supernova.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -40,37 +40,37 @@ class Legacies_Empire_Model_Planet_Ship_Supernova const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE = 20; const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY = 15; - public function getProductionRatios($quantity, $produtionRatio, $planet, $player) + public function getProductionRatios($quantity, $produtionRatio, $planet, $user) { return array( Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity) * -1250 ); } - public function getBaseSpeed(Wootook_Player_Model_Entity $player) + public function getBaseSpeed(Wootook_Empire_Model_User $user) { - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); - if ($player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE && - $player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) { + if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE && + $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) { return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_PRIMARY]; } else { return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_SECONDARY]; } } - public function getSpeedMultiplier(Wootook_Player_Model_Entity $player) + public function getSpeedMultiplier(Wootook_Empire_Model_User $user) { - if ($player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE && - $player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) { - return pow(1.2, $player->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE)); + if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE && + $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) { + return pow(1.2, $user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE)); } else { - return pow(1.3, $player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE)) * - pow(1.1, $player->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY)); + return pow(1.3, $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE)) * + pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY)); } } - public function getBaseConsumption(Wootook_Player_Model_Entity $player) + public function getBaseConsumption(Wootook_Empire_Model_User $user) { return 0; } diff --git a/src/application/code/core/Legacies/Exception.php b/application/code/core/Legacies/Exception.php similarity index 97% rename from src/application/code/core/Legacies/Exception.php rename to application/code/core/Legacies/Exception.php index a86c60b..95d7b9a 100644 --- a/src/application/code/core/Legacies/Exception.php +++ b/application/code/core/Legacies/Exception.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/core/Wootook/Core/Event.php b/application/code/core/Legacies/Officers/Exception.php similarity index 93% rename from src/application/code/core/Wootook/Core/Event.php rename to application/code/core/Legacies/Officers/Exception.php index 42b4de7..a389e3b 100644 --- a/src/application/code/core/Wootook/Core/Event.php +++ b/application/code/core/Legacies/Officers/Exception.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -27,14 +27,11 @@ * documentation for further information about customizing Wootook. * */ - /** * * Enter description here ... * @author Greg * */ -class Wootook_Core_Event - extends Wootook_Object -{ -} \ No newline at end of file + +interface Legacies_Officers_Exception {} \ No newline at end of file diff --git a/application/code/core/Legacies/Officers/Model/Observer.php b/application/code/core/Legacies/Officers/Model/Observer.php new file mode 100644 index 0000000..65b6dc0 --- /dev/null +++ b/application/code/core/Legacies/Officers/Model/Observer.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 Affero 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 Affero 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 Wootook. + * + */ +/** + * + * Enter description here ... + * @author Greg + * + */ +class Legacies_Officers_Model_Observer +{ + public static function planetUpdateListener($eventData) + { + if (isset($eventData['planet'])) { + $planet = $eventData['planet']; + + $user = $planet->getUser(); + + $level = floor(sqrt($user->getData('xpminier') / 500)); + if ($user->getData('lvl_minier') < $level) { + $difference = $level - $user->getData('lvl_minier'); + if ($difference == 1) { + Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY) + ->addInfo('You gained 1 miner level.'); + } else { + Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY) + ->addInfo('You gained %1$d miner level.', (int) $difference); + } + } + + $level = floor(sqrt($user->getData('xpraid'))); + if ($user->getData('lvl_raid') < $level) { + $difference = $level - $user->getData('lvl_raid'); + if ($difference == 1) { + Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY) + ->addInfo('You gained 1 raider level.'); + } else { + Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY) + ->addInfo('You gained %1$d raider level.', (int) $difference); + } + } + } + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Exception.php b/application/code/core/Legacies/Oficers.php similarity index 95% rename from src/application/code/core/Wootook/Exception.php rename to application/code/core/Legacies/Oficers.php index c3b339a..089b825 100644 --- a/src/application/code/core/Wootook/Exception.php +++ b/application/code/core/Legacies/Oficers.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. @@ -27,11 +27,14 @@ * documentation for further information about customizing Wootook. * */ - /** * * Enter description here ... * @author Greg * */ -interface Wootook_Exception {} \ No newline at end of file + +class Legacies_Officers +{ + +} \ No newline at end of file diff --git a/application/code/core/Wootook.php b/application/code/core/Wootook.php new file mode 100644 index 0000000..d2fbe94 --- /dev/null +++ b/application/code/core/Wootook.php @@ -0,0 +1,285 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero 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 Wootook. + * + */ + +/** + * Bootstrap class, used to access main and global functionalities + * + * @package Wootook + * @category core + */ +class Wootook +{ + /** + * Static list of application event listeners + * + * @var array + */ + private static $_listeners = array(); + + /** + * Static list of all locale translators + * + * @var array + */ + private static $_translators = array(); + + /** + * HTTP request management object + * + * @var Legacies_Core_Controller_Request_Http + */ + protected static $_request = null; + + /** + * HTTP response management object + * + * @var Legacies_Core_Controller_Response + */ + protected static $_response = null; + + /** + * The current timestamp + * + * @var int + */ + protected static $_now = null; + + /** + * Default locale identifier + * + * @var string + */ + protected static $_defaultLocale = 'fr_FR'; + + /** + * + * Enter description here ... + * @var array + */ + protected static $_config = null; + + /** + * Registers an event listener to be called later in the application. + * + * @param string $event The event identifier + * @param callback $listener The event callback to be called + */ + public static function registerListener($event, $listener) + { + if (!isset(self::$_listeners[$event])) { + self::$_listeners[$event] = array(); + } + self::$_listeners[$event][] = $listener; + } + + /** + * Clear all event listeners + */ + public static function clearAllListeners() + { + self::$_listeners = array(); + } + + /** + * Clear a specific event's listeners + * + * @param unknown_type $event + */ + public static function clearEventListeners($event) + { + if (isset(self::$_listeners[$event])) { + self::$_listeners[$event] = array(); + } + } + + /** + * Dispatches an event, calls all callbacks that were previously registered + * + * @param string $event The event identifier + * @param array $params The event params + */ + public static function dispatchEvent($event, $params) + { + $eventObject = new Wootook_Core_Event($params); + + if (!isset(self::$_listeners[$event])) { + return $eventObject; + } + + foreach (self::$_listeners[$event] as $listener) { + call_user_func($listener, $eventObject); + } + + return $eventObject; + } + + /** + * + * Enter description here ... + * @param unknown_type $namespace + * @return Legacies_Core_Model_Session + */ + public static function getSession($namespace) + { + return Wootook_Core_Model_Session::factory($namespace); + } + + public static function getTranslator($locale = null) + { + if ($locale === null) { + $locale = self::getDefaultLocale(); + } + + if (!isset($translator[$locale])) { + $path = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'locale'; + $translator[$locale] = new Wootook_Core_Model_Translator($path, $locale); + } + return $translator[$locale]; + } + + public static function translate($locale, $message, Array $args) + { + return self::getTranslator($locale)->translateArgs($message, $args); + } + + public static function __($message, $_ = null) + { + $args = func_get_args(); + array_shift($args); + + return self::getTranslator(self::getDefaultLocale())->translateArgs($message, $args); + } + + public static function setDefaultLocale($locale) + { + $oldLocale = self::$_defaultLocale; + self::$_defaultLocale = $locale; + + return $oldLocale; + } + + public static function getDefaultLocale() + { + return self::$_defaultLocale; + } + + public static function now() + { + if (self::$_now === null) { + self::$_now = time(); + } + return self::$_now; + } + + public static function getRequest() + { + if (self::$_request === null) { + self::$_request = new Wootook_Core_Controller_Request_Http(); + } + return self::$_request; + } + + public static function setRequest($request) + { + self::$_request = $request; + } + + public static function getResponse() + { + if (self::$_response === null) { + self::$_response = new Wootook_Core_Controller_Response_Http(); + } + return self::$_response; + } + + public static function setResponse($response) + { + self::$_response = $response; + } + + public static function getConfig($path = null) + { + if (self::$_config === null) { + self::$_config = include ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php'; + } + + if ($path === null || !is_string($path)) { + return self::$_config; + } + $config = self::$_config; + foreach (explode('/', $path) as $chunk) { + if (!isset($config[$chunk])) { + return null; + } + $config = $config[$chunk]; + } + return $config; + } + + public static function getBaseUrl() + { + return self::getConfig('global/web/base_url'); + } + + public static function getSkinUrl($package, $theme, $uri, Array $params = array()) + { + return self::getUrl("skin/{$package}/{$theme}/{$uri}", $params); + } + + public static function getUrl($uri, Array $params = array()) + { + $baseUrl = self::getBaseUrl(); + + $serializedParams = array(); + foreach ($params as $paramKey => $paramValue) { + if ($paramValue) { + $serializedParams[] = "{$paramKey}={$paramValue}"; + } + } + + if (count($serializedParams) > 0) { + return $baseUrl . $uri . '?' . implode('&', $serializedParams); + } + return $baseUrl . $uri; + } + + public static function fileExists($path) + { + if ($path === null || empty($path)) { + return false; + } + + if (($fp = @fopen($path, 'r', true)) === false) { + return false; + } + fclose($fp); + return true; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Block/Concat.php b/application/code/core/Wootook/Core/Block/Concat.php similarity index 85% rename from src/application/code/core/Wootook/Core/Block/Concat.php rename to application/code/core/Wootook/Core/Block/Concat.php index cb8dc89..5c9afc5 100644 --- a/src/application/code/core/Wootook/Core/Block/Concat.php +++ b/application/code/core/Wootook/Core/Block/Concat.php @@ -1,7 +1,7 @@ _items[$type])) { + $this->_items[$type] = array(); + } + $this->_items[$type][] = $options; + + return $this; + } + + public function addJs($script, $type = 'text/javascript', Array $options = array()) + { + $options['type'] = $type; + $options['path'] = $script; + + $this->addItem(self::TYPE_GLOBAL_JS, $options); + + return $this; + } + + public function addCss($stylesheet, $type = 'text/css', $condition = null, Array $options = array()) + { + $options['type'] = $type; + $options['path'] = $stylesheet; + $options['condition'] = $condition; + + $this->addItem(self::TYPE_SKIN_CSS, $options); + + return $this; + } + + public function addSkinJs($script, $type = 'text/javascript', Array $options = array()) + { + $options['type'] = $type; + $options['path'] = $script; + + $this->addItem(self::TYPE_SKIN_JS, $options); + + return $this; + } + + public function addInlineJs($content, $type = 'text/javascript', Array $options = array()) + { + $options['type'] = $type; + $options['content'] = $content; + + $this->addItem(self::TYPE_INLINE_JS, $options); + + return $this; + } + + public function addInlineCss($content, $type = 'text/css', Array $options = array()) + { + $options['type'] = $type; + $options['path'] = $path; + $options['content'] = $content; + + $this->addItem(self::TYPE_INLINE_CSS, $options); + + return $this; + } + + public function getCss() + { + if (isset($this->_items[self::TYPE_SKIN_CSS])) { + return $this->_items[self::TYPE_SKIN_CSS]; + } + return array(); + } + + public function getInlineCss() + { + if (isset($this->_items[self::TYPE_INLINE_CSS])) { + return $this->_items[self::TYPE_INLINE_CSS]; + } + return array(); + } + + public function getJs() + { + if (isset($this->_items[self::TYPE_GLOBAL_JS])) { + return $this->_items[self::TYPE_GLOBAL_JS]; + } + return array(); + } + + public function getSkinJs() + { + if (isset($this->_items[self::TYPE_SKIN_JS])) { + return $this->_items[self::TYPE_SKIN_JS]; + } + return array(); + } + + public function getInlineJs() + { + if (isset($this->_items[self::TYPE_INLINE_JS])) { + return $this->_items[self::TYPE_INLINE_JS]; + } + return array(); + } + + public function renderCss() + { + $render = ''; + foreach ($this->getCss() as $css) { + if (!isset($css['media'])) { + $css['media'] = 'all'; + } + $render .=<< +HTML_EOF; + } + return $render; + } + + public function renderJs() + { + $render = ''; + foreach ($this->getJs() as $js) { + if (!isset($js['type'])) { + $js['type'] = 'text/javascript'; + } + $render .=<< +HTML_EOF; + } + return $render; + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Block/Html/Navigation.php b/application/code/core/Wootook/Core/Block/Html/Navigation.php new file mode 100644 index 0000000..3959f6d --- /dev/null +++ b/application/code/core/Wootook/Core/Block/Html/Navigation.php @@ -0,0 +1,66 @@ +_getNode($explodedPath); + + $child = $this->getLayout() + ->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array( + 'url' => array( + 'uri' => $uri, + 'params' => $params + ), + 'label' => $label, + 'title' => $title, + 'classes' => $classes + )); + $parent->setPartial($baseName, $child); + + if ($template !== null) { + $child->setTemplate($template); + } + + return $this; + } + + public function setNodeTitle($path, $title) + { + return $this->getNode($path)->setTitle($title); + } + + public function setNodeTemplate($path, $template) + { + return $this->getNode($path)->setTemplate($template); + } + + public function getNode($path) + { + return $this->_getNode(explode('/', $path)); + } + + protected function _getNode($explodedPath) + { + $name = array_shift($explodedPath); + + if ($this->hasPartial($name)) { + $child = $this->getPartial($name)->_getNode($explodedPath); + } else { + $child = $this->getLayout() + ->createBlock('core/html.navigation.node', $this->getNameInLayout() . '.' . $name); + } + + if ($child instanceof Wootook_Core_Block_Html_Navigation_Link) { + throw new Wootook_Core_Exception_RuntimeException('Node is a link. Could not append a child node to a link node.'); + } + + if (count($explodedPath) == 0) { + return $child; + } + return $child->_getNode($explodedPath); + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Block/Html/Navigation/Link.php b/application/code/core/Wootook/Core/Block/Html/Navigation/Link.php new file mode 100644 index 0000000..cd288e4 --- /dev/null +++ b/application/code/core/Wootook/Core/Block/Html/Navigation/Link.php @@ -0,0 +1,116 @@ +_template !== null) { + return $this->_template; + } + return 'page/html/navigation/link.phtml'; + } + + public function setLabel($label) + { + $this->_label = $label; + + return $this; + } + + public function getLabel() + { + return $this->_label; + } + + public function setTitle($title) + { + $this->_title = $title; + + return $this; + } + + public function getTitle() + { + return $this->_title; + } + + public function setUrl($uri, $params = array()) + { + $this->_uri = $uri; + $this->_params = $params; + + return $this; + } + + public function getLinkUrl($moreParams = array()) + { + $params = array_merge($this->_params, $moreParams); + return $this->getUrl($this->_uri, $params); + } + + public function addClass($class) + { + $this->_classes[] = $class; + + return $this; + } + + public function clearClasses() + { + $this->_classes = array(); + + return $this; + } + + public function renderClasses($moreClasses) + { + $classes = array_merge($this->_classes, $moreClasses); + return implode(' ', $classes); + } + + public function __construct(Array $data = array()) + { + if (isset($data['label'])) { + $this->setLabel($data['label']); + unset($data['label']); + } + + if (isset($data['title'])) { + $this->setTitle($data['title']); + unset($data['title']); + } + + if (isset($data['url'])) { + if (is_array($data['url']) && isset($data['url']['uri'])) { + if (isset($data['url']['params'])) { + $this->setUrl($data['url']['uri'], $data['url']['params']); + } else { + $this->setUrl($data['url']['uri']); + } + } else { + $this->setUrl($data['url']); + } + unset($data['url']); + } + + if (isset($data['classes'])) { + $classes = (array) $data['classes']; + unset($data['classes']); + + foreach ($classes as $class) { + $this->set($class); + } + } + + parent::__construct($data); + + return $this; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Block/Html/Navigation/Node.php b/application/code/core/Wootook/Core/Block/Html/Navigation/Node.php similarity index 100% rename from src/application/code/core/Wootook/Core/Block/Html/Navigation/Node.php rename to application/code/core/Wootook/Core/Block/Html/Navigation/Node.php diff --git a/src/application/code/core/Wootook/Core/Block/Html/Page.php b/application/code/core/Wootook/Core/Block/Html/Page.php similarity index 99% rename from src/application/code/core/Wootook/Core/Block/Html/Page.php rename to application/code/core/Wootook/Core/Block/Html/Page.php index 12c7775..b2879f8 100644 --- a/src/application/code/core/Wootook/Core/Block/Html/Page.php +++ b/application/code/core/Wootook/Core/Block/Html/Page.php @@ -16,4 +16,4 @@ class Wootook_Core_Block_Html_Page return $this; } -} +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Block/Template.php b/application/code/core/Wootook/Core/Block/Template.php new file mode 100644 index 0000000..673440f --- /dev/null +++ b/application/code/core/Wootook/Core/Block/Template.php @@ -0,0 +1,36 @@ +getScriptPath()}/%s/%s/scripts/{$file}"; + if (($layout = $this->getLayout()) !== null) { + $package = $this->getLayout()->getPackage(); + $theme = $this->getLayout()->getTheme(); + + if ($package !== Wootook_Core_Layout::DEFAULT_PACKAGE) { + if ($theme !== Wootook_Core_Layout::DEFAULT_THEME) { + $path = sprintf($pattern, $package, $theme); + if (Wootook::fileExists($path)) { + return $path; + } + } + + $path = sprintf($pattern, $package, Wootook_Core_Layout::DEFAULT_THEME); + if (Wootook::fileExists($path)) { + return $path; + } + } + } + + $path = sprintf($pattern, Wootook_Core_Layout::DEFAULT_PACKAGE, Wootook_Core_Layout::DEFAULT_THEME); + if (Wootook::fileExists($path)) { + return $path; + } + + trigger_error("Template '{$file}' could not be found.", E_USER_ERROR); + return null; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Block/Text.php b/application/code/core/Wootook/Core/Block/Text.php similarity index 91% rename from src/application/code/core/Wootook/Core/Block/Text.php rename to application/code/core/Wootook/Core/Block/Text.php index dabe336..129df11 100644 --- a/src/application/code/core/Wootook/Core/Block/Text.php +++ b/application/code/core/Wootook/Core/Block/Text.php @@ -1,7 +1,7 @@ setTableName($tableName); + } + if ($entityClassName != null) { + $this->setEntityClassName($entityClassName); + } + } + + protected function _init() + { + return $this; + } + + public function setTableName($tableName) + { + if (!is_array($tableName)) { + $this->_tableName = $tableName; + } else { + $this->_tableName = current($tableName); + $this->_tableAlias = key($tableName); + } + + return $this; + } + + public function getTableName() + { + return $this->_tableName; + } + + public function setEntityClassName($entityClassName) + { + $this->_entityClassName = $entityClassName; + + return $this; + } + + public function getEntityClassName() + { + return $this->_entityClassName; + } + + public function quote($data) + { + static $database = null; + + if ($database === null) { + $database = Wootook_Database::getSingleton(); + } + + return $database->quote($data); + } + + public function column($column = '*', $alias = null) + { + if (is_array($column)) { + foreach ($column as $alias => $field) { + if (is_int($alias)) { + $this->_columns[] = array($field); + } else { + $this->_columns[] = array($alias => $field); + } + } + } else if ($alias === null || is_int($alias)) { + $this->_columns[] = array($column); + } else { + $this->_columns[] = array($alias => $column); + } + + return $this; + } + + public function where($condition) + { + $this->_where[] = $condition; + + return $this; + } + + public function join($table, $condition, $fields = array('*'), $mode = 'INNER') + { + static $database = null; + + if ($database === null) { + $database = Wootook_Database::getSingleton(); + } + + if (is_array($table)) { + $alias = key($table); + $table = current($table); + + foreach ($fields as $fieldAlias => $fieldName) { + $this->column("{$alias}.{$field}", $fieldAlias); + } + + $this->_join[] = "{$mode} JOIN {$database->getTable($table)} AS {$alias} ON {$condition}"; + } else { + foreach ($fields as $field) { + $this->column("{$field}"); + } + + $this->_join[] = "{$mode} JOIN {$database->getTable($table)} ON {$condition}"; + } + + return $this; + } + + public function order($field, $direction = 'ASC') + { + $this->_order[] = "{$field} {$direction}"; + + return $this; + } + + public function union($collection) + { + $this->_union[] = $collection; + + return $this; + } + + public function limit($limit, $offset = null) + { + $this->_limit = intval($limit); + $this->_offset = $offset; + + return $this; + } + + public function group($groupField) + { + $this->_group[] = $groupField; + + return $this; + } + + protected function _prepareSql() + { + if (empty($this->_union)) { + $database = Wootook_Database::getSingleton(); + + $fields = array(); + foreach ($this->_columns as $field) { + $fieldName = current($field); + $fieldAlias = key($field); + if (is_string($fieldAlias)) { + $fields[] = "{$fieldName} AS {$fieldAlias}"; + } else { + $fields[] = $fieldName; + } + } + if (!empty($fields)) { + $fields = implode(", ", $fields); + } else { + $fields = '*'; + } + if (!empty($this->_where)) { + $where = 'WHERE (' . implode(") AND (", $this->_where) . ')'; + } else { + $where = ''; + } + $joinedTables = implode("\n ", $this->_join); + + $order = ''; + if (!empty($this->_order)) { + $order = 'ORDER BY ' . implode(", ", $this->_order); + } + $alias = ''; + if ($this->_tableAlias !== null) { + $alias = " AS {$this->_tableAlias}"; + } + $limit = ''; + if ($this->_limit) { + if ($this->_offset) { + $limit = "LIMIT {$this->_limit}, {$this->_offset}"; + } else { + $limit = "LIMIT {$this->_limit}"; + } + } + $group = ''; + if (!empty($this->_group)) { + $group = 'GROUP BY ' . implode(', ', $this->_group); + } + + return <<getTable($this->getTableName())}{$alias} + {$joinedTables} + {$where} + {$group} + {$order} + {$limit} +SQL_EOF; + } else { + $statements = array(); + foreach ($this->_union as $statement) { + $statements[] = $statement->_prepareSql(); + } + + $statements = '(' . implode(') UNION (', $statements) . ')'; + if (!empty($where)) { + $where = 'WHERE ' . implode(" AND ", $this->_where); + } else { + $where = ''; + } + $where = implode(" AND ", $this->_where); + + $limit = ''; + if ($this->_limit) { + if ($this->_offset) { + $limit = "LIMIT {$this->_limit}, {$this->_offset}"; + } else { + $limit = "LIMIT {$this->_limit}"; + } + } + + return <<_prepareSql(); + } + + protected function _load() + { + $sql = $this->_prepareSql(); + + $database = Wootook_Database::getSingleton(); + $statement = $database->prepare($sql); + + $args = func_get_args(); + $statement->execute(array_shift($args)); + + $this->_items = array(); + if (func_num_args() > 1) { + $reflection = new ReflectionClass(array_shift($args)); + } else { + $reflection = new ReflectionClass($this->getEntityClassName()); + } + + while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { + $params = array_merge(array($row), $args); + $this->_items[] = $reflection->newInstanceArgs($params); + } + + return $this; + } + + protected function _save() + { + foreach ($this->_items as $child) { + $child->save(); + } + + return $this; + } + + protected function _delete() + { + foreach ($this->_items as $child) { + $child->delete(); + } + + return $this; + } + + public function getSize() + { + $clone = clone $this; + $clone->_fields = array(); + $clone->column('1'); + + $sql = $clone->_prepareSql(); + + $database = Wootook_Database::getSingleton(); + $statement = $database->prepare($sql); + + $args = func_get_args(); + $statement->execute(array_shift($args)); + $count = $statement->rowCount(); + $statement->closeCursor(); + + return $count; + } + + public function count() + { + return count($this->_items); + } + + public function current() + { + return current($this->_items); + } + + public function next() + { + next($this->_items); + + return $this; + } + + public function rewind() + { + reset($this->_items); + + return $this; + } + + public function key() + { + return key($this->_items); + } + + public function valid() + { + return current($this->_items) !== false; + } + + public function getFirstItem() + { + if (!$this->_) + if (count($this->_items) > 0) { + return $this->_items[0]; + } + return null; + } + + public function getLastItem() + { + $size = count($this->_items); + if ($size > 0) { + return $this->_items[$size - 1]; + } + return null; + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Controller/Action.php b/application/code/core/Wootook/Core/Controller/Action.php new file mode 100644 index 0000000..58aa8ec --- /dev/null +++ b/application/code/core/Wootook/Core/Controller/Action.php @@ -0,0 +1,50 @@ +_request; + } + + public function getResponse() + { + return $this->_response; + } + + protected function _forward($action, $controller = null, $module = null) + { + $request = $this->getRequest(); + + $request->setAction($action); + if ($controller !== null) { + $request->setController($controller); + if ($module != null) { + $request->setModule($module); + } + } + $request->setIsDispatched(false); + } + + protected function _redirect($url) + { + $this->getResponse()->setRedirect($url); + + return $this; + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Controller/Request/Http.php b/application/code/core/Wootook/Core/Controller/Request/Http.php new file mode 100644 index 0000000..611294f --- /dev/null +++ b/application/code/core/Wootook/Core/Controller/Request/Http.php @@ -0,0 +1,102 @@ +setData($key, $value); + } + + public function getParam($key, $default = null) + { + if ($this->hasData($key)) { + return $this->getData($key); + } + if (isset($_POST[$key])) { + return $_POST[$key]; + } + if (isset($_GET[$key])) { + return $_GET[$key]; + } + if (isset($_FILES[$key])) { + return $_FILES[$key]; + } + if (isset($_COOKIE[$key])) { + return $_COOKIE[$key]; + } + if (isset($_SERVER[$key])) { + return $_SERVER[$key]; + } + return $default; + } + + public function getQuery($key, $default = null) + { + if (!isset($_GET[$key])) { + return $default; + } + return $_GET[$key]; + } + + public function getFile($key, $default = null) + { + if (!isset($_FILES[$key])) { + return $default; + } + return $_FILES[$key]; + } + + public function getCookie($key, $default = null) + { + if (!isset($_COOKIE[$key])) { + return $default; + } + return unserialize(stripslashes($_COOKIE[$key])); + } + + public function getRawCookie($key, $default = null) + { + if (!isset($_COOKIE[$key])) { + return $default; + } + return $_COOKIE[$key]; + } + + public function getPost($key, $default = null) + { + if (!isset($_POST[$key])) { + return $default; + } + return $_POST[$key]; + } + + public function getServer($key, $default = null) + { + if (!isset($_SERVER[$key])) { + return $default; + } + return $_SERVER[$key]; + } + + public function isPost() + { + if (strtoupper($this->getServer('REQUEST_METHOD')) == 'POST') { + return true; + } + return false; + } + + public function isGet() + { + if (strtoupper($this->getServer('REQUEST_METHOD')) == 'GET') { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Http.php b/application/code/core/Wootook/Core/Controller/Response/Http.php similarity index 73% rename from src/application/code/core/Wootook/Core/Mvc/Controller/Response/Http.php rename to application/code/core/Wootook/Core/Controller/Response/Http.php index 3025249..d463fa5 100644 --- a/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Http.php +++ b/application/code/core/Wootook/Core/Controller/Response/Http.php @@ -1,23 +1,24 @@ 'Moved Permanently', - self::REDIRECT_FOUND => 'Found', - self::REDIRECT_SEE_OTHER => 'See Other', - self::REDIRECT_TEMPORARY => 'Temporary Redirect' + REDIRECT_MOVED_PERMANENTLY => 'Moved Permanently', + REDIRECT_FOUND => 'Found', + REDIRECT_SEE_OTHER => 'See Other', + REDIRECT_TEMPORARY => 'Temporary Redirect' ); - protected $_returnCode = self::STATUS_OK; + public function __construct() + { + parent::__construct(array()); + } public function setBody($data) { @@ -45,9 +46,6 @@ class Wootook_Core_Mvc_Controller_Response_Http public function sendBody() { - if (!isset($this->_data['body']) || empty($this->_data['body'])) { - return ''; - } return implode('', $this->_data['body']); } @@ -83,7 +81,7 @@ class Wootook_Core_Mvc_Controller_Response_Http return $this; } - public function setRawHeader($value) + public function setRawHeader($name, $value) { if (!isset($this->_data['raw_headers']) || !is_array($this->_data['raw_headers'])) { $this->clearRawHeaders(); @@ -110,9 +108,22 @@ class Wootook_Core_Mvc_Controller_Response_Http return $this; } - public function isRedirect() + public function setIsRedirect($value = null) { - return $this->_returnCode >= 300 && $this->_returnCode < 400; + if (is_bool($value)) { + $this->_data['is_redirect'] = $value; + } + return $this->_data['is_redirect']; + } + + public function setIsDispatched($dispatched = true) + { + return $this->setData('id_dispatched', $dispatched); + } + + public function getIsDispatched() + { + return $this->getData('id_dispatched'); } public function setCookie($name, $value, $lifetime = null, $path = null, $domain = null) @@ -127,10 +138,7 @@ class Wootook_Core_Mvc_Controller_Response_Http public function setRawCookie($name, $value, $lifetime = null, $path = null, $domain = null) { - $date = new Wootook_Core_DateTime(); - $date->add($lifetime); - - setcookie($name, $value, $date->getTimestamp(), $path, $domain); + setcookie($name, $value, time() + $lifetime, $path, $domain); return $this; } @@ -140,22 +148,11 @@ class Wootook_Core_Mvc_Controller_Response_Http $code = self::REDIRECT_FOUND; } - $this->_returnCode = $code; - $statusText = self::$_redirectCodes[$code]; $this->setRawHeader("HTTP/1.1 {$code} {$statusText}") - ->setHeader('Location', $url); + ->setHeader('Location', $url) + ->setIsRedirect(true); return $this; } - - public function render($send = true) - { - if ($send) { - $this->sendHeaders(); - echo $this->sendBody(); - } else { - return $this->sendBody(); - } - } -} +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Email.php b/application/code/core/Wootook/Core/Email.php new file mode 100644 index 0000000..0dfcba4 --- /dev/null +++ b/application/code/core/Wootook/Core/Email.php @@ -0,0 +1,32 @@ +_prepareHeaders($headers); + } + + public function setHeader($name, $value) + { + $this->_headers[$name] = $value; + } + + protected function _prepareHeaders($headers) + { + foreach ($headers as $name => $value) { + $this->setHeader($name, $value); + } + + $this->addHeader('X-Mailer', 'PHP/' . PHP_VERSION . ' Wootook/' . VERSION); + $this->addHeader('Content-Transfer-Encoding', '7bit'); + $this->addHeader('Content-Type', 'text/plain; charset=utf-8'); + + return $this; + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Entity.php b/application/code/core/Wootook/Core/Entity.php new file mode 100644 index 0000000..9c736ee --- /dev/null +++ b/application/code/core/Wootook/Core/Entity.php @@ -0,0 +1,153 @@ +_idFieldName = $fieldName; + + return $this; + } + + public function getIdFieldName() + { + return $this->_idFieldName; + } + + public function setTableName($tableName) + { + $this->_tableName = $tableName; + + return $this; + } + + public function getTableName() + { + return $this->_tableName; + } + + public function setId($id) + { + $this->setData($this->getIdFieldName(), $id); + + return $this; + } + + public function getId() + { + return $this->getData($this->getIdFieldName()); + } + + protected function _load() + { + $id = func_get_arg(0); + + $idFieldName = self::getIdFieldName(); + $database = Wootook_Database::getSingleton(); + + $sql =<<getTable(self::getTableName())} + WHERE {$idFieldName}=:id + LIMIT 1 +SQL_EOF; + $statement = $database->prepare($sql); + $statement->execute(array( + 'id' => $id + )); + + $datas = $statement->fetch(PDO::FETCH_ASSOC); + if (!is_array($datas) || empty($datas)) { + throw new Wootook_Core_Exception_DataAccessException('Could not load data: this id could not be found.'); + } + unset($datas[self::getIdFieldName()]); + + $this->_data = $datas; + $this->setId($id); + + return $this; + } + + protected function _save() + { + if ($this->getId() !== null) { + $fields = array(); + $values = array(); + foreach ($this->getAllDatas() as $field => $value) { + if ($field == self::getIdFieldName()) { + continue; + } + $fields[] = "{$field}=:{$field}"; + $values[$field] = $value; + } + + $fieldsImploded = implode(', ', $fields); + $idFieldName = self::getIdFieldName(); + $values[$idFieldName] = $this->getId(); + + $database = Wootook_Database::getSingleton(); + $sql =<<getTable(self::getTableName())} + SET {$fieldsImploded} + WHERE {$idFieldName}=:{$idFieldName} +SQL_EOF; + $statement = $database->prepare($sql); + + $statement->execute($values); + } else { + $datas = $this->getAllDatas(); + $fieldsImploded = implode(', ', array_keys($datas)); + + $tokens = array(); + $values = array(); + foreach ($datas as $field => $value) { + if ($field == self::getIdFieldName()) { + continue; + } + $tokens[] = ":{$field}"; + $values[$field] = $value; + } + $tokensImploded = implode(', ', $tokens); + + $database = Wootook_Database::getSingleton(); + $sql =<<getTable(self::getTableName())} ($fieldsImploded) + VALUES ({$tokensImploded}) +SQL_EOF; + $statement = $database->prepare($sql); + + $statement->execute($values); + + $this->setId($database->lastInsertId()); + } + + return $this; + } + + protected function _delete() + { + $fields = array(); + foreach ($this->getAllDatas() as $field => $value) { + if ($field == self::getIdFieldName()) { + continue; + } + $fields[] = "{$field}=:{$field}"; + } + + $fieldsImploded = implod(', ', $fields); + $idFieldName = self::getIdFieldName(); + $database = Wootook_Database::getSingleton(); + $sql =<<getTable(self::getTableName())} + WHERE {$idFieldName}=:{$idFieldName} +SQL_EOF; + + $statement->execute($this->getAllDatas()); + + return $this; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Mvc/Model/Entity/SubTable.php b/application/code/core/Wootook/Core/Entity/SubTable.php similarity index 75% rename from src/application/code/core/Wootook/Core/Mvc/Model/Entity/SubTable.php rename to application/code/core/Wootook/Core/Entity/SubTable.php index 791d481..470b89c 100644 --- a/src/application/code/core/Wootook/Core/Mvc/Model/Entity/SubTable.php +++ b/application/code/core/Wootook/Core/Entity/SubTable.php @@ -4,12 +4,13 @@ * * @uses Wootook_Object * @uses Legacies_Empire - * @uses Wootook_Player_Model_Entity + * @uses Wootook_Empire_Model_User */ -abstract class Wootook_Core_Mvc_Model_Entity_SubTable - extends Wootook_Core_Database_Resource +abstract class Wootook_Core_Entity_SubTable + extends Wootook_Core_Model { private $_isLoaded = false; + protected $_tableName = null; protected $_idFieldNames = array(); protected $_eventPrefix = 'entity.sub-table'; @@ -31,7 +32,7 @@ abstract class Wootook_Core_Mvc_Model_Entity_SubTable $idFields = '(' . implode(') AND (', $idFields) . ')'; $fields = implode(', ', $fields); - $database = $this->getWriteConnection(); + $database = Wootook_Database::getSingleton(); $sql =<<getTable(self::getTableName())} SET {$fields} @@ -50,7 +51,7 @@ SQL_EOF; } $tokens = implode(', ', $tokens); - $database = $this->getWriteConnection(); + $database = Wootook_Database::getSingleton(); $sql =<<getTable(self::getTableName())} ($fields) VALUES ({$tokens}) @@ -65,18 +66,20 @@ SQL_EOF; protected function _load() { $idValues = func_get_arg(0); - $database = $this->getReadConnection(); - - $select = $database->select() - ->from(array('main_table' => $database->getTable($this->getTableName()))) - ->limit(1); + $database = Wootook_Database::getSingleton(); $idFields = array(); foreach ($this->_idFieldNames as $field) { - $select->where("{$database->quoteIdentifier($field)}=:{$field}"); + $idFields[] = "{$field}=:{$field}"; } + $idFields = '(' . implode(') AND (', $idFields) . ')'; - $statement = $database->prepare($select); + $sql =<<getTable(self::getTableName())} + WHERE $idFields + LIMIT 1 +SQL_EOF; + $statement = $database->prepare($sql); $statement->execute($idValues); $datas = $statement->fetch(PDO::FETCH_ASSOC); @@ -84,9 +87,7 @@ SQL_EOF; throw new Wootook_Core_Exception_DataAccessException('Could not load data: this id combination could not be found.'); } - $this->_data = array(); - $this->getDataMapper()->decode($this, $datas); - + $this->_data = $datas; $this->_isLoaded = true; return $this; @@ -94,7 +95,7 @@ SQL_EOF; protected function _delete() { - $database = $this->getWriteConnection(); + $database = Wootook_Database::getSingleton(); $idFields = array(); $idValues = array(); @@ -117,4 +118,16 @@ SQL_EOF; return $this; } -} + + public function setTableName($tableName) + { + $this->_tableName = $tableName; + + return $this; + } + + public function getTableName() + { + return $this->_tableName; + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/EntityInterface.php b/application/code/core/Wootook/Core/EntityInterface.php new file mode 100644 index 0000000..9843e61 --- /dev/null +++ b/application/code/core/Wootook/Core/EntityInterface.php @@ -0,0 +1,13 @@ +_errors[] = array( + 'time' => explode(' ', microtime()), + 'code' => $errno, + 'message' => $errstr, + 'file' => $errfile, + 'line' => $errline, + 'context' => $errcontext + ); + break; + + case E_USER_WARNING: + case E_WARNING: + $this->_warnings[] = array( + 'time' => explode(' ', microtime()), + 'code' => $errno, + 'message' => $errstr, + 'file' => $errfile, + 'line' => $errline, + 'context' => $errcontext + ); + break; + + case E_USER_NOTICE: + case E_NOTICE: + $this->_notices[] = array( + 'time' => explode(' ', microtime()), + 'code' => $errno, + 'message' => $errstr, + 'file' => $errfile, + 'line' => $errline, + 'context' => $errcontext + ); + break; + + default: + if (!isset($this->_otherErrors[$errno])) { + $this->_otherErrors[$errno] = array(); + } + + $this->_otherErrors[$errno][] = array( + 'time' => explode(' ', microtime()), + 'code' => $errno, + 'message' => $errstr, + 'file' => $errfile, + 'line' => $errline, + 'context' => $errcontext + ); + break; + } + + return true; + } + + public function exceptionManager($exception) + { + if (!self::$_listen) { + return; + } + $this->_exceptions[] = $exception; + } + + protected function _renderError($id, $error) + { + $types = array( + 0x0001 => 'E_ERROR', + 0x0002 => 'E_WARNING', + 0x0004 => 'E_PARSE', + 0x0008 => 'E_NOTICE', + 0x0010 => 'E_CORE_ERROR', + 0x0020 => 'E_CORE_WARNING', + 0x0040 => 'E_COMPILE_ERROR', + 0x0080 => 'E_COMPILE_WARNING', + 0x0100 => 'E_USER_ERROR', + 0x0200 => 'E_USER_WARNING', + 0x0400 => 'E_USER_NOTICE', + 0x0800 => 'E_STRICT', + 0x1000 => 'E_RECOVERABLE_ERROR', + 0x2000 => 'E_DEPRECATED', + 0x4000 => 'E_USER_DEPRECATED', + ); + + if (isset($error['code']) && isset($types[$error['code']])) { + $code = $types[$error['code']]; + } else { + $code = "Unknown ({$error['code']})"; + } + + $date = date('Y-m-d H:i:s', (int) $error['time'][1]); + $microsec = (int) ($error['time'][0] * 1000000); + + return <<'; + echo '

Debug profiler

'; + if (count($this->_errors) <= 0 && count($this->_warnings) <= 0 && + count($this->_notices) <= 0 && count($this->_otherErrors) <= 0 && + count($this->_exceptions) <= 0) { + echo '

Profiler was empty.

'; + } else { + echo '
';
+            foreach ($this->_errors as $error) {
+                echo $this->_renderError(++$index, $error);
+            }
+            foreach ($this->_warnings as $error) {
+                echo $this->_renderError(++$index, $error);
+            }
+            foreach ($this->_notices as $error) {
+                echo $this->_renderError(++$index, $error);
+            }
+            foreach ($this->_otherErrors as $errorList) {
+                foreach ($errorList as $error) {
+                    echo $this->_renderError(++$index, $error);
+                }
+            }
+            foreach ($this->_exceptions as $exception) {
+                $index++;
+                echo "Message #{$index}". PHP_EOL;
+                echo $exception->getMessage() . PHP_EOL;
+                echo $exception->getTraceAsString();
+            }
+            echo '
'; + } + echo ''; + } + + public static function register() + { + set_error_handler(array(self::getSingleton(), 'errorManager')); + set_exception_handler(array(self::getSingleton(), 'exceptionManager')); + + if (self::$_isTraceRegistered === false && defined('DEBUG')) { + self::$_isTraceRegistered = true; + register_shutdown_function(array(self::getSingleton(), 'shutdownManager')); + } + } + + public static function unregister($force = false) + { + restore_error_handler(); + restore_exception_handler(); + + if ((self::$_isTraceRegistered && defined('DEBUG')) || $force) { + self::$_isTraceRegistered = false; + register_shutdown_function(array(self::getSingleton(), 'shutdownManager')); + } + } + + public static function sleep() + { + self::$_listen = false; + } + + public static function wakeup() + { + self::$_listen = true; + } +} diff --git a/application/code/core/Wootook/Core/Event.php b/application/code/core/Wootook/Core/Event.php new file mode 100644 index 0000000..42d5c92 --- /dev/null +++ b/application/code/core/Wootook/Core/Event.php @@ -0,0 +1,6 @@ + array( + 'Wootook_Core_Block_' => 'Wootook/core/Block' + ) + ); + + public function _init() + { + $modules = Wootook_Core_Model_Config_Modules::getSingleton(); + + foreach ($modules['block'] as $module => $moduleNamespaces) { + foreach ($moduleNamespaces as $namespace => $path) { + $this->registerBlockNamespace($module, $namespace, $path); + } + } + + $config = include ROOT_PATH . 'config.php'; + $fileList = array(); + if (isset($config['global'])) { + if (isset($config['global']['layout'])) { + $fileList = $config['global']['layout']; + } + if (isset($config['global']['package'])) { + $this->setPackage($config['global']['package']); + } + if (isset($config['global']['theme'])) { + $this->setTheme($config['global']['theme']); + } + } + + foreach ($fileList as $layoutFile) { + foreach (include $this->_getLayoutPath($layoutFile) as $layoutId => $layoutConfig) { + if ($this->hasData($layoutId)) { + $declared = $this->getData($layoutId); + + $layoutConfig = array_merge($declared, $layoutConfig); + } + + $this->setData($layoutId, $layoutConfig); + } + } + + return $this; + } + + protected function _load() + { + $layoutId = func_get_arg(0); + + if (!$this->hasData($layoutId)) { + return $this; + } + + $layoutConfigs = array($this->getData($layoutId)); + if (isset($layoutConfigs[0]['update'])) { + $parent = $layoutConfigs[0]['update']; + + $i = 0; + while (true) { + $layoutConfigs[++$i] = $this->getData($parent); + + if (!isset($layoutConfigs[$i]['update'])) { + break; + } + $parent = $layoutConfigs[$i]['update']; + } + } + + $layoutUpdates = array(); + $layoutConfig = array(); + foreach (array_reverse($layoutConfigs) as $config) { + $layoutConfig = array_merge($layoutConfig, $config); + + if (isset($layoutConfig['reference'])) { + foreach ($layoutConfig['reference'] as $name => $update) { + if (!isset($layoutUpdates[$name])) { + $layoutUpdates[$name] = array(); + } + $layoutUpdates[$name][] = $update; + } + unset($layoutConfig['reference']); + } + } + unset($layoutConfigs, $layoutConfig['update']); + + if (isset($layoutConfig['type'])) { + $type = $layoutConfig['type']; + $name = isset($layoutConfig['name']) ? $layoutConfig['name'] : 'root'; + + $this->_view = $this->_createBlock($type, $name, $layoutConfig); + } else if (!isset($this->_view)) { + return $this; + } + + foreach ($layoutUpdates as $block => $updates) { + if (!isset($this->_blocks[$block])) { + continue; + } + + $parent = $this->_blocks[$block]; + foreach ($updates as $update) { + if (isset($update['children'])) { + foreach ($update['children'] as $childName => $childConfig) { + $type = $childConfig['type']; + $alias = isset($childConfig['alias']) ? $childConfig['alias'] : $childName; + + $parent->$alias = $this->_createBlock($type, $childName, $childConfig); + } + } + } + } + + foreach ($layoutUpdates as $block => $updates) { + if (!isset($this->_blocks[$block])) { + continue; + } + + foreach ($updates as $update) { + if (isset($update['actions'])) { + $this->_callActions($this->_blocks[$block], $update['actions']); + } + } + } + + foreach ($this->_blocks as $block) { + $block->prepareLayout(); + } + } + + protected function _save() + { + } + + protected function _delete() + { + } + + protected function _resolveBlockClassType($type) + { + $offset = strpos($type, '/'); + if ($offset === false) { + return null; + } + + $module = substr($type, 0, $offset); + $block = substr($type, $offset + 1); + + /* + $module = str_replace(' ', '', ucwords(str_replace('-', ' ', $module))); + $module = str_replace(' ', '_', ucwords(str_replace('.', ' ', $module))); + */ + $block = str_replace(' ', '', ucwords(str_replace('-', ' ', $block))); + $block = str_replace(' ', '_', ucwords(str_replace('.', ' ', $block))); + + if (isset($this->_namespaces[$module])) { + foreach ($this->_namespaces[$module] as $namespace => $path) { + $className = $namespace . $block; + $fileName = $path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $block) . '.php'; + + Wootook_Core_ErrorProfiler::sleep(); + if (!($fp = @fopen($fileName, 'r', true))) { + Wootook_Core_ErrorProfiler::wakeup(); + continue; + } + Wootook_Core_ErrorProfiler::wakeup(); + fclose($fp); + + if (!class_exists($className, true)) { + continue; + } + + return $className; + } + } + + trigger_error(Wootook::__('Class type "%s" could not be resolved.', $type), E_USER_INFO); + return null; + } + + public function registerBlockNamespace($module, $namespace, $path = null) + { + if ($path === null) { + $path = str_replace('_', DIRECTORY_SEPARATOR, $namespace); + } + if (!isset($this->_namespaces[$module])) { + $this->_namespaces[$module] = array(); + } + $this->_namespaces[$module][$namespace] = $path; + + return $this; + } + + public function unregisterBlockNamespace($module, $namespace) + { + if (isset($this->_namespaces[$module]) && isset($this->_namespaces[$module][$namespace])) { + unset($this->_namespaces[$module][$namespace]); + } + + return $this; + } + + public function createBlock($type, $name, $config = array()) + { + $instance = $this->_createBlock($type, $name, $config); + + $instance->prepareLayout(); + + return $instance; + } + + protected function _createBlock($type, $name, $config = array()) + { + $className = $this->_resolveBlockClassType($type); + + if ($className === null) { + return null; + } + + $children = array(); + if (isset($config['children'])) { + $children = $config['children']; + unset($config['children']); + } + $actions = array(); + if (isset($config['actions'])) { + $actions = $config['actions']; + unset($config['actions']); + } + + try { + $reflectionClass = new ReflectionClass($className); + + $instance = $reflectionClass->newInstance($config); + $this->_blocks[$name] = $instance; + $instance->setNameInLayout($name); + + $instance->setLayout($this); + + foreach ($children as $name => $config) { + if (isset($config['alias'])) { + $alias = $config['alias']; + } else { + $alias = $name; + } + + if (!isset($config['type'])) { + $instance->$alias = new Wootook_Core_View($config); + } else { + $instance->$alias = $this->_createBlock($config['type'], $name, $config); + } + } + } catch (ReflectionException $e) { + trigger_error($e->getMessage(), E_USER_INFO); + return null; + } + + $this->_callActions($instance, $actions); + + return $instance; + } + + protected function _callActions($block, $actions) + { + $reflectionClass = new ReflectionClass($block); + + foreach ($actions as $action) { + if (!isset($action['method'])) { + continue; + } + $method = $action['method']; + + $params = array(); + if (isset($action['params'])) { + $params = $action['params']; + } + + try { + $reflectionMethod = $reflectionClass->getMethod($method); + $requiredParameterCount = $reflectionMethod->getNumberOfRequiredParameters(); + $callParamaters = array(); + foreach ($reflectionMethod->getParameters() as $parameter) { + $paramterName = $parameter->getName(); + $paramterPosition = $parameter->getPosition(); + + if (isset($params[$paramterName])) { + $callParamaters[$paramterPosition] = $params[$paramterName]; + } else if ($parameter->isDefaultValueAvailable()) { + $callParamaters[$paramterPosition] = $parameter->getDefaultValue(); + //} else if (!$parameter->isOptionnal()) { + } else if ($paramterPosition <= $requiredParameterCount) { + throw new Wootook_Core_Exception_RuntimeException(); + } + } + + $reflectionMethod->invokeArgs($block, $callParamaters); + } catch (ReflectionException $e) { + trigger_error($e->getMessage(), E_USER_INFO); + continue; + } catch (RuntimeException $e) { + trigger_error($e->getMessage(), E_USER_WARNING); + continue; + } + } + } + + public function getPackage() + { + return $this->_package; + } + + public function setPackage($package) + { + $this->_package = $package; + + return $this; + } + + public function getTheme() + { + return $this->_theme; + } + + public function setTheme($theme) + { + $this->_theme = $theme; + + return $this; + } + + public function getScriptPath() + { + return APPLICATION_PATH . DIRECTORY_SEPARATOR . 'design'; + } + + public function getBlock($code) + { + if (isset($this->_blocks[$code])) { + return $this->_blocks[$code]; + } + return null; + } + + public function render() + { + $scriptPath = $this->getScriptPath(); + foreach ($this->_blocks as $block) { + if ($block instanceof Wootook_Core_Block_Template) { + $block->setScriptPath($scriptPath); + } + $block->beforeToHtml(); + } + unset($block); + + return $this->_view->render(); + } + + protected function _getLayoutPath($file) + { + $package = $this->getPackage(); + $theme = $this->getTheme(); + $pattern = "{$this->getScriptPath()}/%s/%s/layouts/{$file}"; + + $path = sprintf($pattern, $package, $theme); + if (Wootook::fileExists($path)) { + return $path; + } + + $path = sprintf($pattern, $package, self::DEFAULT_THEME); + if (Wootook::fileExists($path)) { + return $path; + } + + $path = sprintf($pattern, self::DEFAULT_PACKAGE, self::DEFAULT_THEME); + if (Wootook::fileExists($path)) { + return $path; + } + + trigger_error(Legacies::__("Layout file '%s' does not exist.", $file), E_USER_INFO); + + return null; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Mvc/Model/Model.php b/application/code/core/Wootook/Core/Model.php similarity index 71% rename from src/application/code/core/Wootook/Core/Mvc/Model/Model.php rename to application/code/core/Wootook/Core/Model.php index e91265f..087f511 100644 --- a/src/application/code/core/Wootook/Core/Mvc/Model/Model.php +++ b/application/code/core/Wootook/Core/Model.php @@ -1,40 +1,6 @@ - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ -/** - * - * Enter description here ... - * @author Greg - * - */ -abstract class Wootook_Core_Mvc_Model_Model +abstract class Wootook_Core_Model extends Wootook_Object { protected $_originalData = array(); @@ -47,27 +13,14 @@ abstract class Wootook_Core_Mvc_Model_Model $this->_data = $data; $this->_init(); - $this->_setOriginalData(); + $this->_setOriginalData($this->_data); } abstract protected function _init(); - protected function _setOriginalData() + protected function _setOriginalData(Array $data) { - $this->_originalData = $this->_data; - } - - public function getChangedDatas() - { - return array_diff_assoc($this->_data, $this->_originalData); - } - - public function hasChangedDatas() - { - if (count($this->getChangedDatas()) > 0) { - return true; - } - return false; + $this->_originalData = $data; } final public function save() @@ -117,7 +70,7 @@ abstract class Wootook_Core_Mvc_Model_Model call_user_func_array(array($this, '_afterLoad'), $params); $this->_setOriginalData($this->_data); } catch (PDOException $e) { - throw new Wootook_Core_Exception_DataAccessException('Could not load data: ' . $e->getMessage(), 0, $e); + throw new Wootook_Core_Exception_DataAccessException('Could not load data: ' . $e->getMessage(), 0); } return $this; } @@ -202,4 +155,4 @@ abstract class Wootook_Core_Mvc_Model_Model { return $this->hasData($key); } -} +} \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Model/Config.php b/application/code/core/Wootook/Core/Model/Config.php new file mode 100644 index 0000000..26dda47 --- /dev/null +++ b/application/code/core/Wootook/Core/Model/Config.php @@ -0,0 +1,88 @@ +load(); + } + + protected function _load() + { + $database = Wootook_Database::getSingleton(); + + $sql =<<getTable('config')} AS config +SQL_EOF; + + $attributeName = null; + $attributeValue = null; + + $statement = $database->prepare($sql); + $statement->execute(); + + $statement->bindColumn('attribute', $attributeName, PDO::PARAM_STR); + $statement->bindColumn('value', $attributeValue, PDO::PARAM_STR); + + while ($statement->fetch(PDO::FETCH_BOUND)) { + $this->setData($attributeName, $attributeValue); + } + return $this; + } + + protected function _save() + { + $database = Wootook_Database::getSingleton(); + $fields = array(); + + $sql =<<prepare($sql); + + foreach ($this->getAllDatas() as $attributeName => $attributeValue) { + $statement->execute(array( + 'name' => $attributeName, + 'value' => $attributeValue + )); + } + + return $this; + } + + protected function _delete() + { + // NOP + return $this; + } + + public function isEnabled() + { + return (bool) $this->getData('game_disable'); + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Helper/Config/ConfigHandler.php b/application/code/core/Wootook/Core/Model/Config/Abstract.php similarity index 56% rename from src/application/code/core/Wootook/Core/Helper/Config/ConfigHandler.php rename to application/code/core/Wootook/Core/Model/Config/Abstract.php index 7421bad..05227d1 100644 --- a/src/application/code/core/Wootook/Core/Helper/Config/ConfigHandler.php +++ b/application/code/core/Wootook/Core/Model/Config/Abstract.php @@ -1,24 +1,17 @@ 'default', - 'episode' => 'default' - ); - } else { - $config = $config->toArray(); - } - - $path = 'gamedata' . DIRECTORY_SEPARATOR . $config['universe'] . DIRECTORY_SEPARATOR - . $config['episode'] . DIRECTORY_SEPARATOR . $filename . '.php'; + $path = 'gamedata' . DIRECTORY_SEPARATOR . $universe . DIRECTORY_SEPARATOR + . $episode . DIRECTORY_SEPARATOR . $filename . '.php'; foreach (include APPLICATION_PATH . $path as $elementId => $fieldName) { $this->setData($elementId, $fieldName); @@ -56,4 +49,4 @@ abstract class Wootook_Core_Helper_Config_ConfigHandler { reset($this->_data); } -} +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Helper/Config/Events.php b/application/code/core/Wootook/Core/Model/Config/Events.php similarity index 91% rename from src/application/code/core/Wootook/Core/Helper/Config/Events.php rename to application/code/core/Wootook/Core/Model/Config/Events.php index 30b0528..1ab794b 100644 --- a/src/application/code/core/Wootook/Core/Helper/Config/Events.php +++ b/application/code/core/Wootook/Core/Model/Config/Events.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Core_Helper_Config_Events - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Core_Model_Config_Events + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/src/application/code/core/Wootook/Core/Helper/Config/Modules.php b/application/code/core/Wootook/Core/Model/Config/Modules.php similarity index 88% rename from src/application/code/core/Wootook/Core/Helper/Config/Modules.php rename to application/code/core/Wootook/Core/Model/Config/Modules.php index 17d1a46..8ad43f6 100644 --- a/src/application/code/core/Wootook/Core/Helper/Config/Modules.php +++ b/application/code/core/Wootook/Core/Model/Config/Modules.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Core_Helper_Config_Modules - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Core_Model_Config_Modules + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/application/code/core/Wootook/Core/Model/Session.php b/application/code/core/Wootook/Core/Model/Session.php new file mode 100644 index 0000000..5199542 --- /dev/null +++ b/application/code/core/Wootook/Core/Model/Session.php @@ -0,0 +1,145 @@ +getConstants()); + } + + self::$_instances[$namespace] = new self($namespace); + } + return self::$_instances[$namespace]; + } + + public static function destroy() + { + session_destroy(); + } + + public function __construct($namespace) + { + if (session_id() == '') { + session_start(); + } + + if (!isset($_SESSION[$namespace])) { + $_SESSION[$namespace] = array(); + } + + $this->_data = &$_SESSION[$namespace]; + $this->_data['messages'] = array(); + } + + public function getMessages($clear = true) + { + $messages = $this->_data['messages']; + if ($clear == true) { + $this->_data['messages'] = array(); + } + return $messages; + } + + public function addMessage($message, $type = self::DEBUG) + { + if (!isset(self::$_levels[$type])) { + $type = self::DEBUG; + } + + if (!isset($this->_data['messages'])) { + $this->_data['messages'] = array(); + } + if (!isset($this->_data['messages'][self::$_levels[$type]])) { + $this->_data['messages'][self::$_levels[$type]] = array(); + } + $this->_data['messages'][self::$_levels[$type]][] = $message; + + return $this; + } + + public function addCritical($message, $_ = null) + { + $args = func_get_args(); + array_shift($args); + + return $this->addMessage(vsprintf($message, $args), self::CRIT); + } + + public function addError($message, $_ = null) + { + $args = func_get_args(); + array_shift($args); + + return $this->addMessage(vsprintf($message, $args), self::ERROR); + } + + public function addWarning($message, $_ = null) + { + $args = func_get_args(); + array_shift($args); + + return $this->addMessage(vsprintf($message, $args), self::WARN); + } + + public function addSuccess($message, $_ = null) + { + $args = func_get_args(); + array_shift($args); + + return $this->addMessage(vsprintf($message, $args), self::SUCCESS); + } + + public function addInfo($message, $_ = null) + { + $args = func_get_args(); + array_shift($args); + + return $this->addMessage(vsprintf($message, $args), self::INFO); + } + + public function addDebug($message, $_ = null) + { + $args = func_get_args(); + array_shift($args); + + return $this->addMessage(vsprintf($message, $args), self::DEBUG); + } + + public function getFormKey($reset = false) + { + if (!$this->getData('form_key')) { + $this->setData('form_key', uniqid()); + return $this->getData('form_key'); + } + + $key = $this->getData('form_key'); + if ($reset == true) { + $this->setData('form_key', uniqid()); + } + + return $key; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Model/Translator.php b/application/code/core/Wootook/Core/Model/Translator.php similarity index 100% rename from src/application/code/core/Wootook/Core/Model/Translator.php rename to application/code/core/Wootook/Core/Model/Translator.php diff --git a/src/application/code/core/Wootook/Core/PluginLoader/PluginLoader.php b/application/code/core/Wootook/Core/Plugin/LoaderAbstract.php similarity index 64% rename from src/application/code/core/Wootook/Core/PluginLoader/PluginLoader.php rename to application/code/core/Wootook/Core/Plugin/LoaderAbstract.php index eaaff7a..211f572 100644 --- a/src/application/code/core/Wootook/Core/PluginLoader/PluginLoader.php +++ b/application/code/core/Wootook/Core/Plugin/LoaderAbstract.php @@ -1,25 +1,21 @@ _pluginInstances[$pluginName])) { return $this->_pluginInstances[$pluginName]; } - $pluginName = str_replace(' ', '_', ucwords(str_replace('.', ' ', $pluginName))); - $pluginName = str_replace(' ', '', ucwords(str_replace('-', ' ', $pluginName))); - foreach ($this->_namespaces as $namespace => $path) { - $className = $namespace . $pluginName; - $fileName = $path . DIRECTORY_SEPARATOR . - str_replace('_', DIRECTORY_SEPARATOR, $pluginName) . '.php'; + $className = $namespace . ucfirst($pluginName); + $fileName = $path . DIRECTORY_SEPARATOR . ucfirst($pluginName) . '.php'; - if (!Wootook::fileExists($fileName)) { + if (!file_exists($fileName)) { continue; } @@ -27,10 +23,10 @@ abstract class Wootook_Core_PluginLoader_PluginLoader continue; } - return $this->_load($className, $useSingleton, $constructorParams); + return $this->_load($className, $useSingleton); } - return null; + return $this; } public function registerNamespace($namespace, $path = null) @@ -52,7 +48,7 @@ abstract class Wootook_Core_PluginLoader_PluginLoader return $this; } - abstract protected function _load($className, $useSingleton, Array $constructorParams = array()); + abstract protected function _load($className); public function getPlugin($pluginName) { diff --git a/src/application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php b/application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php similarity index 89% rename from src/application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php rename to application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php index e0ce1d5..ff6e309 100644 --- a/src/application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php +++ b/application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php @@ -1,6 +1,6 @@ install|upgrade|uninstall|downgrade)-(?[0-9]+\.[0-9]+\.[0-9]+)(?:\.(?[a-z]+)(?[0-9]+))?(?:-(?[0-9]+\.[0-9]+\.[0-9]+)(?:\.(?[a-z]+)(?[0-9]+))?)?$%'; @@ -36,35 +36,27 @@ class Wootook_Core_Setup_Updater_ScriptQueue } if ($fromVersion === null) { - $fromVersion = array( - 'version' => self::VERSION_NULL, - 'stage' => self::STAGE_STABLE, - 'level' => 0, - ); - } else { - preg_match(self::PCRE_VERSION_PATTERN, $fromVersion, $matches); - $fromVersion = array( - 'version' => isset($matches['version']) ? $matches['version'] : self::VERSION_NULL, - 'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE, - 'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0, - ); + $fromVersion = '0.0.0'; } if ($toVersion === null) { - $toVersion = array( - 'version' => self::VERSION_NULL, - 'stage' => self::STAGE_STABLE, - 'level' => 0, - ); - } else { - preg_match(self::PCRE_VERSION_PATTERN, $toVersion, $matches); - $toVersion = array( - 'version' => isset($matches['version']) ? $matches['version'] : self::VERSION_NULL, - 'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE, - 'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0, - ); + $toVersion = '0.0.0'; } + preg_match(self::PCRE_VERSION_PATTERN, $fromVersion, $matches); + $fromVersion = array( + 'version' => isset($matches['version']) ? $matches['version'] : self::VERSION_NULL, + 'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE, + 'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0, + ); + + preg_match(self::PCRE_VERSION_PATTERN, $toVersion, $matches); + $toVersion = array( + 'version' => isset($matches['version']) ? $matches['version'] : self::VERSION_NULL, + 'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE, + 'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0, + ); + switch (version_compare($toVersion['version'], $fromVersion['version'])) { case 1: $this->_upgradeToVersion($fromVersion, $toVersion); @@ -118,7 +110,7 @@ class Wootook_Core_Setup_Updater_ScriptQueue $this->_upgradeToVersion($fromVersion, $toVersion); } } else { - throw new Wootook_Core_Setup_Exception_VersionStageError("Invalid version stage."); + throw new Wootook_Core_Exception_RuntimeException("Invalid version stage."); } break; } @@ -131,13 +123,6 @@ class Wootook_Core_Setup_Updater_ScriptQueue return $this->_finalVersion; } - public function getCurrentVersion() - { - $current = $this->current(); - - return $current['version']; - } - protected function _installHighestInstaller($currentVersion, $toVersion) { $highestVersion = self::VERSION_NULL; @@ -158,16 +143,14 @@ class Wootook_Core_Setup_Updater_ScriptQueue return $version; } - if (isset($this->_installVersions[$highestVersion][self::STAGE_STABLE])) { - $stage = self::STAGE_STABLE; - } else if (isset($this->_installVersions[$highestVersion][self::STAGE_RC])) { + if (isset($this->_installVersions[$highestVersion][self::STAGE_RC])) { $stage = self::STAGE_RC; } else if (isset($this->_installVersions[$highestVersion][self::STAGE_BETA])) { $stage = self::STAGE_BETA; } else if (isset($this->_installVersions[$highestVersion][self::STAGE_ALPHA])) { $stage = self::STAGE_ALPHA; } else { - throw new Wootook_Core_Setup_Exception_VersionStageError("Invalid version stage."); + throw new Wootook_Core_Exception_RuntimeException("Invalid version stage."); } $levelList = array_keys($this->_installVersions[$highestVersion][$stage]); @@ -249,7 +232,7 @@ class Wootook_Core_Setup_Updater_ScriptQueue $level = max(array_keys($versionPointer[$highestVersion][$stage])); } else { - throw new Wootook_Core_Setup_Exception_VersionValueError("Invalid version value."); + throw new Wootook_Core_Exception_RuntimeException("Invalid version value."); } $currentVersion = array( diff --git a/application/code/core/Wootook/Core/Singleton.php b/application/code/core/Wootook/Core/Singleton.php new file mode 100644 index 0000000..be1d3dc --- /dev/null +++ b/application/code/core/Wootook/Core/Singleton.php @@ -0,0 +1,6 @@ + - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ -/** - * - * Enter description here ... - * @author Greg - * - */ -class Wootook_Core_Mvc_View_View +class Wootook_Core_View extends Wootook_Object { protected $_template = null; @@ -90,27 +56,11 @@ class Wootook_Core_Mvc_View_View } } - public function renderDateTime($dateTime, $format = null) - { - if ($format === null) { - $format = 'H:i:s'; - } - if (!$dateTime instanceof Wootook_Core_DateTime) { - $dateTime = new Wootook_Core_DateTime($dateTime); - } - return $dateTime->toString($format); - } - - public function escape($unescaped) + protected function escape($unescaped) { return htmlspecialchars($unescaped, ENT_QUOTES, 'UTF-8'); } - public function escapeJs($unescaped) - { - return addslashes($unescaped); - } - public function __($message, $_ = null) { $args = func_get_args(); @@ -143,14 +93,6 @@ class Wootook_Core_Mvc_View_View return ''; } - public function renderPartial($blockName) - { - if (($block = $this->getPartial($blockName)) !== null) { - return $block->render(); - } - return null; - } - protected function _getTemplatePath($file) { return $this->getScriptPath() . DIRECTORY_SEPARATOR . $file; @@ -182,58 +124,25 @@ class Wootook_Core_Mvc_View_View return Wootook::getUrl($uri, $params); } - public function getStaticUrl($uri, Array $params = array()) + public function getSkinUrl($uri, Array $params = array()) { - return Wootook::getStaticUrl($uri, $params); - } - - public function getSkinUrl($uri, Array $params = array(), $theme = null, $package = null) - { - if (Wootook::$isInstalled) { - $player = Wootook_Player_Model_Session::getSingleton()->getPlayer(); - if ($player !== null && $player->getId()) { - $theme = $player->getSkinPath(); - } + $package = $this->getLayout()->getPackage(); + if (empty($package)) { + $package = Wootook_Core_Layout::DEFAULT_PACKAGE; } - if ($theme === null || empty($theme)) { + + $user = Wootook_Empire_Model_User::getSingleton(); + if ($user !== null && $user->getId()) { + $theme = $user->getSkinPath(); + } + if (empty($theme)) { $theme = $this->getLayout()->getTheme(); } - if ($theme === null || empty($theme)) { - $theme = Wootook_Core_Model_Layout::DEFAULT_THEME; + if (empty($theme)) { + $theme = Wootook_Core_Layout::DEFAULT_THEME; } - if ($package === null || empty($package)) { - $package = $this->getLayout()->getPackage(); - } - if ($package === null || empty($package)) { - $package = Wootook_Core_Model_Layout::DEFAULT_PACKAGE; - } - $domain = $this->getLayout()->getDomain(); - - $baseUrl = Wootook::getBaseUrl('skin'); - $basePath = Wootook::getBasePath('skin'); - $pathPattern = $basePath . "{$domain}/%s/%s/{$uri}"; - $urlPattern = $baseUrl . "{$domain}/%s/%s/{$uri}"; - - if (count($params) > 0) { - $serializedParams = array(); - foreach ($params as $paramKey => $paramValue) { - if ($paramValue) { - $serializedParams[] = "{$paramKey}={$paramValue}"; - } - } - - $urlPattern .= '?' . implode('&', $serializedParams); - } - - if (Wootook::fileExists(sprintf($pathPattern, $package, $theme))) { - return sprintf($urlPattern, $package, $theme); - } - if (Wootook::fileExists(sprintf($pathPattern, $package, Wootook_Core_Model_Layout::DEFAULT_THEME))) { - return sprintf($urlPattern, $package, Wootook_Core_Model_Layout::DEFAULT_THEME); - } - - return sprintf($urlPattern, Wootook_Core_Model_Layout::DEFAULT_PACKAGE, Wootook_Core_Model_Layout::DEFAULT_THEME); + return Wootook::getSkinUrl($package, $theme, $uri, $params); } public function setPartial($name, $content) @@ -249,9 +158,6 @@ class Wootook_Core_Mvc_View_View public function getPartial($name) { - if (!$this->hasPartial($name)) { - return null; - } return $this->_partials[$name]; } @@ -305,7 +211,7 @@ class Wootook_Core_Mvc_View_View /** * - * @return Wootook_Core_Model_Layout + * @return Wootook_Core_Layout */ public function getLayout() { @@ -343,4 +249,4 @@ class Wootook_Core_Mvc_View_View { return $this->_scriptPath; } -} +} \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php b/application/code/core/Wootook/Core/install/mysql5/install-2011.1.0.php similarity index 63% rename from src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php rename to application/code/core/Wootook/Core/install/mysql5/install-2011.1.0.php index ba30531..51a956e 100644 --- a/src/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php +++ b/application/code/core/Wootook/Core/install/mysql5/install-2011.1.0.php @@ -2,36 +2,48 @@ /** * This file is part of Wootook * - * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @license Modified BSD + * @see https://github.com/gplanchat/one.platform * - * Copyright (c) 2011-Present, Grégory PLANCHAT + * Copyright (c) 2009-2010, Grégory PLANCHAT * All rights reserved. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: * - * 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. + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * - Neither the name of Grégory PLANCHAT nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * --> 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 One.Platform. * */ -$this->setSetupConnection('core_setup'); +$this->setSetupConnection('legacies_setup'); $sql = <<getTableName('aks')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/aks')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) NULL, `teilnehmer` TEXT NULL, @@ -47,8 +59,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/aks', 'legacies_read', array('SELECT')) + ->grant('legacies/aks', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/aks', 'legacies_setup') +; + $sql = <<getTableName('alliance')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/alliance')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `ally_name` VARCHAR(32) NOT NULL, `ally_tag` VARCHAR(8) NOT NULL, @@ -70,8 +88,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/alliance', 'legacies_read', array('SELECT')) + ->grant('legacies/alliance', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/alliance', 'legacies_setup') +; + $sql = <<getTableName('annonce')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/annonce')} ( `id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `user` TEXT NOT NULL, `galaxie` TINYINT UNSIGNED NOT NULL, @@ -88,8 +112,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/annonce', 'legacies_read', array('SELECT')) + ->grant('legacies/annonce', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/annonce', 'legacies_setup') +; + $sql = <<getTableName('banned')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/banned')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `who` BIGINT UNSIGNED NOT NULL, `theme` TEXT NOT NULL, @@ -104,8 +134,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/banned', 'legacies_read', array('SELECT')) + ->grant('legacies/banned', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/banned', 'legacies_setup') +; + $sql = <<getTableName('buddy')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/buddy')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `sender` BIGINT UNSIGNED NOT NULL, `owner` BIGINT UNSIGNED NOT NULL, @@ -117,8 +153,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/buddy', 'legacies_read', array('SELECT')) + ->grant('legacies/buddy', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/buddy', 'legacies_setup') +; + $sql = <<getTableName('chat')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/chat')} ( `messageid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `user` VARCHAR(255) NOT NULL, `message` TEXT NOT NULL, @@ -129,8 +171,83 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/chat', 'legacies_read', array('SELECT')) + ->grant('legacies/chat', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/chat', 'legacies_setup') +; + $sql = <<getTableName('declared')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/config')} ( + `config_name` VARCHAR(64) NOT NULL, + `config_value` TEXT NOT NULL, + UNIQUE KEY (`config_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SQL_EOF; + +$this->query($sql); + +$this + ->grant('legacies/config', 'legacies_read', array('SELECT')) + ->grant('legacies/config', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/config', 'legacies_setup') +; + +$sql = <<getTableName('legacies/config')} (`config_name`, `config_value`) VALUES + ('game_speed', '2500'), + ('fleet_speed', '2500'), + ('resource_multiplier', '1000'), + ('Fleet_Cdr', '30'), + ('Defs_Cdr', '30'), + ('initial_fields', '5000'), + ('COOKIE_NAME', 'xnova-legacies'), + ('game_name', 'Wootook:Legacies'), + ('game_disable', '1'), + ('close_reason', 'Le jeu est clos pour le moment!'), + ('metal_basic_income', '20'), + ('crystal_basic_income', '10'), + ('deuterium_basic_income', '0'), + ('energy_basic_income', '0'), + ('BuildLabWhileRun', '0'), + ('LastSettedGalaxyPos', '1'), + ('LastSettedSystemPos', '1'), + ('LastSettedPlanetPos', '1'), + ('urlaubs_modus_erz', '1'), + ('noobprotection', '1'), + ('noobprotectiontime', '5000'), + ('noobprotectionmulti', '5'), + ('forum_url', 'http://board.xnova-ng.org/'), + ('OverviewNewsFrame', '1'), + ('OverviewNewsTEXT', 'Bienvenue sur le nouveau serveur Wootook Legacies'), + ('OverviewExternChat', '0'), + ('OverviewExternChatCmd', ''), + ('OverviewBanner', '0'), + ('OverviewClickBanner', ''), + ('ExtCopyFrame', '0'), + ('ExtCopyOwner', ''), + ('ExtCopyFunct', ''), + ('ForumBannerFrame', '0'), + ('stat_settings', '1000'), + ('link_enable', '0'), + ('link_name', ''), + ('link_url', ''), + ('enable_announces', '1'), + ('enable_marchand', '1'), + ('enable_notes', '1'), + ('bot_name', 'XNoviana Reali'), + ('bot_adress', 'xnova@xnova.fr'), + ('banner_source_post', '../images/bann.png'), + ('ban_duration', '30'), + ('enable_bot', '0'), + ('enable_bbcode', '1'), + ('debug', '0'); +SQL_EOF; + +$this->query($sql); + +$sql = <<getTableName('legacies/declared')} ( `declarator` TEXT NOT NULL, `declared_1` TEXT NOT NULL, `declared_2` TEXT NOT NULL, @@ -142,8 +259,33 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/declared', 'legacies_read', array('SELECT')) + ->grant('legacies/declared', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/declared', 'legacies_setup') +; + $sql = <<getTableName('fleets')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/errors')} ( + `error_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + `error_sender` VARCHAR(32) NOT NULL, + `error_time` TIMESTAMP NOT NULL, + `error_type` VARCHAR(32) NOT NULL DEFAULT 'unknown', + `error_text` TEXT, + PRIMARY KEY (`error_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SQL_EOF; + +$this->query($sql); + +$this + ->grant('legacies/errors', 'legacies_read', array('SELECT')) + ->grant('legacies/errors', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/errors', 'legacies_setup') +; + +$sql = <<getTableName('legacies/fleets')} ( `fleet_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `fleet_owner` BIGINT UNSIGNED NOT NULL, `fleet_mission` TINYINT UNSIGNED NOT NULL, @@ -160,22 +302,29 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('fleets')} ( `fleet_end_system` SMALLINT UNSIGNED NOT NULL, `fleet_end_planet` TINYINT UNSIGNED NOT NULL, `fleet_end_type` TINYINT UNSIGNED NOT NULL, - `fleet_target_owner` BIGINT UNSIGNED NOT NULL, + `fleet_taget_owner` BIGINT UNSIGNED NOT NULL, `fleet_resource_metal` DECIMAL(65,0) NOT NULL DEFAULT 0, `fleet_resource_crystal` DECIMAL(65,0) NOT NULL DEFAULT 0, `fleet_resource_deuterium` DECIMAL(65,0) NOT NULL DEFAULT 0, + `fleet_target_owner` BIGINT UNSIGNED NOT NULL, `fleet_group` BIGINT UNSIGNED NOT NULL, `fleet_mess` BIGINT UNSIGNED NOT NULL, - `start_time` TIMESTAMP NOT NULL, + `start_time` INT, PRIMARY KEY (`fleet_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; SQL_EOF; $this->query($sql); +$this + ->grant('legacies/fleets', 'legacies_read', array('SELECT')) + ->grant('legacies/fleets', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/fleets', 'legacies_setup') +; + $sql = <<getTableName('galaxy')} ( - `galaxy` SMALLINT UNSIGNED NOT NULL, +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/galaxy')} ( + `galaxy` TINYINT UNSIGNED NOT NULL, `system` SMALLINT UNSIGNED NOT NULL, `planet` TINYINT UNSIGNED NOT NULL, `id_planet` BIGINT UNSIGNED NOT NULL, @@ -192,8 +341,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/galaxy', 'legacies_read', array('SELECT')) + ->grant('legacies/galaxy', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/galaxy', 'legacies_setup') +; + $sql = <<getTableName('iraks')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/iraks')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `zeit` TIMESTAMP NOT NULL, `galaxy` TINYINT UNSIGNED NOT NULL, @@ -212,8 +367,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/iraks', 'legacies_read', array('SELECT')) + ->grant('legacies/iraks', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/iraks', 'legacies_setup') +; + $sql = <<getTableName('lunas')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/lunas')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `id_luna` BIGINT UNSIGNED NOT NULL, `name` VARCHAR(100) NOT NULL DEFAULT 'Lune', @@ -232,8 +393,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/lunas', 'legacies_read', array('SELECT')) + ->grant('legacies/lunas', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/lunas', 'legacies_setup') +; + $sql = <<getTableName('messages')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/messages')} ( `message_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `message_owner` BIGINT UNSIGNED NOT NULL, `message_sender` BIGINT UNSIGNED NOT NULL, @@ -248,8 +415,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/messages', 'legacies_read', array('SELECT')) + ->grant('legacies/messages', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/messages', 'legacies_setup') +; + $sql = <<getTableName('multi')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/multi')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `player` BIGINT UNSIGNED NOT NULL, `sharer` BIGINT UNSIGNED NOT NULL, @@ -260,8 +433,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/multi', 'legacies_read', array('SELECT')) + ->grant('legacies/multi', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/multi', 'legacies_setup') +; + $sql = <<getTableName('notes')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/notes')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `owner` BIGINT UNSIGNED NOT NULL, `time` TIMESTAMP NOT NULL, @@ -274,8 +453,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/notes', 'legacies_read', array('SELECT')) + ->grant('legacies/notes', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/notes', 'legacies_setup') +; + $sql = <<getTableName('planets')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/planets')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(100) NOT NULL, `id_owner` BIGINT UNSIGNED NOT NULL, @@ -283,36 +468,37 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('planets')} ( `galaxy` TINYINT UNSIGNED NOT NULL, `system` SMALLINT UNSIGNED NOT NULL, `planet` TINYINT UNSIGNED NOT NULL, - `last_update` DATETIME NOT NULL, + `last_update` TIMESTAMP NOT NULL, `planet_type` TINYINT UNSIGNED NOT NULL, - `destruyed` INT UNSIGNED NOT NULL DEFAULT FALSE, - `b_building` DATETIME NOT NULL, + `destruyed` BOOL NOT NULL DEFAULT FALSE, + `b_building` SMALLINT UNSIGNED NOT NULL, `b_building_id` TEXT NOT NULL, - `b_tech` DATETIME NOT NULL, - `b_tech_id` TEXT NOT NULL, - `b_hangar` DATETIME NOT NULL, + `b_tech` SMALLINT UNSIGNED NOT NULL, + `b_tech_id` SMALLINT UNSIGNED NOT NULL, + `b_hangar` SMALLINT UNSIGNED NOT NULL, `b_hangar_id` TEXT NOT NULL, + `b_hangar_plus` SMALLINT UNSIGNED NOT NULL, `image` VARCHAR(50) NOT NULL DEFAULT 'normaltempplanet01', `diameter` INT UNSIGNED NOT NULL DEFAULT 12800, `points` DECIMAL(65,0) NOT NULL DEFAULT 0, `ranks` BIGINT UNSIGNED NOT NULL, - `field_current` SMALLINT UNSIGNED NOT NULL DEFAULT 0, - `field_max` SMALLINT UNSIGNED NOT NULL DEFAULT 163, - `temp_min` SMALLINT NOT NULL DEFAULT 0, - `temp_max` SMALLINT NOT NULL DEFAULT 0, + `field_current` INT UNSIGNED NOT NULL DEFAULT 163, + `field_max` INT UNSIGNED NOT NULL DEFAULT 163, + `temp_min` INT NOT NULL DEFAULT 0, + `temp_max` INT NOT NULL DEFAULT 0, `metal` DECIMAL(65,0) NOT NULL DEFAULT 0, `metal_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0, `metal_max` DECIMAL(65,0) NOT NULL DEFAULT 0, - `cristal` DECIMAL(65,0) NOT NULL DEFAULT 0, - `cristal_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0, - `cristal_max` DECIMAL(65,0) NOT NULL DEFAULT 0, + `crystal` DECIMAL(65,0) NOT NULL DEFAULT 0, + `crystal_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0, + `crystal_max` DECIMAL(65,0) NOT NULL DEFAULT 0, `deuterium` DECIMAL(65,0) NOT NULL DEFAULT 0, `deuterium_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0, `deuterium_max` DECIMAL(65,0) NOT NULL DEFAULT 0, `energy_used` DECIMAL(65,0) NOT NULL DEFAULT 0, `energy_max` DECIMAL(65,0) NOT NULL DEFAULT 0, `metal_mine` SMALLINT UNSIGNED NOT NULL DEFAULT 0, - `cristal_mine` SMALLINT UNSIGNED NOT NULL DEFAULT 0, + `crystal_mine` SMALLINT UNSIGNED NOT NULL DEFAULT 0, `deuterium_sintetizer` SMALLINT UNSIGNED NOT NULL DEFAULT 0, `solar_plant` SMALLINT UNSIGNED NOT NULL DEFAULT 0, `fusion_plant` SMALLINT UNSIGNED NOT NULL DEFAULT 0, @@ -320,7 +506,7 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('planets')} ( `nano_factory` SMALLINT UNSIGNED NOT NULL DEFAULT 0, `hangar` SMALLINT UNSIGNED NOT NULL DEFAULT 0, `metal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0, - `cristal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0, + `crystal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0, `deuterium_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0, `laboratory` SMALLINT UNSIGNED NOT NULL DEFAULT 0, `terraformer` SMALLINT UNSIGNED NOT NULL DEFAULT 0, @@ -343,20 +529,18 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('planets')} ( `destructor` DECIMAL(65,0) NOT NULL DEFAULT 0, `dearth_star` DECIMAL(65,0) NOT NULL DEFAULT 0, `battleship` DECIMAL(65,0) NOT NULL DEFAULT 0, - `supernova` DECIMAL(65,0) NOT NULL DEFAULT 0, - `ore_miner` DECIMAL(65,0) NOT NULL DEFAULT 0, `misil_launcher` DECIMAL(65,0) NOT NULL DEFAULT 0, `small_laser` DECIMAL(65,0) NOT NULL DEFAULT 0, `big_laser` DECIMAL(65,0) NOT NULL DEFAULT 0, `gauss_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0, `ionic_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0, `buster_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0, - `small_protection_shield` ENUM('0','1') NOT NULL DEFAULT '0', - `big_protection_shield` ENUM('0','1') NOT NULL DEFAULT '0', + `small_protection_shield` ENUM('0','1') NOT NULL DEFAULT 0, + `big_protection_shield` ENUM('0','1') NOT NULL DEFAULT 0, `interceptor_misil` SMALLINT NOT NULL DEFAULT 0, `interplanetary_misil` SMALLINT NOT NULL DEFAULT 0, `metal_mine_porcent` TINYINT NOT NULL DEFAULT 10, - `cristal_mine_porcent` TINYINT NOT NULL DEFAULT 10, + `crystal_mine_porcent` TINYINT NOT NULL DEFAULT 10, `deuterium_sintetizer_porcent` TINYINT NOT NULL DEFAULT 10, `solar_plant_porcent` TINYINT NOT NULL DEFAULT 10, `fusion_plant_porcent` TINYINT NOT NULL DEFAULT 10, @@ -368,8 +552,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/planets', 'legacies_read', array('SELECT')) + ->grant('legacies/planets', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/planets', 'legacies_setup') +; + $sql = <<getTableName('rw')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/rw')} ( `id_owner1` BIGINT UNSIGNED NOT NULL, `id_owner2` BIGINT UNSIGNED NOT NULL, `rid` VARCHAR(72) NOT NULL, @@ -384,8 +574,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/rw', 'legacies_read', array('SELECT')) + ->grant('legacies/rw', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/rw', 'legacies_setup') +; + $sql = <<getTableName('statpoints')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/statpoints')} ( `id_owner` BIGINT UNSIGNED NOT NULL, `id_ally` BIGINT UNSIGNED NOT NULL, `stat_type` TINYINT UNSIGNED NOT NULL, @@ -421,8 +617,14 @@ SQL_EOF; $this->query($sql); +$this + ->grant('legacies/statpoints', 'legacies_read', array('SELECT')) + ->grant('legacies/statpoints', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/statpoints', 'legacies_setup') +; + $sql = <<getTableName('users')} ( +CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/users')} ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `username` VARCHAR(100) NOT NULL, -- FIXME `password` VARCHAR(64) NOT NULL, -- FIXME @@ -480,7 +682,6 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('users')} ( `intergalactic_tech` TINYINT UNSIGNED NOT NULL, -- FIXME `expedition_tech` TINYINT UNSIGNED NOT NULL, -- FIXME `graviton_tech` TINYINT UNSIGNED NOT NULL, -- FIXME - `ore_mining_tech` TINYINT UNSIGNED NOT NULL, -- FIXME `ally_id` BIGINT UNSIGNED NOT NULL, `ally_name` VARCHAR(32) NULL, -- FIXME `ally_request` BOOL NOT NULL DEFAULT FALSE, -- FIXME @@ -488,9 +689,25 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('users')} ( `ally_register_time` TIMESTAMP NOT NULL, -- FIXME `ally_rank_id` BIGINT UNSIGNED NOT NULL, -- FIXME `current_luna` INT NOT NULL, -- FIXME - `kolorminus` VARCHAR(11) NOT NULL DEFAULT 'red', - `kolorplus` VARCHAR(11) NOT NULL DEFAULT '#00FF00', - `kolorpoziom` VARCHAR(11) NOT NULL DEFAULT 'yellow', + `kolorminus` VARCHAR(11) NOT NULL DEFAULT 'red', + `kolorplus` VARCHAR(11) NOT NULL DEFAULT '#00FF00', + `kolorpoziom` VARCHAR(11) NOT NULL DEFAULT 'yellow', + `rpg_geologue` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_amiral` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_ingenieur` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_technocrate` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_espion` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_constructeur` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_scientifique` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_commandant` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_points` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_stockeur` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_defenseur` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_destructeur` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_general` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_bunker` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_raideur` TINYINT UNSIGNED NOT NULL, -- FIXME + `rpg_empereur` TINYINT UNSIGNED NOT NULL, -- FIXME `lvl_minier` BIGINT UNSIGNED NOT NULL, -- FIXME `lvl_raid` BIGINT UNSIGNED NOT NULL, -- FIXME `xpraid` BIGINT UNSIGNED NOT NULL, -- FIXME @@ -519,320 +736,57 @@ SQL_EOF; $this->query($sql); -/* - * Galaxy positions generation - */ -$galaxyCount = Wootook::getConfig('engine/universe/galaxies'); -$systemCount = Wootook::getConfig('engine/universe/systems'); +$this + ->grant('legacies/users', 'legacies_read', array('SELECT')) + ->grant('legacies/users', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE')) + ->grant('legacies/users', 'legacies_setup') +; $sql = <<getTableName('galaxy')} - (`galaxy`, `system`, `planet`, `id_planet`, `metal`, `crystal`, `id_luna`, `luna`) - SELECT - _increment.galaxy AS `galaxy`, - _increment.system AS `system`, - 0 AS `planet`, - 0 AS `id_planet`, - 0 AS `metal`, - 0 AS `crystal`, - 0 AS `id_luna`, - 0 AS `luna` - FROM ( - SELECT - (1 + _galaxy_10e0.galaxy + _galaxy_10e1.galaxy + _galaxy_10e2.galaxy + _galaxy_10e3.galaxy + _galaxy_10e4.galaxy) AS galaxy, - (1 + _system_10e0.system + _system_10e1.system + _system_10e2.system + _system_10e3.system + _system_10e4.system) AS system - FROM ( - SELECT 0 AS system - UNION ALL - SELECT 1 AS system - UNION ALL - SELECT 2 AS system - UNION ALL - SELECT 3 AS system - UNION ALL - SELECT 4 AS system - UNION ALL - SELECT 5 AS system - UNION ALL - SELECT 6 AS system - UNION ALL - SELECT 7 AS system - UNION ALL - SELECT 8 AS system - UNION ALL - SELECT 9 AS system - ) AS _system_10e0 -SQL_EOF; - -if ($systemCount > 10) { - $sql .= << 100) { -$sql .= << 1000) { - $sql .= << 10000) { - $sql .= << 10) { - $sql .= << 100) { - $sql .= << 1000) { - $sql .= << 10000) { -$sql .= <<getTableName('legacies/alliance')} ( + `id`, `ally_name`, `ally_tag`, `ally_owner`, `ally_register_time`, `ally_description`, + `ally_web`, `ally_text`, `ally_image`, `ally_request`, `ally_request_waiting`, + `ally_request_notallow`, `ally_owner_range`, `ally_ranks`, `ally_members` + ) + VALUES + ('1', 'Admin', 'Admin', 1, NOW(), 'Administrator alliance', 'http://www.xnova-ng.org/', + '', '', '', '', '', '', '', '') +SQL_EOF; + +$this->query($sql); + +$sql = <<getTableName('legacies/users')} ( + `id`, `username`, `password`, `email`, `email_2`, `lang`, `authlevel`, `sex`, + `avatar`, `sign`, `id_planet`, `galaxy`, `system`, `planet`, `current_planet`, + `user_lastip`, `ip_at_reg`, `user_agent`, `current_page`, `register_time`, + `onlinetime`, `dpath`, `design`, `noipcheck`, `planet_sort`, `planet_sort_order`, + `spio_anz`, `settings_tooltiptime`, `settings_fleetactions`, `settings_allylogo`, + `settings_esp`, `settings_wri`, `settings_bud`, `settings_mis`, `settings_rep`, + `urlaubs_modus`, `urlaubs_until`, `db_deaktjava`, `new_message`, `fleet_shortcut`, + `b_tech_planet`, `spy_tech`, `computer_tech`, `military_tech`, `defence_tech`, + `shield_tech`, `energy_tech`, `hyperspace_tech`, `combustion_tech`, + `impulse_motor_tech`, `hyperspace_motor_tech`, `laser_tech`, `ionic_tech`, + `buster_tech`, `intergalactic_tech`, `expedition_tech`, `graviton_tech`, + `ally_id`, `ally_name`, `ally_request`, `ally_request_text`, `ally_register_time`, + `ally_rank_id`, `current_luna`, `kolorminus`, `kolorplus`, `kolorpoziom`, + `rpg_geologue`, `rpg_amiral`, `rpg_ingenieur`, `rpg_technocrate`, `rpg_espion`, + `rpg_constructeur`, `rpg_scientifique`, `rpg_commandant`, `rpg_points`, `rpg_stockeur`, + `rpg_defenseur`, `rpg_destructeur`, `rpg_general`, `rpg_bunker`, `rpg_raideur`, + `rpg_empereur`, `lvl_minier`, `lvl_raid`, `xpraid`, `xpminier`, `raids`, + `p_infligees`, `mnl_alliance`, `mnl_joueur`, `mnl_attaque`, `mnl_spy`, + `mnl_exploit`, `mnl_transport`, `mnl_expedition`, `mnl_general`, `mnl_buildlist`, + `bana`, `multi_validated`, `banaday`, `raids1`, `raidswin`, `raidsloose` + ) + VALUES + ('1', 'Admin', '', '', '', 'fr', '3', NULL, '', '', '1', '1', '1', '1', + '1', '127.0.0.1', '', '', '', '1254743313', '1269391977', '', '1', '1', '0', + '0', '1', '5', '0', '0', '1', '1', '1', '1', '0', '0', '0', '0', '0', '', '0', + '16', '20', '11', '11', '11', '12', '10', '14', '10', '9', '0', '0', '0', '0', + '0', '1', 1, 'Admin', '0', '', NOW(), '0', '0', 'red', '#00FF00', 'yellow', '20', + '20', '10', '10', '0', '3', '3', '0', '27', '2', '2', '0', '0', '0', '0', '0', + '98', '1', '0', '1133583738', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0') SQL_EOF; $this->query($sql); diff --git a/src/application/code/core/Legacies/Empire/install/mysql5/uninstall-1.5.0.php b/application/code/core/Wootook/Core/install/mysql5/uninstall-2011.1.0.php similarity index 70% rename from src/application/code/core/Legacies/Empire/install/mysql5/uninstall-1.5.0.php rename to application/code/core/Wootook/Core/install/mysql5/uninstall-2011.1.0.php index 040f676..74ec834 100644 --- a/src/application/code/core/Legacies/Empire/install/mysql5/uninstall-1.5.0.php +++ b/application/code/core/Wootook/Core/install/mysql5/uninstall-2011.1.0.php @@ -40,112 +40,124 @@ * */ -$this->setSetupConnection('core_setup'); +$this->setSetupConnection('legacies_setup'); $sql = <<getTableName('aks')}; +DROP TABLE {$this->getTableName('legacies/aks')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('alliance')}; +DROP TABLE {$this->getTableName('legacies/alliance')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('annonce')}; +DROP TABLE {$this->getTableName('legacies/annonce')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('banned')}; +DROP TABLE {$this->getTableName('legacies/banned')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('buddy')}; +DROP TABLE {$this->getTableName('legacies/buddy')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('chat')}; +DROP TABLE {$this->getTableName('legacies/chat')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('declared')}; +DROP TABLE {$this->getTableName('legacies/config')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('fleets')}; +DROP TABLE {$this->getTableName('legacies/declared')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('galaxy')}; +DROP TABLE {$this->getTableName('legacies/errors')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('iraks')}; +DROP TABLE {$this->getTableName('legacies/fleets')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('lunas')}; +DROP TABLE {$this->getTableName('legacies/galaxy')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('messages')}; +DROP TABLE {$this->getTableName('legacies/iraks')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('multi')}; +DROP TABLE {$this->getTableName('legacies/lunas')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('notes')}; +DROP TABLE {$this->getTableName('legacies/messages')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('planets')}; +DROP TABLE {$this->getTableName('legacies/multi')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('rw')}; +DROP TABLE {$this->getTableName('legacies/notes')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('statpoints')}; +DROP TABLE {$this->getTableName('legacies/planets')}; SQL_EOF; $this->query($sql); $sql = <<getTableName('users')}; +DROP TABLE {$this->getTableName('legacies/rw')}; +SQL_EOF; + +$this->query($sql); + +$sql = <<getTableName('legacies/statpoints')}; +SQL_EOF; + +$this->query($sql); + +$sql = <<getTableName('legacies/users')}; SQL_EOF; $this->query($sql); diff --git a/application/code/core/Wootook/Database.php b/application/code/core/Wootook/Database.php new file mode 100644 index 0000000..3ff35f0 --- /dev/null +++ b/application/code/core/Wootook/Database.php @@ -0,0 +1,51 @@ + PDO::ERRMODE_EXCEPTION + ); + + public static function getSingleton() + { + if (self::$_singleton === null) { + $config = include ROOT_PATH . 'config.php'; + $hostname = $config['global']['database']['options']['hostname']; + $username = $config['global']['database']['options']['username']; + $password = $config['global']['database']['options']['password']; + $database = $config['global']['database']['options']['database']; + $port = 3306; + + if (isset($config['global']['database']['options']['port'])) { + $port = $config['global']['database']['options']['port']; + } + + $event = Wootook::dispatchEvent('database.prepare-options', array( + 'options' => self::$options + )); + + self::$options = $event->getData('options'); + + self::$_singleton = new self("mysql:dbname={$database};host={$hostname};port={$port}", $username, $password, self::$options); + + Wootook::dispatchEvent('database.init', array( + 'handler' => self::$_singleton + )); + } + return self::$_singleton; + } + + public function getTable($name) + { + if (self::$_prefix === null) { + $config = include ROOT_PATH . 'config.php'; + self::$_prefix = $config['global']['database']['table_prefix']; + } + return self::$_prefix . $name; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Player/Block/Overview.php b/application/code/core/Wootook/Empire/Block/Overview.php similarity index 58% rename from src/application/code/core/Wootook/Player/Block/Overview.php rename to application/code/core/Wootook/Empire/Block/Overview.php index bf689f0..c09ec87 100644 --- a/src/application/code/core/Wootook/Player/Block/Overview.php +++ b/application/code/core/Wootook/Empire/Block/Overview.php @@ -1,6 +1,6 @@ _labels = Wootook_Empire_Helper_Config_Labels::getSingleton(); - } - - public function setPlayer(Wootook_Player_Model_Entity $player) - { - $this->_player = $player; + $this->_user = $user; return $this; } - public function getPlayer() + public function getUser() { - if ($this->_player === null) { - $this->_player = Wootook_Player_Model_Session::getSingleton()->getPlayer(); + if ($this->_user === null) { + $this->_user = Wootook_Empire_Model_User::getSingleton(); } - return $this->_player; + return $this->_user; } public function setPlanet(Wootook_Empire_Model_Planet $planet) @@ -40,7 +33,7 @@ abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract public function getPlanet() { if ($this->_planet === null) { - $this->_planet = $this->getPlayer()->getCurrentPlanet(); + $this->_planet = $this->getUser()->getCurrentPlanet(); } return $this->_planet; @@ -60,27 +53,41 @@ abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract public function getItemInfoUrl() { - return $this->getStaticUrl('infos.php', array('gid' => $this->getItemId())); - } - - public function getLabel($type) - { - return $this->_labels[$this->getItemId()][$type]; + return $this->getUrl('infos.php', array('gid' => $this->getItemId())); } public function getItemImageUrl() { - return $this->getStaticUrl($this->getLabel('image')); + // TODO : Upgrade theme + return $this->getSkinUrl('graphics/gebaeude/' . $this->getItemId() . '.gif'); } public function getName() { - return $this->getLabel('name'); + static $lang = null; + if ($lang === null) { + // FIXME: implement a cleaner way to get names + $lang = includeLang('tech'); + } + + if (isset($lang['tech']) && isset($lang['tech'][$this->getItemId()])) { + return $this->__($lang['tech'][$this->getItemId()]); + } + return ''; } public function getDescription() { - return $this->getLabel('description'); + static $lang = null; + if ($lang === null) { + // FIXME: implement a cleaner way to get names + $lang = includeLang('tech'); + } + + if (isset($lang['res']) && isset($lang['res']['descriptions']) && isset($lang['res']['descriptions'][$this->getItemId()])) { + return $this->__($lang['res']['descriptions'][$this->getItemId()]); + } + return ''; } public function getResourceName($resourceId) @@ -91,7 +98,7 @@ abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract $lang = includeLang('imperium'); } if ($resourceId == 'cristal') { - $resourceId = 'crystal'; // FIXME: backward compatibility + $resourceId = 'crystal'; } if (isset($lang[$resourceId])) { @@ -108,4 +115,4 @@ abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract abstract public function getResourcesNeeded($level); abstract public function getBuildingTime($level); -} +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/Queue/ItemAbstract.php b/application/code/core/Wootook/Empire/Block/Planet/Builder/Queue/ItemAbstract.php similarity index 100% rename from src/application/code/core/Wootook/Empire/Block/Planet/Builder/Queue/ItemAbstract.php rename to application/code/core/Wootook/Empire/Block/Planet/Builder/Queue/ItemAbstract.php diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php b/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php similarity index 82% rename from src/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php rename to application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php index baf9c71..d6122d3 100644 --- a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php +++ b/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php @@ -3,25 +3,25 @@ abstract class Wootook_Empire_Block_Planet_Builder_QueueAbstract extends Wootook_Core_Block_Template { - protected $_player = null; + protected $_user = null; protected $_planet = null; protected $_itemTemplate = null; protected $_itemBlock = null; - public function setPlayer(Wootook_Player_Model_Entity $player) + public function setUser(Wootook_Empire_Model_User $user) { - $this->_player = $player; + $this->_user = $user; return $this; } - public function getPlayer() + public function getUser() { - if ($this->_player === null) { - $this->_player = Wootook_Player_Model_Session::getSingleton()->getPlayer(); + if ($this->_user === null) { + $this->_user = Wootook_Empire_Model_User::getSingleton(); } - return $this->_player; + return $this->_user; } public function setPlanet(Wootook_Empire_Model_Planet $planet) @@ -34,7 +34,7 @@ abstract class Wootook_Empire_Block_Planet_Builder_QueueAbstract public function getPlanet() { if ($this->_planet === null) { - $this->_planet = $this->getPlayer()->getCurrentPlanet(); + $this->_planet = $this->getUser()->getCurrentPlanet(); } return $this->_planet; diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/BuilderAbstract.php b/application/code/core/Wootook/Empire/Block/Planet/BuilderAbstract.php similarity index 100% rename from src/application/code/core/Wootook/Empire/Block/Planet/BuilderAbstract.php rename to application/code/core/Wootook/Empire/Block/Planet/BuilderAbstract.php diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings.php b/application/code/core/Wootook/Empire/Block/Planet/Buildings.php similarity index 87% rename from src/application/code/core/Wootook/Empire/Block/Planet/Buildings.php rename to application/code/core/Wootook/Empire/Block/Planet/Buildings.php index 77d4a86..e777cdd 100644 --- a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings.php +++ b/application/code/core/Wootook/Empire/Block/Planet/Buildings.php @@ -15,7 +15,7 @@ class Wootook_Empire_Block_Planet_Buildings public function getPlanet() { if ($this->_planet === null) { - $this->_planet = Wootook_Player_Model_Session::getSingleton()->getPlayer() + $this->_planet = Wootook_Empire_Model_User::getSingleton() ->getCurrentPlanet() ; } @@ -24,7 +24,7 @@ class Wootook_Empire_Block_Planet_Buildings public function _initChildBlocks() { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); $type = Legacies_Empire::TYPE_BUILDING_PLANET; if ($this->getPlanet()->isMoon()) { $type = Legacies_Empire::TYPE_BUILDING_MOON; diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php b/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php similarity index 78% rename from src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php rename to application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php index 1c4a970..b24a819 100644 --- a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php +++ b/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php @@ -13,22 +13,6 @@ class Wootook_Empire_Block_Planet_Buildings_Item return $this->getPlanet()->getResourcesNeeded($this->getItemId(), $level); } - public function isBuildable($level = null) - { - if ($level === null) { - $level = $this->getNextLevel(); - } - $resources = $this->getResourcesNeeded($level); - - foreach ($resources as $resourceId => $resourceValue) { - $amount = $this->getPlanet()->getResourceAmount($resourceId); - if (Math::comp($amount, $resourceValue) < 0) { - return false; - } - } - return true; - } - public function getQueuedLevel() { return $this->getPlanet()->getBuildingLevelQueued($this->getItemId()); diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue.php b/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue.php similarity index 100% rename from src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue.php rename to application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue.php diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php b/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php similarity index 55% rename from src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php rename to application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php index 6941b62..e3721e3 100644 --- a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php +++ b/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php @@ -1,39 +1,5 @@ - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ -/** - * - * Enter description here ... - * @author Greg - * - */ class Wootook_Empire_Block_Planet_Buildings_Queue_Item extends Wootook_Empire_Block_Planet_Builder_Queue_ItemAbstract { @@ -64,14 +30,6 @@ class Wootook_Empire_Block_Planet_Buildings_Queue_Item return $this->getPlanet()->getBuildingTime($this->getItemId(), $level); } - public function getBuildingRemainingTime() - { - $totalTime = $this->getPlanet()->getBuildingTime($this->getItemId(), $this->getItemQueuedLevel()); - $item = $this->getItem(); - - return $item->getData('created_at') - $item->getData('updated_at') + $totalTime; - } - public function getResourcesConfigForLevel($level) { $resources = $this->getResourcesNeeded($level); diff --git a/src/application/code/core/Wootook/Empire/Block/PlanetList.php b/application/code/core/Wootook/Empire/Block/PlanetList.php similarity index 100% rename from src/application/code/core/Wootook/Empire/Block/PlanetList.php rename to application/code/core/Wootook/Empire/Block/PlanetList.php diff --git a/application/code/core/Wootook/Empire/Block/Topnav.php b/application/code/core/Wootook/Empire/Block/Topnav.php new file mode 100644 index 0000000..841df96 --- /dev/null +++ b/application/code/core/Wootook/Empire/Block/Topnav.php @@ -0,0 +1,32 @@ +getCurrentUser()->getCurrentPlanet(); + } + + /** + * + * @return Wootook_Core_Collection + */ + public function getPlanetCollection() + { + return $this->getCurrentUser()->getPlanetCollection(); + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Empire/Exception.php b/application/code/core/Wootook/Empire/Exception.php new file mode 100644 index 0000000..73de227 --- /dev/null +++ b/application/code/core/Wootook/Empire/Exception.php @@ -0,0 +1,3 @@ +_currentPlanet = $currentPlanet; - $this->_currentPlayer = $currentPlayer; + $this->_currentUser = $currentUser; $this->init(); } @@ -46,10 +46,6 @@ abstract class Wootook_Empire_Model_BuilderAbstract public function enqueue($params, $index = null) { - if ($this->_currentPlayer->isVacation()) { - return $this; - } - $item = $this->_initItem($params); if ($item === null) { return $this; @@ -98,10 +94,7 @@ abstract class Wootook_Empire_Model_BuilderAbstract { $this->clearQueue(); - $unserialized = false; - if (!empty($serialized)) { - $unserialized = @unserialize($serialized); - } + $unserialized = @unserialize($serialized); if ($unserialized === false) { $this->_queue = array(); return $this; @@ -129,8 +122,8 @@ abstract class Wootook_Empire_Model_BuilderAbstract $this->_queue = array(); } - abstract public function updateQueue(Wootook_Core_DateTime $time); - abstract public function appendQueue($typeId, $qty, Wootook_Core_DateTime $time); + abstract public function updateQueue($time); + abstract public function appendQueue($typeId, $qty, $time); /** * Check if an item type is actually buildable on the current @@ -141,8 +134,8 @@ abstract class Wootook_Empire_Model_BuilderAbstract */ public function checkAvailability($typeId) { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); - $requirements = Wootook_Empire_Helper_Config_Requirements::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); + $requirements = Wootook_Empire_Model_Game_Requirements::getSingleton(); if (!isset($requirements[$typeId]) || empty($requirements[$typeId])) { return true; @@ -151,7 +144,7 @@ abstract class Wootook_Empire_Model_BuilderAbstract foreach ($requirements[$typeId] as $requirement => $level) { if ($types->is($requirement, Legacies_Empire::TYPE_BUILDING) && $this->_currentPlanet->hasElement($requirement, $level)) { continue; - } else if ($types->is($requirement, Legacies_Empire::TYPE_RESEARCH) && $this->_currentPlayer->hasElement($requirement, $level)) { + } else if ($types->is($requirement, Legacies_Empire::TYPE_RESEARCH) && $this->_currentUser->hasElement($requirement, $level)) { continue; } else if ($types->is($requirement, Legacies_Empire::TYPE_DEFENSE) && $this->_currentPlanet->hasElement($requirement, $level)) { continue; @@ -212,9 +205,9 @@ abstract class Wootook_Empire_Model_BuilderAbstract return $this->_currentPlanet; } - public function getCurrentPlayer() + public function getCurrentUser() { - return $this->_currentPlayer; + return $this->_currentUser; } public function setCurrentPlanet(Wootook_Empire_Model_Planet $planet) @@ -224,9 +217,9 @@ abstract class Wootook_Empire_Model_BuilderAbstract return $this; } - public function setCurrentPlayer(Wootook_Player_Model_Entity $player) + public function setCurrentUser(Wootook_Empire_Model_User $user) { - $this->_currentPlayer = $player; + $this->_currentUser = $user; return $this; } @@ -251,4 +244,4 @@ abstract class Wootook_Empire_Model_BuilderAbstract } return $resourceAmounts; } -} +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Model/Fleet.php b/application/code/core/Wootook/Empire/Model/Fleet.php similarity index 56% rename from src/application/code/core/Wootook/Empire/Model/Fleet.php rename to application/code/core/Wootook/Empire/Model/Fleet.php index e622226..1ce2b7d 100644 --- a/src/application/code/core/Wootook/Empire/Model/Fleet.php +++ b/application/code/core/Wootook/Empire/Model/Fleet.php @@ -7,7 +7,7 @@ * @uses Legacies_Empire */ class Wootook_Empire_Model_Fleet - extends Wootook_Core_Mvc_Model_Entity + extends Wootook_Core_Entity { protected static $_instances = array(); @@ -34,36 +34,24 @@ class Wootook_Empire_Model_Fleet { $this->setIdFieldName('fleet_id'); $this->setTableName('fleets'); - - $this->getDataMapper() - ->addRule('fleet_start_time', 'date-time') - ->addRule('fleet_end_time', 'date-time') - ->addRule('fleet_end_stay', 'date-time') - ; } public static function planetListener($eventData) { } - public function isOwnedBy(Wootook_Player_Model_Entity $player) + public function isOwnedBy(Wootook_Empire_Model_User $user) { - if ($this->getData('fleet_owner') == $player->getId()) { + if ($this->getData('fleet_owner') == $user->getId()) { return true; } return false; } - /** - * @return null|Wootook_Player_Resource_Entity_Collection - */ - public function getOwnerCollection() + public function getOwner() { if ($id = $this->getData('fleet_owner')) { - $ownerCollection = new Wootook_Player_Resource_Entity_Collection($this->getReadConnection()); - $ownerCollection->addFieldToFilter('id', $id); - - return $ownerCollection; + return Wootook_Empire_Model_User::factory($id); } return null; } @@ -76,10 +64,10 @@ class Wootook_Empire_Model_Fleet return false; } - public function getRowClass(Wootook_Player_Model_Entity $player = null) + public function getRowClass(Wootook_Empire_Model_User $user = null) { if ($this->isMission(Legacies_Empire::ID_MISSION_ATTACK) || $this->isMission(Legacies_Empire::ID_MISSION_GROUP_ATTACK)) { - if ($player !== null && $this->isOwnedBy($player)) { + if ($user !== null && $this->isOwnedBy($user)) { return 'attack'; } else { return 'ownattack'; @@ -98,8 +86,6 @@ class Wootook_Empire_Model_Fleet return 'missiles'; } else if ($this->isMission(Legacies_Empire::ID_MISSION_EXPEDITION)) { return 'expedition'; - } else if ($this->isMission(Legacies_Empire::ID_MISSION_ORE_MINING)) { - return 'ore-mining'; } } @@ -121,34 +107,25 @@ class Wootook_Empire_Model_Fleet return Wootook::__('Missiles Launch'); } else if ($this->isMission(Legacies_Empire::ID_MISSION_EXPEDITION)) { return Wootook::__('Expedition'); - } else if ($this->isMission(Legacies_Empire::ID_MISSION_ORE_MINING)) { - return Wootook::__('Ore mining'); } return Legacies::__('Unknown'); } - /** - * @return Wootook_Core_DateTime - */ public function getStartTime() { return $this->getData('fleet_start_time'); } - /** - * @return Wootook_Core_DateTime - */ - public function getActionTime() { return $this->getData('fleet_end_stay'); } - /** - * @return Wootook_Core_DateTime - */ public function getArrivalTime() { + if ($this->isMission(Legacies_Empire::ID_MISSION_STATION) || $this->isMission(Legacies_Empire::ID_MISSION_STATION_ALLY)) { + return $this->getActionTime(); + } return $this->getData('fleet_end_time'); } @@ -164,85 +141,15 @@ class Wootook_Empire_Model_Fleet return Wootook_Empire_Model_Planet::factoryFromCoords($coords, $type); } - public function getOriginPlanetName() - { - if (!($planet = $this->getOriginPlanet()->getId())) { - return ''; - } - return $planet->getName(); - } - - public function getOriginPlanetCoords() - { - if (!($planet = $this->getOriginPlanet()->getId())) { - return sprintf('%s:%s:%s', $this->getData('fleet_start_galaxy'), $this->getData('fleet_start_system'), $this->getData('fleet_start_planet')); - } - return $planet->getCoords(); - } - public function getDestinationPlanet() { $coords = array( 'galaxy' => $this->getData('fleet_end_galaxy'), 'system' => $this->getData('fleet_end_system'), 'position' => $this->getData('fleet_end_planet') - ); + ); $type = $this->getData('fleet_end_type'); return Wootook_Empire_Model_Planet::factoryFromCoords($coords, $type); } - - public function getDestinationPlanetName() - { - if (!($planet = $this->getDestinationPlanet()->getId())) { - return ''; - } - return $planet->getName(); - } - - public function getDestinationPlanetCoords() - { - if (!($planet = $this->getDestinationPlanet()->getId())) { - return sprintf('%s:%s:%s', $this->getData('fleet_end_galaxy'), $this->getData('fleet_end_system'), $this->getData('fleet_end_planet')); - } - return $planet->getCoords(); - } - - public function goBack() - { - $this->setData('fleet_mess', 1)->save(); - - return $this; - } - - /** - * @param Wootook_Empire_Model_Planet $planet - * @return Wootook_Empire_Model_Fleet - */ - public function dock(Wootook_Empire_Model_Planet $planet) - { - // Backward-compatible way to unserialize fleet ships listing - $serializedFleetArray = $this->getData('fleet_array'); - foreach (explode(';', $serializedFleetArray) as $fleetShipData) { - if (empty($fleetShipData)) { - continue; - } - $fleetShipData = explode(',', $fleetShipData); - if (count($fleetShipData) != 2) { - continue; - } - $planet->setElement($fleetShipData[0], Math::add($planet->getElement($fleetShipData[0]), $fleetShipData[1])); - } - - $planet - ->setData('metal', Math::add($planet->getData('metal'), $this->getData('fleet_resource_metal'))) - ->setData('cristal', Math::add($planet->getData('cristal'), $this->getData('fleet_resource_crystal'))) - ->setData('deuterium', Math::add($planet->getData('deuterium'), $this->getData('fleet_resource_deuterium'))) - ->save(); - ; - - $this->delete(); - - return $this; - } -} +} \ No newline at end of file diff --git a/application/code/core/Wootook/Empire/Model/Galaxy/Position.php b/application/code/core/Wootook/Empire/Model/Galaxy/Position.php new file mode 100644 index 0000000..2989b1a --- /dev/null +++ b/application/code/core/Wootook/Empire/Model/Galaxy/Position.php @@ -0,0 +1,32 @@ +_tableName = 'galaxy'; + $this->_idFieldNames = array('id_planet'); + } + + static function initPlanetListerner($eventData) + { + if (!isset($eventData['planet'])) { + return; + } + + $planet = $eventData['planet']; + if (!$planet->isPlanet()) { + return; + } + + $galaxy = new self(); + $galaxy + ->setData('galaxy', $planet->getGalaxy()) + ->setData('system', $planet->getSystem()) + ->setData('planet', $planet->getPosition()) + ->setData('id_planet', $planet->getId()) + ->save() + ; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Combat.php b/application/code/core/Wootook/Empire/Model/Game/Combat.php similarity index 88% rename from src/application/code/core/Wootook/Empire/Helper/Config/Combat.php rename to application/code/core/Wootook/Empire/Model/Game/Combat.php index 26a1bc8..48a9e1b 100644 --- a/src/application/code/core/Wootook/Empire/Helper/Config/Combat.php +++ b/application/code/core/Wootook/Empire/Model/Game/Combat.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Empire_Helper_Config_Combat - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Empire_Model_Game_Combat + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/FieldsAlias.php b/application/code/core/Wootook/Empire/Model/Game/FieldsAlias.php similarity index 87% rename from src/application/code/core/Wootook/Empire/Helper/Config/FieldsAlias.php rename to application/code/core/Wootook/Empire/Model/Game/FieldsAlias.php index 101bc5f..9a4ab2b 100644 --- a/src/application/code/core/Wootook/Empire/Helper/Config/FieldsAlias.php +++ b/application/code/core/Wootook/Empire/Model/Game/FieldsAlias.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Empire_Helper_Config_FieldsAlias - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Empire_Model_Game_FieldsAlias + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Prices.php b/application/code/core/Wootook/Empire/Model/Game/Prices.php similarity index 88% rename from src/application/code/core/Wootook/Empire/Helper/Config/Prices.php rename to application/code/core/Wootook/Empire/Model/Game/Prices.php index 1a328de..9133d34 100644 --- a/src/application/code/core/Wootook/Empire/Helper/Config/Prices.php +++ b/application/code/core/Wootook/Empire/Model/Game/Prices.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Empire_Helper_Config_Prices - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Empire_Model_Game_Prices + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Production.php b/application/code/core/Wootook/Empire/Model/Game/Production.php similarity index 87% rename from src/application/code/core/Wootook/Empire/Helper/Config/Production.php rename to application/code/core/Wootook/Empire/Model/Game/Production.php index d4539fc..60ab21c 100644 --- a/src/application/code/core/Wootook/Empire/Helper/Config/Production.php +++ b/application/code/core/Wootook/Empire/Model/Game/Production.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Empire_Helper_Config_Production - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Empire_Model_Game_Production + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Requirements.php b/application/code/core/Wootook/Empire/Model/Game/Requirements.php similarity index 87% rename from src/application/code/core/Wootook/Empire/Helper/Config/Requirements.php rename to application/code/core/Wootook/Empire/Model/Game/Requirements.php index 04ea042..9f09689 100644 --- a/src/application/code/core/Wootook/Empire/Helper/Config/Requirements.php +++ b/application/code/core/Wootook/Empire/Model/Game/Requirements.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Empire_Helper_Config_Requirements - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Empire_Model_Game_Requirements + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Resources.php b/application/code/core/Wootook/Empire/Model/Game/Resources.php similarity index 87% rename from src/application/code/core/Wootook/Empire/Helper/Config/Resources.php rename to application/code/core/Wootook/Empire/Model/Game/Resources.php index 8ce2483..c825f74 100644 --- a/src/application/code/core/Wootook/Empire/Helper/Config/Resources.php +++ b/application/code/core/Wootook/Empire/Model/Game/Resources.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Empire_Helper_Config_Resources - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Empire_Model_Game_Resources + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Types.php b/application/code/core/Wootook/Empire/Model/Game/Types.php similarity index 90% rename from src/application/code/core/Wootook/Empire/Helper/Config/Types.php rename to application/code/core/Wootook/Empire/Model/Game/Types.php index 9ef029d..291c964 100644 --- a/src/application/code/core/Wootook/Empire/Helper/Config/Types.php +++ b/application/code/core/Wootook/Empire/Model/Game/Types.php @@ -7,8 +7,8 @@ * @uses Wootook_Object * @uses Legacies_Empire */ -class Wootook_Empire_Helper_Config_Types - extends Wootook_Core_Helper_Config_ConfigHandler +class Wootook_Empire_Model_Game_Types + extends Wootook_Core_Model_Config_Abstract implements Wootook_Core_Singleton { private static $_singleton = null; diff --git a/src/application/code/core/Wootook/Empire/Model/Planet.php b/application/code/core/Wootook/Empire/Model/Planet.php similarity index 63% rename from src/application/code/core/Wootook/Empire/Model/Planet.php rename to application/code/core/Wootook/Empire/Model/Planet.php index 980524f..c013667 100644 --- a/src/application/code/core/Wootook/Empire/Model/Planet.php +++ b/application/code/core/Wootook/Empire/Model/Planet.php @@ -4,10 +4,10 @@ * * @uses Wootook_Object * @uses Legacies_Empire - * @uses Wootook_Player_Model_Entity + * @uses Legacies_Empire_User */ class Wootook_Empire_Model_Planet - extends Wootook_Core_Mvc_Model_Entity + extends Wootook_Core_Entity { const TYPE_PLANET = 1; const TYPE_DEBRIS = 2; @@ -17,9 +17,9 @@ class Wootook_Empire_Model_Planet protected $_eventObject = 'planet'; /** - * @var Wootook_Player_Model_Entity + * @var Wootook_Empire_Model_User */ - protected $_player = null; + protected $_user = null; /** * @var Wootook_Empire_Model_Planet @@ -27,12 +27,7 @@ class Wootook_Empire_Model_Planet protected $_moon = null; /** - * @var Wootook_Empire_Model_Planet - */ - protected $_planet = null; - - /** - * @var Wootook_Empire_Model_Planet_Builder_Builder + * @var Wootook_Empire_Model_Planet_Builder */ protected $_builder = null; @@ -53,7 +48,6 @@ class Wootook_Empire_Model_Planet protected static $_productionInstances = array(); - /** @var Wootook_Empire_Model_Planet_PluginLoader */ protected $_pluginLoader = null; public static function factory($id) @@ -101,40 +95,31 @@ class Wootook_Empire_Model_Planet $coords['type'] = $type; } - $adapter = Wootook_Core_Database_ConnectionManager::getSingleton() - ->getConnection('core_read'); - $collection = new Wootook_Empire_Resource_Planet_Collection($adapter); - $collection->addCoordsToFilter($coords['galaxy'], $coords['system'], $coords['position'], $coords['type']) - ->setPage(1, 1) - ->load(); + $database = Wootook_Database::getSingleton(); + $collection = new Wootook_Core_Collection('planets'); + $collection + ->column('id') + ->where('galaxy=:galaxy') + ->where('system=:system') + ->where('planet=:position') + ->where('planet_type=:type') + ->limit(1) + ->load($coords) + ; - $planet = $collection->getFirstItem(); - if ($planet !== null) { - return $planet; + $planetData = $collection->getFirstItem(); + + if ($planetData === null || !$planetData->getData('id')) { + return new self(); } - return new self; - } - - public function __construct(Array $data = array(), Wootook_Player_Model_Entity $player = null) - { - parent::__construct($data); - - if ($player !== null) { - $this->setPlayer($player); - } + return self::factory($planetData->getData('id')); } public function _init() { $this->_tableName = 'planets'; $this->_idFieldName = 'id'; - - $this->getDataMapper() - ->addRule('last_update', 'date-time') - ->addRule('b_building', 'date-time') - ->addRule('b_tech', 'date-time') - ->addRule('b_hangar', 'date-time'); } public function __call($method, $params) @@ -143,33 +128,31 @@ class Wootook_Empire_Model_Planet $plugin = substr($method, 3); if ($this->_pluginLoader === null) { - $this->_pluginLoader = new Wootook_Empire_Model_Planet_PluginLoader($this, $this->getPlayer()); + $this->_pluginLoader = new Wootook_Empire_Model_Planet_PluginLoader($this, $this->getUser()); } switch ($prefix) { case 'get': - return $this->_pluginLoader->getPlugin($plugin); + $this->_pluginLoader->getPlugin($plugin); break; case 'set': - return $this->_pluginLoader->setPlugin($plugin, $params[0]); + $this->_pluginLoader->setPlugin($plugin, $params[0]); break; case 'uns': - return $this->_pluginLoader->unsetPlugin($plugin); + $this->_pluginLoader->unsetPlugin($plugin); break; case 'has': - return $this->_pluginLoader->hasPlugin($plugin); + $this->_pluginLoader->hasPlugin($plugin); + break; break; } - throw new Wootook_Core_Exception_RuntimeException(Wootook::__('Undefined method %s::%s.', get_class($this), $method)); + throw new InvalidMethodCall(Wootook::__('Undefined method %s::%s.', get_class($this), $method)); } - /** - * @return Wootook_Core_DateTime - */ public function getLastUpdate() { return $this->getData('last_update'); @@ -192,22 +175,18 @@ class Wootook_Empire_Model_Planet public function getGalaxyData() { - if ($this->isPlanet()) { - $entity = new Wootook_Empire_Model_Galaxy_Position(); - $entity->load(array('id_planet' => $this->getId())); + $entity = new Wootook_Empire_Model_Galaxy_Position(); + $entity->load(array('id_planet' => $this->getId())); - return $entity; - } - - return $this->getPlanet()->getGalaxyData(); + return $entity; } - public function updateStorages() + public function updateStorages($time = null) { Math::setPrecision(50); - $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); foreach ($resources->getAllDatas() as $resource => $resourceData) { - if (!isset($resourceData['storage']) || $resourceData['storage'] === null) { + if (!isset($resourceData['storage_field']) || $resourceData['storage_field'] === null) { continue; } @@ -238,7 +217,7 @@ class Wootook_Empire_Model_Planet public function updateBuildingFields() { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); if ($this->isPlanet()) { $filter = Legacies_Empire::TYPE_BUILDING_PLANET; @@ -258,21 +237,17 @@ class Wootook_Empire_Model_Planet return $this; } - public function updateResourceProduction() + public function updateResourceProduction($time = null) { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); - $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); - $production = Wootook_Empire_Helper_Config_Production::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); + $production = Wootook_Empire_Model_Game_Production::getSingleton(); - if (!$this->isPlanet() || !$this->getPlayer()) { - return $this; + if ($time === null) { + $time = Wootook::now(); } - if ($this->getPlayer()->isVacation()) { - $resourceConfig = Wootook::getGameConfig('resource/base-income'); - foreach ($resources->getAllDatas() as $resource => $resourceData) { - $this->setData($resourceData['production_field'], $resourceConfig[$resource]); - } + if (!$this->isPlanet()) { return $this; } @@ -295,7 +270,7 @@ class Wootook_Empire_Model_Planet $ratio = $this->getData($ratioField); $element = self::getProductionElementInstance($productionUnit); - $productionRatios[$productionUnit] = $element->getProductionRatios($level, $ratio, $this, $this->getPlayer()); + $productionRatios[$productionUnit] = $element->getProductionRatios($level, $ratio, $this, $this->getUser()); foreach ($productionRatios[$productionUnit] as $resourceId => $resourceProduction) { $comp = Math::comp($resourceProduction, 0); if ($comp < 0) { @@ -364,7 +339,7 @@ class Wootook_Empire_Model_Planet // Dispatch 'planet.update-production.before' event Wootook::dispatchEvent($this->_eventPrefix . '.update-production.before', array( $this->_eventObject => $this, - 'player' => $this->getPlayer(), + 'user' => $this->getUser(), 'productions' => $actualProduction )); @@ -380,28 +355,27 @@ class Wootook_Empire_Model_Planet // Dispatch 'planet.update-production.after' event Wootook::dispatchEvent($this->_eventPrefix . '.update-production.after', array( $this->_eventObject => $this, - 'player' => $this->getPlayer() + 'user' => $this->getUser() )); return $this; } - public function updateResources(Wootook_Core_DateTime $time = null) + public function updateResources($time = null) { - $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); if ($time === null) { - $time = new Wootook_Core_DateTime(); + $time = Wootook::now(); } - $timeDiff = $time->diff($this->getLastUpdate()); - + $timeDiff = ($time - $this->getLastUpdate()) / 3600; foreach ($resources->getAllDatas() as $resourceId => $resourceConfig) { if (!$resourceConfig['storage_field']) { continue; } - $production = Math::mul($this->getData($resourceConfig['production_field']), $timeDiff / 3600); + $production = Math::mul($this->getData($resourceConfig['production_field']), $timeDiff); $resourceValue = Math::add($this->getData($resourceConfig['field']), $production); $this->setData($resourceConfig['field'], Math::min($resourceValue, $this->getData($resourceConfig['storage_field']))); } @@ -412,13 +386,13 @@ class Wootook_Empire_Model_Planet public static function getProductionElementInstance($buildingId) { - $production = Wootook_Empire_Helper_Config_Production::getSingleton(); + $production = Wootook_Empire_Model_Game_Production::getSingleton(); if (!isset(self::$_productionInstances[$buildingId])) { if (!isset($production[$buildingId])) { return null; } - $class = $production[$buildingId]; + $class = $production[$buildingId][Legacies_Empire::RESOURCE_CLASS]; $reflection = new ReflectionClass($class); self::$_productionInstances[$buildingId] = $reflection->newInstance(); } @@ -428,30 +402,93 @@ class Wootook_Empire_Model_Planet public function getFleetCollection($time = null) { - $collection = new Wootook_Empire_Resource_Fleet_Collection($this->getReadConnection()); - $collection->addPlanetToFilter($this, $time); + $firstCollection = new Wootook_Core_Collection(array('fleet' => 'fleets')); + $firstCollection + ->column('*') + ->where('fleet.fleet_start_galaxy = :galaxy') + ->where('fleet.fleet_start_system = :system') + ->where('fleet.fleet_start_planet = :position') + ->where('fleet.fleet_start_type = :planet_type') + ; + $backCollection = new Wootook_Core_Collection(array('fleet' => 'fleets')); + $backCollection + ->column('*') + ->where('fleet.fleet_end_galaxy = :galaxy') + ->where('fleet.fleet_end_system = :system') + ->where('fleet.fleet_end_planet = :position') + ->where('fleet.fleet_end_type = :planet_type') + ; + + $options = array( + 'galaxy' => $this->getSystem(), + 'system' => $this->getSystem(), + 'position' => $this->getPosition(), + 'planet_type' => $this->getType() + ); + + if ($time !== null) { + $options['now'] = $time; + $firstCollection->where('fleet_start_time <= :now'); + $backCollection->where('fleet_end_time <= :now'); + } + + $collection = new Wootook_Core_Collection(); + $collection + ->setEntityClassName('Wootook_Empire_Model_Fleet') + ->union($firstCollection) + ->union($backCollection) + ->load($options) + ; return $collection; } - public function getPlayerId() + public function getUserId() { return (int) $this->getData('id_owner'); } - public function getPlayer() + public function getUser() { - if ($this->_player === null && $this->getPlayerId()) { - $this->_player = new Wootook_Player_Model_Entity(); - $this->_player->load($this->getPlayerId()); + if ($this->_user === null && $this->getUserId()) { + $this->_user = Wootook_Empire_Model_User::factory($this->getUserId()); } - return $this->_player; + return $this->_user; } - public function setPlayer(Wootook_Player_Model_Entity $player) + public function setUser(Wootook_Empire_Model_User $user) { - $this->_player = $player; - $this->setData('id_owner', $player->getId()); + $this->_user = $user; + + return $this; + } + + public function getShipyard() + { + if ($this->_shipyard === null) { + $this->_shipyard = new Legacies_Empire_Model_Planet_Building_Shipyard($this, $this->getUser()); + } + return $this->_shipyard; + } + + public function setShipyard(Legacies_Empire_Model_Planet_Building_Shipyard $shipyard) + { + $this->_shipyard = $shipyard; + + return $this; + } + + public function getResearchLab() + { + if ($this->_laboratory === null) { + $this->_laboratory = new Legacies_Empire_Model_Planet_Building_ResearchLab($this, $this->getUser()); + } + return $this->_laboratory; + } + + public function setResearchLab(Legacies_Empire_Model_Planet_Building_ResearchLab $laboratory) + { + $this->_laboratory = $laboratory; return $this; } @@ -473,60 +510,31 @@ class Wootook_Empire_Model_Planet public function getMoon() { + static $statement = null; + if ($this->isMoon()) { return null; } if ($this->_moon === null) { - $collection = new Wootook_Empire_Resource_Planet_Collection($this->getReadConnection()); - $collection->addFieldToFilter('galaxy', $this->getGalaxy()) - ->addFieldToFilter('system', $this->getGalaxy()) - ->addFieldToFilter('planet', $this->getPosition()) - ->addFieldToFilter('planet_type', self::TYPE_MOON) - ->load() - ; - - $this->_moon = $collection->getFirstItem(); - - if ($this->_moon !== null && $this->_moon instanceof self) { - $this->_moon->setPlanet($this); + if ($statement === null) { + $statement = new Wootook_Core_Collection(array('planet' => 'planets'), get_class($this)); + $statement + ->where('galaxy=:galaxy') + ->where('system=:system') + ->where('planet=:position') + ->where('planet_type=' . strval(self::TYPE_MOON)) + ; } - } - return $this->_moon; - } - - public function setMoon(Wootook_Empire_Model_Planet $moon) - { - $this->_moon = $moon; - - return $this; - } - - public function getPlanet() - { - if ($this->isPlanet()) { - return null; - } - - if ($this->_planet === null) { - $this->_planet = Wootook_Empire_Model_Planet::factoryFromCoords(array( + $statement->load(array( 'galaxy' => $this->getGalaxy(), 'system' => $this->getSystem(), 'position' => $this->getPosition() )); - if ($this->_planet !== null && $this->_planet instanceof self) { - $this->_planet->setMoon($this); - } + $this->_moon = $statement->current(); } - return $this->_planet; - } - - public function setPlanet(Wootook_Empire_Model_Planet $planet) - { - $this->_planet = $planet; - - return $this; + return $this->_moon; } public function setGalaxy($galaxy) @@ -606,7 +614,7 @@ class Wootook_Empire_Model_Planet public function isDestroyed() { - return (bool) ($this->getData('destruyed') > 0); + return (bool) $this->getData('destruyed'); } public function destroy() @@ -616,23 +624,23 @@ class Wootook_Empire_Model_Planet } if ($this->isDestroyed()) { - throw new Wootook_Empire_Exception_Planet(Wootook::__('Planet is already destroyed.')); + throw new Wootook_Empire_Model_Planet_Exception(Wootook::__('Planet is already destroyed.')); } if ($this->getFleetCollection()->count() > 0) { - throw new Wootook_Empire_Exception_Planet(Wootook::__("Could not delete planet until fleets aten't retuned.")); + throw new Wootook_Empire_Model_Planet_Exception(Wootook::__("Could not delete planet until fleets aten't retuned.")); } - $player = $this->getPlayer(); - if ($player->getHomePlanet()->getId() == $this->getId()) { - throw new Wootook_Empire_Exception_Planet(Wootook::__("You can't destroy your home planet.")); + $user = $this->getUser(); + if ($user->getHomePlanet()->getId() == $this->getId()) { + throw new Wootook_Empire_Model_Planet_Exception(Wootook::__("You can't destroy your home planet.")); } - if ($player->getCurrentPlanet()->getId() == $this->getId()) { - $homePlanet = $player->getHomePlanet(); + if ($user->getCurrentPlanet()->getId() == $this->getId()) { + $homePlanet = $user->getHomePlanet(); if ($homePlanet !== null) { - $player->updateCurrentPlanet($homePlanet); + $user->updateCurrentPlanet($homePlanet); } } @@ -641,49 +649,41 @@ class Wootook_Empire_Model_Planet } $this - ->setData('destruyed', time() + 172800) + ->setData('destruyed', true) ->setData('id_owner', 0) ->save(); return $this; } - public function isErasable() - { - if ($this->isDestroyed() && $this->getData('destruyed') >= time()) { - return true; - } - return false; - } - public function getElement($elementId) { - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); return $this->getData($fields[$elementId]); } public function setElement($elementId, $level) { - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); return $this->setData($fields[$elementId], $level); } public function hasElement($elementId, $levelRequired = 0) { - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); return $this->hasData($fields[$elementId]) && Math::comp($this->getElement($elementId), $levelRequired) > 0; } - public function appendBuildingQueue($buildingId, $destroy = false, Wootook_Core_DateTime $time = null) + public function appendBuildingQueue($buildingId, $destroy = false, $time = null) { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); if ($time === null) { - $time = new Wootook_Core_DateTime(); + $time = Wootook::now(); } if (!$types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) { @@ -699,7 +699,7 @@ class Wootook_Empire_Model_Planet 'bulding_id' => $buildingId, 'level' => $this->getElement($buildingId), $this->_eventObject => $this, - 'player' => $this->getPlayer(), + 'user' => $this->getUser(), 'destroy' => $destroy )); @@ -716,24 +716,24 @@ class Wootook_Empire_Model_Planet 'bulding_id' => $buildingId, 'level' => $this->getElement($buildingId), $this->_eventObject => $this, - 'player' => $this->getPlayer(), + 'user' => $this->getUser(), 'destroy' => $destroy )); return $this; } - public function updateBuildingQueue(Wootook_Core_DateTime $time = null) + public function updateBuildingQueue($time = null) { if ($time === null) { - $time = new Wootook_Core_DateTime(); + $time = Wootook::now(); } // Dispatch event Wootook::dispatchEvent($this->_eventPrefix . '.update-queue.before', array( 'time' => &$time, - $this->_eventObject => $this, - 'player' => $this->getPlayer() + $this->_eventObject => $this->_currentPlanet, + 'user' => $this->_currentUser )); $this->getBuildingQueue()->updateQueue($time); @@ -741,8 +741,9 @@ class Wootook_Empire_Model_Planet // Dispatch event Wootook::dispatchEvent($this->_eventPrefix . '.update-queue.after', array( 'time' => $time, - $this->_eventObject => $this, - 'player' => $this->getPlayer() + 'shipyard' => $this, + $this->_eventObject => $this->_currentPlanet, + 'user' => $this->_currentUser )); return $this; @@ -763,12 +764,12 @@ class Wootook_Empire_Model_Planet /** * - * @return Wootook_Empire_Model_Planet_Builder_Builder + * @return Wootook_Empire_Model_Planet_Builder */ public function getBuildingQueue() { - if ($this->_builder === null && $this->getPlayer()) { - $this->_builder = new Wootook_Empire_Model_Planet_Builder_Builder($this, $this->getPlayer()); + if ($this->_builder === null) { + $this->_builder = new Wootook_Empire_Model_Planet_Builder($this, $this->getUser()); } return $this->_builder; } @@ -783,7 +784,7 @@ class Wootook_Empire_Model_Planet $this->getBuildingQueue()->rewind(); $item = $this->getBuildingQueue()->current(); - $this->getBuildingQueue()->dequeueFirstItem(new Wootook_Core_DateTime()); + $this->getBuildingQueue()->dequeueFirstItem(Wootook::now()); return $this; } @@ -809,17 +810,15 @@ class Wootook_Empire_Model_Planet */ public function checkAvailability($buildingId) { - if (!$this->getBuildingQueue()->checkAvailability($buildingId)) { - return false; - } + $this->getBuildingQueue()->checkAvailability($buildingId); try { // Dispatch event. Throw an exception to break the avaliability. Wootook::dispatchEvent($this->_eventPrefix . '.check-availability', array( 'ship_id' => $buildingId, 'shipyard' => $this, - $this->_eventObject => $this, - 'player' => $this->getPlayer() + $this->_eventObject => $this->_currentPlanet, + 'user' => $this->_currentUser )); } catch (Exception $e) { return false; @@ -850,53 +849,129 @@ class Wootook_Empire_Model_Planet return $this->getBuildingQueue()->getBuildingTime($buildingId, $level); } + public static function registrationListener($eventData) + { + if (isset($eventData['user'])) { + $user = $eventData['user']; + + if ($user === null || !$user instanceof Wootook_Empire_Model_User || !$user->getId()) { + return; + } + + $collection = self::searchMostFreeSystems(); + $collection->limit(1)->load(); + + if ($collection->count() == 0) { + throw new Exception('No more planet to colonize!'); // Oops, no more free place + } + + $systemInfo = $collection->current(); + if ($systemInfo->getData('count') >= MAX_PLANET_IN_SYSTEM) { + throw new Exception('No more planet to colonize!'); // Oops, no more free place + } + + $collection = new Wootook_Core_Collection(array('planet' => 'planets')); + $collection + ->column(array('position' => 'planet.planet')) + ->where('planet.planet_type=1') + ->where('planet.galaxy=:galaxy') + ->where('planet.system=:system') + ->load(array( + 'galaxy' => $systemInfo->getData('galaxy'), + 'system' => $systemInfo->getData('system'), + )) + ; + $positions = range(1, MAX_PLANET_IN_SYSTEM); + foreach ($collection as $planet) { + $key = array_search($planet->getData('position'), $positions); + if ($key !== false) { + unset($positions[$key]); + } + } + $key = array_rand($positions, 1); + $finalPosition = $positions[$key]; + + $config = Wootook_Core_Model_Config::getSingleton(); + $planet = new self(); + $planet + ->setData('id_owner', $user->getId()) + ->setData('name', Wootook::getRequest()->getParam('planet')) + ->setData('galaxy', $systemInfo->getData('galaxy')) + ->setData('system', $systemInfo->getData('system')) + ->setData('planet', $finalPosition) + ->setData('planet_type', 1) + ->setData('field_max', $config->getData('initial_fields')) + ->setData('field_current', 0) + ->setData('metal', 500) // TODO: use config + ->setData('cristal', 500) // TODO: use config + ; + + $planet->save(); + + $user + ->setData('id_planet', $planet->getId()) + ->setData('current_planet', $planet->getId()) + ->setData('galaxy', $planet->getGalaxy()) + ->setData('system', $planet->getSystem()) + ->setData('planet', $planet->getPosition()) + ; + + Wootook::dispatchEvent('planet.init', array( + 'planet' => $planet, + 'user' => $user + )); + + $planet->save(); + } + } + public static function searchMostFreeSystems($galaxyList = null, $systemList = null) { - $adapter = Wootook_Core_Database_ConnectionManager::getSingleton() - ->getConnection('core_read'); - $select = $adapter->select(array('galaxy' => $adapter->getTable('galaxy'))); - $select + $collection = new Wootook_Core_Collection(array('galaxy' => 'galaxy')); + $collection ->column(array( - 'galaxy' => 'galaxy', - 'system' => 'system', - 'count' => new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)') + 'galaxy' => 'galaxy.galaxy', + 'system' => 'galaxy.system', + 'count' => 'COUNT(*)' )) ->group('galaxy.galaxy') ->group('galaxy.system') ; - if ($galaxyList === null && Wootook::getGameConfig('user/registration/galaxy_list')) { - $galaxyList = explode(',', Wootook::getGameConfig('user/registration/galaxy_list')); + $config = Wootook_Core_Model_Config::getSingleton(); + + if ($galaxyList === null && $config->hasData('user/registration/galaxy_list')) { + $galaxyList = explode(',', $config->getData('user/registration/galaxy_list')); } if ($galaxyList !== null) { array_walk($galaxyList, array(__CLASS__, '_cleanItemRanges')); - $select->where('galaxy', array(array(Wootook_Core_Database_Sql_Select::OPERATOR_IN => $galaxyList))); + $collection->where('galaxy.galaxy IN(' . implode(', ', $galaxyList) . ')'); } - if ($systemList === null && Wootook::getGameConfig('user/registration/system_list')) { - $systemList = explode(',', Wootook::getGameConfig('user/registration/system_list')); + if ($systemList === null && $config->hasData('user/registration/system_list')) { + $systemList = explode(',', $config->getData('user/registration/system_list')); } if ($systemList !== null) { array_walk($systemList, array(__CLASS__, '_cleanItemRanges')); - $select->where('system', array(array(Wootook_Core_Database_Sql_Select::OPERATOR_IN => $systemList))); + $collection->where('galaxy.system IN(' . implode(', ', $systemList) . ')'); } $orders = array( - "COUNT(*) / {$adapter->quote(Wootook::getGameConfig('engine/universe/positions'))}", - "1 + ABS(galaxy.galaxy - CEIL({$adapter->quote(Wootook::getGameConfig('engine/universe/galaxies'))} / 2))", - "1 + 2 * ABS(galaxy.system - CEIL({$adapter->quote(Wootook::getGameConfig('engine/universe/systems'))} / 2))", + "COUNT(*) / {$collection->quote(MAX_PLANET_IN_SYSTEM)}", + "1 + ABS(galaxy.galaxy - CEIL({$collection->quote(MAX_GALAXY_IN_WORLD)} / 2))", + "1 + 2 * ABS(galaxy.system - CEIL({$collection->quote(MAX_SYSTEM_IN_GALAXY)} / 2))", "RAND() / 1000", ); - $select - ->order(new Wootook_Core_Database_Sql_Placeholder_Expression('((' . implode(') * (', $orders) . '))'), 'ASC') - //->order("ABS(galaxy.system - CEIL({$collection->quote(Wootook::getGameConfig('engine/universe/systems'))} / 2))", 'ASC') - //->order("ABS(galaxy.galaxy - CEIL({$collection->quote(Wootook::getGameConfig('engine/universe/galaxies'))} / 2))", 'ASC') + $collection + ->order('((' . implode(') * (', $orders) . '))', 'ASC') + //->order("ABS(galaxy.system - CEIL({$collection->quote(MAX_SYSTEM_IN_GALAXY)} / 2))", 'ASC') + //->order("ABS(galaxy.galaxy - CEIL({$collection->quote(MAX_GALAXY_IN_WORLD)} / 2))", 'ASC') //->order("1.5 / COUNT(*)", 'ASC') ->order('RAND()', 'ASC'); - return $select; + return $collection; } private static function _cleanItemRanges(&$value, $index, $userdata = null) @@ -904,32 +979,6 @@ class Wootook_Empire_Model_Planet return intval($value); } - public static function planetChangeListener($eventData) - { - if (!isset($eventData['request']) || !$eventData['request'] instanceof Wootook_Core_Mvc_Controller_Request_Http) { - return; - } - - /** @var Wootook_Core_Mvc_Controller_Request_Http $request */ - $request = $eventData['request']; - if (!($planetId = $request->getQuery('___planet'))) { - return; - } - - $session = Wootook_Player_Model_Session::getSingleton(); - if (!$session->isLoggedIn()) { - return; - } - $planet = new Wootook_Empire_Model_Planet(); - $planet->load($planetId); - if (!$planet->getId()) { - return; - } - - $player = $session->getPlayer(); - $player->setCurrentPlanet($planet); - } - public static function planetUpdateListener($eventData) { if (isset($eventData['planet'])) { @@ -938,10 +987,7 @@ class Wootook_Empire_Model_Planet if (isset($eventData['time'])) { $time = $eventData['time']; } else { - $time = new Wootook_Core_DateTime(); - } - if (!$time instanceof Wootook_Core_DateTime) { - $time = new Wootook_Core_DateTime($time); + $time = time(); } if ($planet === null || !$planet instanceof Wootook_Empire_Model_Planet) { @@ -950,17 +996,14 @@ class Wootook_Empire_Model_Planet $planet->updateBuildingQueue($time); $planet->updateResources($time); - $planet->getShipyard()->updateQueue($time); // FIXME : update all plugin queues - $planet->getResearchLab()->updateQueue($time); // FIXME : update all plugin queues + $planet->getShipyard()->updateQueue($time); $planet->setLastUpdate($time); - - $planet->getPlayer()->save(); } } public function getResourceAmount($resourceType) { - $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); $resourceConfig = $resources->getData($resourceType); if ($resourceConfig === null) { @@ -971,7 +1014,7 @@ class Wootook_Empire_Model_Planet public function getResourceCap($resourceType) { - $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); $resourceConfig = $resources->getData($resourceType); if ($resourceConfig === null) { @@ -991,4 +1034,4 @@ class Wootook_Empire_Model_Planet } return false; } -} +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Builder.php b/application/code/core/Wootook/Empire/Model/Planet/Builder.php similarity index 59% rename from src/application/code/core/Wootook/Empire/Model/Planet/Builder/Builder.php rename to application/code/core/Wootook/Empire/Model/Planet/Builder.php index eddf545..d696c8c 100644 --- a/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Builder.php +++ b/application/code/core/Wootook/Empire/Model/Planet/Builder.php @@ -1,59 +1,11 @@ - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ -/** - * - * Enter description here ... - * @author Greg - * - */ -class Wootook_Empire_Model_Planet_Builder_Builder +class Wootook_Empire_Model_Planet_Builder extends Wootook_Empire_Model_BuilderAbstract { - const FIELD_SERIALIZED = 'b_building_id'; - - /** - * @var int - */ - protected $_maxLength = 0; - - /** - * @var float - */ - protected $_speedEnhancement = null; - public function init() { - $this->_unserializeQueue($this->_currentPlanet->getData(self::FIELD_SERIALIZED)); - - $this->_maxLength = Wootook::getGameConfig('engine/core/buildings_queue_size'); + $this->_unserializeQueue($this->_currentPlanet->getData('b_building_id')); } /** @@ -69,7 +21,7 @@ class Wootook_Empire_Model_Planet_Builder_Builder $level = $params['level']; if (!isset($params['created_at'])) { - $createdAt = new Wootook_Core_DateTime(); + $createdAt = time(); } else { $createdAt = $params['created_at']; } @@ -95,60 +47,36 @@ class Wootook_Empire_Model_Planet_Builder_Builder )); } - public function getSpeedEnhancement() - { - if ($this->_speedEnhancement === null) { - $event = Wootook::dispatchEvent('planet.building.speed-enhancement', array( - 'player' => $this->_currentPlanet, - 'planet' => $this->_currentPlanet, - 'enhancement' => 1 - )); - - $this->_speedEnhancement = $event->getData('enhancement'); - } - - return $this->_speedEnhancement; - } - /** * Check if a building is actually buildable on the current planet, * depending on the technology and buildings requirements. * - * @param int|string $buildingId + * @param int $buildingId * @return bool */ public function checkAvailability($buildingId) { - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); - if (!$types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) { - return false; + if ($types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) { + return true; } - return parent::checkAvailability($buildingId); + return false; } - /** - * Returns the time needed to build $level of $buildingId - * - * @param int|string $buildingId - * @param int $level - */ public function getBuildingTime($buildingId, $level) { - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); + $gameConfig = Wootook_Core_Model_Config::getSingleton(); Math::setPrecision(50); $firstLevelTime = $prices[$buildingId][Legacies_Empire::BASE_BUILDING_TIME]; $partialLevelTime = Math::mul($firstLevelTime, Math::pow($prices[$buildingId][Legacies_Empire::RESOURCE_MULTIPLIER], $level)); $levelTime = Math::sub($partialLevelTime, $firstLevelTime); - $speedFactor = Wootook::getGameConfig('game/speed/general'); - - if ($speedFactor == null) { - $speedFactor = 1; - } - $baseTime = Math::div($levelTime, 3600 / ($speedFactor * $this->getSpeedEnhancement())); + $speedFactor = $gameConfig->getData('game_speed'); + $baseTime = $levelTime / $speedFactor * 3600; Math::setPrecision(); @@ -156,7 +84,7 @@ class Wootook_Empire_Model_Planet_Builder_Builder 'time' => $baseTime, 'base_time' => $baseTime, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer, + 'user' => $this->_currentUser, 'building_id' => $buildingId, 'level' => $level )); @@ -164,14 +92,10 @@ class Wootook_Empire_Model_Planet_Builder_Builder return $event->getData('time'); } - /** - * (non-PHPdoc) - * @see Legacies_Empire_Model_BuilderAbstract::getResourcesNeeded() - */ public function getResourcesNeeded($buildingId, $level) { - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); - $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); + $prices = Wootook_Empire_Model_Game_Prices::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); if (!isset($prices[$buildingId])) { return array(); @@ -193,56 +117,54 @@ class Wootook_Empire_Model_Planet_Builder_Builder /** * Update the contruction queue. * - * @return Wootook_Empire_Model_Planet_Builder_Builder + * @return Wootook_Empire_Model_Planet_Building_Shipyard */ - public function updateQueue(Wootook_Core_DateTime $time) + public function updateQueue($time) { - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); - $startingTime = clone $this->_currentPlanet->getData('b_building'); + $startingTime = $this->_currentPlanet->getData('b_building'); foreach ($this->getQueue() as $element) { $elementTime = $element->getData('started_at'); if ($elementTime === null) { - $element->setData('started_at', $startingTime->getTimestamp()); - $elementTime = $startingTime->getTimestamp(); + $element->setData('started_at', $startingTime); + $elementTime = $startingTime; } $level = $element->getData('level'); $buildingId = $element->getData('building_id'); $buildTime = $this->getBuildingTime($buildingId, $level); - $elapsedTime = $time->getTimestamp() - $elementTime; + $elapsedTime = $time - $elementTime; if ($elapsedTime >= $buildTime) { - $this->dequeue($element); - - $currentTime = clone $startingTime; - $currentTime->add($elapsedTime); - - $this->_currentPlanet->updateResources($currentTime); + $this->_currentPlanet->updateResources($time - $elapsedTime); $this->_currentPlanet->setElement($buildingId, $level); - $this->_currentPlanet->updateStorages($currentTime); - $this->_currentPlanet->updateResourceProduction($currentTime); + $this->_currentPlanet->updateResourceProduction($time - $elapsedTime); + $this->_currentPlanet->updateStorages($time - $elapsedTime); $this->_currentPlanet->updateBuildingFields(); + $this->dequeue($element); + Wootook::dispatchEvent('planet.building.level-update', array( - 'time' => $currentTime, + 'time' => $time - $elapsedTime, 'planet' => $this->_currentPlanet, - 'player' => $this->_currentPlayer, + 'user' => $this->_currentUser, 'building_id' => $buildingId, 'level' => $level )); - $startingTime->set($elementTime + $buildTime); + $startingTime = $elementTime + $buildTime; continue; } + $element->setData('updated_at', $time); break; } $this->_currentPlanet->setData('b_building_id', $this->serialize()); - $this->_currentPlanet->setData('b_building', $startingTime->now()); + $this->_currentPlanet->setData('b_building', $startingTime); return $this; } @@ -250,17 +172,14 @@ class Wootook_Empire_Model_Planet_Builder_Builder /** * Append items to build to the construction list * - * @param int|string $buildingId - * @param int $level - * @return Wootook_Empire_Model_Planet_Builder_Builder + * @param int $buildingId + * @param int|string $level + * @return Wootook_Empire_Model_Planet_Building_Shipyard */ - public function appendQueue($buildingId, $level, Wootook_Core_DateTime $time) + public function appendQueue($buildingId, $level, $time) { - if ($this->_maxLength > 0 && $this->count() >= $this->_maxLength) { - return $this; - } - - $types = Wootook_Empire_Helper_Config_Types::getSingleton(); + $types = Wootook_Empire_Model_Game_Types::getSingleton(); + $resources = Wootook_Empire_Model_Game_Resources::getSingleton(); if (!Math::isPositive($level)) { return $this; @@ -287,7 +206,7 @@ class Wootook_Empire_Model_Planet_Builder_Builder $this->enqueue(array( 'building_id' => $buildingId, 'level' => $level, - 'created_at' => $time->getTimestamp() + 'created_at' => $time )); $this->_currentPlanet->setData('b_building_id', $this->serialize()); @@ -302,7 +221,7 @@ class Wootook_Empire_Model_Planet_Builder_Builder * Dequeues the first item to build to the construction list and removes all * its successors of the same type. * - * @return Wootook_Empire_Model_Planet_Builder_Builder + * @return Wootook_Empire_Model_Planet_Builder */ public function dequeueFirstItem() { @@ -317,7 +236,7 @@ class Wootook_Empire_Model_Planet_Builder_Builder * successors of the same type. * * @param string $itemId - * @return Wootook_Empire_Model_Planet_Builder_Builder + * @return Wootook_Empire_Model_Planet_Builder */ public function dequeueItem($itemId) { @@ -350,4 +269,4 @@ class Wootook_Empire_Model_Planet_Builder_Builder return $this; } -} +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Item.php b/application/code/core/Wootook/Empire/Model/Planet/Builder/Item.php similarity index 100% rename from src/application/code/core/Wootook/Empire/Model/Planet/Builder/Item.php rename to application/code/core/Wootook/Empire/Model/Planet/Builder/Item.php diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/BuildingInterface.php b/application/code/core/Wootook/Empire/Model/Planet/BuildingInterface.php similarity index 100% rename from src/application/code/core/Wootook/Empire/Model/Planet/BuildingInterface.php rename to application/code/core/Wootook/Empire/Model/Planet/BuildingInterface.php diff --git a/application/code/core/Wootook/Empire/Model/Planet/Exception.php b/application/code/core/Wootook/Empire/Model/Planet/Exception.php new file mode 100644 index 0000000..206a600 --- /dev/null +++ b/application/code/core/Wootook/Empire/Model/Planet/Exception.php @@ -0,0 +1,3 @@ +_currentUser = $currentUser; + $this->_currentPlanet = $currentPlanet; + } + + protected function _load($className, $useSingleton) + { + $reflection = new ClassReflection($className); + if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) { + $method = $reflection->getMethod('getSingleton'); + $method->invoke(); + } + + try { + return $reflection->invoke($this->_currentPlanet, $this->_currentUser); + } catch (ReflectionException $e) { + return null; + } + } +} diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php b/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php similarity index 87% rename from src/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php rename to application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php index 9556195..371fb09 100644 --- a/src/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php +++ b/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php @@ -2,5 +2,5 @@ interface Wootook_Empire_Model_Planet_ResourceProductionInterface { - public function getProductionRatios($level, $produtionRatio, $planet, $player); + public function getProductionRatios($level, $produtionRatio, $planet, $user); } \ No newline at end of file diff --git a/application/code/core/Wootook/Empire/Model/Planet/ShipAbstract.php b/application/code/core/Wootook/Empire/Model/Planet/ShipAbstract.php new file mode 100644 index 0000000..6b74645 --- /dev/null +++ b/application/code/core/Wootook/Empire/Model/Planet/ShipAbstract.php @@ -0,0 +1,27 @@ +getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE)); + } + + public function getActualSpeed(Wootook_Empire_Model_User $user) + { + return $this->getBaseSpeed($user) * $this->getSpeedMultiplier($user); + } + + public function getActualConsumption(Wootook_Empire_Model_User $user, $speed) + { + return $this->getBaseConsumption($user) * ($speed / 100) * $this->getSpeedMultiplier($user); + } +} \ No newline at end of file diff --git a/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php b/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php new file mode 100644 index 0000000..81c54cc --- /dev/null +++ b/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php @@ -0,0 +1,11 @@ +getData('username'); + } + + public static function getSingleton() + { + if (self::$_singleton === null) { + $session = Wootook::getSession(self::SESSION_KEY); + if ($session->hasData('user_id')) { + $id = intval($session->getData('user_id')); + } else if (Wootook::getRequest() !== null && ($cookie = Wootook::getRequest()->getCookie(self::$_cookieName)) !== null) { + $cookieData = unserialize(stripslashes($cookie)); + if (is_array($cookieData)) { + $collection = new Wootook_Core_Collection(array('user' => 'users')); + $cookieData = array( + 'id' => (isset($cookieData['id']) ? intval($cookieData['id']) : 0), + 'key' => (isset($cookieData['key']) ? $collection->quote($cookieData['key']) : null) + ); + + $collection + ->column('id') + ->where('user.id=:id') + ->where(':key=CONCAT((@salt:=MID(:key, 0, 4)), SHA1(CONCAT(user.username, user.password, @salt)))') + ->load($cookieData) + ; + + if ($collection->count() > 0) { + $session->setData(self::SESSION_KEY, $cookieData['id']); + } else { + $session->addError('Your session has expired, please login.'); + return null; + } + } + } else { + $session->addError('Your session has expired, please login.'); + return null; + } + + try { + self::$_singleton = self::factory($id); + } catch (Wootook_Core_Exception_DataAccessException $e) { + $session->addError('Session error.'); + return null; + } + self::$_singleton->_updateActivity(); + } + return self::$_singleton; + } + + public static function hash($password, $salt = null) + { + if ($salt === null) { + return call_user_func(self::$hashCallback, ($password)); + } + + return call_user_func(self::$hashCallback, ($password . $salt)); + } + + protected function _init() + { + $this->setIdFieldName('id'); + $this->setTableName('users'); + } + + protected function _updateActivity() + { + $this + ->setData('current_page', $_SERVER['REQUEST_URI']) + ->setData('user_lastip', $_SERVER['REMOTE_ADDR']) + ->setData('user_agent', $_SERVER['HTTP_USER_AGENT']) + ->setData('onlinetime', time()) + ->save() + ; + return $this; + } + + public function logout() + { + Wootook::getResponse()->unsetCookie(self::$_cookieName); + Wootook_Core_Model_Session::destroy(); + } + + public static function login($username, $password, $remember = false) + { + $session = Wootook::getSession(self::SESSION_KEY); + + try { + $collection = new Wootook_Core_Collection(array('user' => 'users')); + + $passwordHash = md5($password); + $collection + ->column('user.id') + ->column('user.username') + ->column('user.password') + ->column('user.banaday') + ->column('CONCAT((@salt:=MID(MD5(RAND()), 0, 4)), SHA1(CONCAT(user.username, user.password, @salt))) AS login_rememberme') + ->column('(CASE WHEN user.password="' . $passwordHash . '" THEN 1 ELSE 0 END) AS login_success') + ->where('user.username=:username') + ->load(array( + 'username' => $username + )) + ; + } catch (Wootook_Core_Exception_DataAccessException $e) { + Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); + $session->addError('No such user.'); + return null; + } + + if ($collection->count() <= 0) { + $session->addError('No such user.'); + return null; + } + $login = $collection->current(); + + if (intval($login['login_success']) == 1) { + if ($login['banaday'] != 0) { + if($login['banaday'] <= time()) { + $user->setData('banaday', 0) + ->setData('bana', 0) + ->setData('urlaubs_modus', 0) + ->save() + ; + } else { + $session->addError('You were banned, please contact admin for more information.'); + return null; + } + } + + if (isset($_POST["rememberme"]) && Wootook::getRequest() !== null) { + Wootook::$response->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME); + } + + self::$_singleton = self::factory($login['id']); + self::$_singleton->_updateActivity(); + + $session->setData('user_id', intval($login['id'])); + + return self::$_singleton; + } + + $session->addError('Your username or credential is invalid, please check your input.'); + return null; + } + + public static function register($username, $email, $password) + { + try { + $request = Wootook::getRequest(); + $user = new self(array( + 'username' => $username, + 'password' => md5($password), + 'email' => $email, + 'email_2' => $email, + + 'register_time' => Wootook::now(), + 'onlinetime' => Wootook::now(), + 'ip_at_reg' => $request->getServer('REMOTE_ADDR'), + 'user_lastip' => $request->getServer('REMOTE_ADDR'), + 'user_agent' => $request->getServer('HTTP_USER_AGENT') + )); + + $user->save(); + + Wootook::dispatchEvent('user.init', array( + 'user' => $user + )); + + $user->save(); + } catch (Wootook_Core_Exception_DataAccessException $e) { + echo $e->getTraceAsString(); + $session->addError($e->getMessage()); + return null; + } + + return $user; + } + + /** + * + * Enter description here ... + * @param int|Wootook_Empire_Model_Planet $planet + */ + public function updateCurrentPlanet($planet) + { + if (!$planet instanceof Wootook_Empire_Model_Planet) { + $planetCollection = $this->_preparePlanetCollection()->where('id=:id'); + + $planetCollection->load(array( + 'id' => $planet, + 'user' => $this->getId() + )); + + if ($planetCollection->count() !== 1) { + return $this; + } + + $planet = $planetCollection->current(); + } + + if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) { + return $this; + } + + $this->setData('current_planet', $planet->getId())->save(); + + return $this; + } + + /** + * + * Enter description here ... + * @param Wootook_Empire_Model_Planet $planet + */ + public function setHomePlanet(Wootook_Empire_Model_Planet $planet) + { + if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) { + return $this; + } + + $this->setData('id_planet', $planet->getId()); + $this->_homePlanet = $planet; + + return $this; + } + + /** + * + * Enter description here ... + * @param Wootook_Empire_Model_Planet $planet + */ + public function setCurrentPlanet(Wootook_Empire_Model_Planet $planet) + { + if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) { + return $this; + } + + $this->setData('current_planet', $planet->getId()); + $this->_currentPlanet = $planet; + + return $this; + } + + /** + * + * Enter description here ... + * @return Wootook_Empire_Model_Planet + */ + public function getHomePlanet() + { + if ($this->_homePlanet === null) { + $planetId = $this->getData('id_planet'); + if (!$planetId) { + return null; + } + + $planet = Wootook_Empire_Model_Planet::factory($planetId); + + if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) { + return null; + } + + $this->_homePlanet = $planet; + } + + return $planet; + } + + /** + * + * Enter description here ... + * @return Wootook_Empire_Model_Planet + */ + public function getCurrentPlanet() + { + if ($this->_currentPlanet === null) { + $planetId = $this->getData('current_planet'); + + if (!$planetId) { + $this->_currentPlanet = $this->getHomePlanet(); + $this->setData('current_planet', $this->_currentPlanet->getId())->save(); + + return $this->_currentPlanet; + } + + $planet = Wootook_Empire_Model_Planet::factory($planetId); + + if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) { + $this->_currentPlanet = $this->getHomePlanet(); + $this->setData('current_planet', $this->_currentPlanet->getId())->save(); + + return $this->_currentPlanet; + } + + $this->_currentPlanet = $planet; + } + + return $this->_currentPlanet; + } + + protected function _preparePlanetCollection() + { + $planetCollection = new Wootook_Core_Collection(array('planet' => 'planets'), 'Wootook_Empire_Model_Planet'); + $planetCollection->where('id_owner=:user'); + + $order = ($this->getData('planet_sort_order') == 1) ? 'DESC' : 'ASC'; + + switch ($this->getData('planet_sort')) { + case self::PLANET_SORT_POSITION: + $planetCollection + ->order('planet.galaxy', $order) + ->order('planet.system', $order) + ->order('planet.planet', $order) + ->order('planet.planet_type', $order) + ; + break; + + case self::PLANET_SORT_NAME: + $planetCollection->order('planet.name', $order); + break; + + case self::PLANET_SORT_DATE: + default: + $planetCollection->order('planet.id', $order); + break; + } + return $planetCollection; + } + + public function getPlanetCollection() + { + $planetCollection = $this->_preparePlanetCollection(); + + $planetCollection->load(array( + 'user' => $this->getId() + )); + + return $planetCollection; + } + + protected function _prepareFleetCollection() + { + $collection = new Wootook_Core_Collection(array('fleet' => 'fleets')); + $collection + ->setEntityClassName('Wootook_Empire_Model_Fleet') + ->where('fleet_owner <= :user_id') + ; + return $collection; + } + + public function getFleets() + { + return $this->_prepareFleetCollection()->load(array('user_id' => $this->getId())); + } + + public function getFleetCount() + { + return $this->_prepareFleetCollection()->getSize(array('user_id' => $this->getId())); + } + + public function getVisibleFleets() + { + + $user = Wootook_Empire_Model_User::getSingleton(); + $firstCollection = new Wootook_Core_Collection(array('fleet' => 'fleets')); + $firstCollection +// ->column('*') + ->column('fleet.fleet_start_galaxy', 'galaxy') + ->column('fleet.fleet_start_system', 'system') + ->column('fleet.fleet_start_planet', 'planet') + ->column('fleet.fleet_start_type', 'planet_type') + ->where('fleet_end_time <= :now') + ; + $backCollection = new Wootook_Core_Collection(array('fleet' => 'fleets')); + $backCollection +// ->column('*') + ->column('fleet.fleet_end_galaxy', 'galaxy') + ->column('fleet.fleet_end_system', 'system') + ->column('fleet.fleet_end_planet', 'planet') + ->column('fleet.fleet_end_type', 'planet_type') + ->where('fleet_end_time <= :now') + ; + $collection = new Wootook_Core_Collection(); + $collection + ->setEntityClassName('Wootook_Empire_Model_Fleet') + ->union($firstCollection) + ->union($backCollection) + ->load(array('now' => time())); + + return $collection; + } + + public function getElement($elementId) + { + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); + + return $this->getData($fields[$elementId]); + } + + public function setElement($elementId, $level) + { + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); + + return $this->setData($fields[$elementId], $level); + } + + public function hasElement($elementId, $levelRequired = 0) + { + $fields = Wootook_Empire_Model_Game_FieldsAlias::getSingleton(); + + return $this->hasData($fields[$elementId]) && Math::comp($this->getElement($elementId), $levelRequired) > 0; + } + + public function getSkinPath($default = null) + { + if ($path = $this->getData('dpath')) { + return $path; + } + return $default; + } + + public function setSkinPath($path) + { + $this->setData('dpath', $path); + + return $this; + } + + public function checkPassword($password) + { + if (self::hash($password) == $this->getData('password')) { + return true; + } + return false; + } + + public function getFleetCollection($time = null) + { + $firstCollection = new Wootook_Core_Collection(array('fleet' => 'fleets')); + $firstCollection + ->column('*') + ->where('fleet.fleet_owner = :user') + ; + $backCollection = new Wootook_Core_Collection(array('fleet' => 'fleets')); + $backCollection + ->column('*') + ->where('fleet.fleet_target_owner = :user') + ; + + $options = array( + 'user' => $this->getId() + ); + + if ($time !== null) { + $options['now'] = $time; + $firstCollection->where('fleet_start_time <= :now'); + $backCollection->where('fleet_end_time <= :now'); + } + + $collection = new Wootook_Core_Collection(); + $collection + ->setEntityClassName('Wootook_Empire_Model_Fleet') + ->union($firstCollection) + ->union($backCollection) + ->load($options) + ; + + return $collection; + } + + public function getNewMessagesCount() + { + $messageCollection = new Wootook_Core_Collection('messages'); + $messageCollection->where('message_owner=:user'); + $messageCollection->where('message_read_at<=0'); + + $newMessages = null; + if (($count = $messageCollection->getSize(array('user' => $this->getId()))) > 0) { + return $count; + } + return null; + } +} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Player/Model/Message.php b/application/code/core/Wootook/Empire/Model/User/Message.php similarity index 59% rename from src/application/code/core/Wootook/Player/Model/Message.php rename to application/code/core/Wootook/Empire/Model/User/Message.php index 0002d94..80241ef 100644 --- a/src/application/code/core/Wootook/Player/Model/Message.php +++ b/application/code/core/Wootook/Empire/Model/User/Message.php @@ -1,14 +1,14 @@ _tableName = 'messages'; $this->_idFieldNames = array('message_id', 'message_owner'); } -} +} \ No newline at end of file diff --git a/application/code/core/Wootook/Exception.php b/application/code/core/Wootook/Exception.php new file mode 100644 index 0000000..b20ebf1 --- /dev/null +++ b/application/code/core/Wootook/Exception.php @@ -0,0 +1,3 @@ + - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ -/** - * - * Enter description here ... - * @author Greg - * - */ class Wootook_Object implements ArrayAccess { @@ -113,4 +79,4 @@ class Wootook_Object { return $this->unsetData($offset); } -} +} \ No newline at end of file diff --git a/src/application/code/libraries/Math.php b/application/code/libraries/Math.php similarity index 99% rename from src/application/code/libraries/Math.php rename to application/code/libraries/Math.php index f429008..7ea2d08 100644 --- a/src/application/code/libraries/Math.php +++ b/application/code/libraries/Math.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/libraries/Math/Bcmath.php b/application/code/libraries/Math/Bcmath.php similarity index 99% rename from src/application/code/libraries/Math/Bcmath.php rename to application/code/libraries/Math/Bcmath.php index e5368c6..bbf9b45 100644 --- a/src/application/code/libraries/Math/Bcmath.php +++ b/application/code/libraries/Math/Bcmath.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/libraries/Math/Native.php b/application/code/libraries/Math/Native.php similarity index 98% rename from src/application/code/libraries/Math/Native.php rename to application/code/libraries/Math/Native.php index 0958113..300d8e7 100644 --- a/src/application/code/libraries/Math/Native.php +++ b/application/code/libraries/Math/Native.php @@ -3,7 +3,7 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/agpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * * Copyright (c) 2011-Present, Grégory PLANCHAT * All rights reserved. diff --git a/src/application/code/community/.placeholder b/application/code/local/.placeholder similarity index 100% rename from src/application/code/community/.placeholder rename to application/code/local/.placeholder diff --git a/application/code/local/ga.js b/application/code/local/ga.js new file mode 100644 index 0000000..9b28dfa --- /dev/null +++ b/application/code/local/ga.js @@ -0,0 +1,27 @@ +var _gaq = _gaq || []; + +(function()){ + var trackErrorThroughEvent = function(exception, f) { + _gaq.push(['_trackEvent', + 'JS ERROR: '+ (f || 'native') + ' (nav:'+ navigator.userAgent +') Exception: '+ (exception.name || 'Error'), + exception.message || exception, + ' url: '+document.location.href+' referer: '+ document.referrer + ]); + }; + + var outLink = function(link){ + var _gA = link.href.split('/'); + var _gS = link.href.split('#'); + + var _gT = '/out-link/' + _gA[2] + '/?d=' + _gS[0]; + _gaq.push(['_trackPageview',_gT]); + _gaq.push(function() { + try { + setTimeout('window.open(_gat._getTrackerByName()._getLinkerUrl(\'' + lien.href + '\',false),\'_blank\')', 100); + } catch(err) { + window.open(lien.href, '_blank'); /* préserve le fonctionnement du lien href en cas de pb */ + trackErrorThroughEvent(err,'lienSortant : '+lien.href ); + } + }); + } +})(); \ No newline at end of file diff --git a/src/application/code/test/Legacies/Core/LayoutTest.php b/application/code/test/Legacies/Core/LayoutTest.php similarity index 100% rename from src/application/code/test/Legacies/Core/LayoutTest.php rename to application/code/test/Legacies/Core/LayoutTest.php diff --git a/src/application/code/test/Legacies/Empire/Model/BuilderTest.php b/application/code/test/Legacies/Empire/Model/BuilderTest.php similarity index 100% rename from src/application/code/test/Legacies/Empire/Model/BuilderTest.php rename to application/code/test/Legacies/Empire/Model/BuilderTest.php diff --git a/src/application/code/test/Legacies/ObjectTest.php b/application/code/test/Legacies/ObjectTest.php similarity index 100% rename from src/application/code/test/Legacies/ObjectTest.php rename to application/code/test/Legacies/ObjectTest.php diff --git a/src/application/code/test/WootookTest.php b/application/code/test/LegaciesTest.php similarity index 99% rename from src/application/code/test/WootookTest.php rename to application/code/test/LegaciesTest.php index 8962684..d230e54 100644 --- a/src/application/code/test/WootookTest.php +++ b/application/code/test/LegaciesTest.php @@ -1,6 +1,6 @@ array( + 'update' => '2columns-left', + 'reference' => array( + 'navigation' => array( + 'actions' => array( + array( + 'method' => 'setNodeTitle', + 'params' => array( + 'path' => 'development', + 'title' => 'Development' + ) + ), + array( + 'method' => 'addLink', + 'params' => array( + 'name' => 'development/overview', + 'label' => 'Overview', + 'title' => 'Overview', + 'uri' => 'overview.php' + ) + ), + array( + 'method' => 'addLink', + 'params' => array( + 'name' => 'development/buildings', + 'label' => 'Buildings', + 'title' => 'Buildings', + 'uri' => 'overview.php' + ) + ), + array( + 'method' => 'addLink', + 'params' => array( + 'name' => 'development/research-lab', + 'label' => 'Research Lab', + 'title' => 'Research Lab', + 'uri' => 'overview.php', + 'params' => array( + 'mode' => 'research' + ) + ) + ), + array( + 'method' => 'addLink', + 'params' => array( + 'name' => 'development/shipyard', + 'label' => 'Shipyard', + 'title' => 'Shipyard', + 'uri' => 'overview.php', + 'params' => array( + 'mode' => 'fleet' + ) + ) + ), + array( + 'method' => 'addLink', + 'params' => array( + 'name' => 'development/defenses', + 'label' => 'Defenses', + 'title' => 'Defenses', + 'uri' => 'overview.php', + 'params' => array( + 'mode' => 'defense' + ) + ) + ) + ) + ) + ) + ), + + 'overview' => array( + 'update' => 'empire', + 'reference' => array( + 'content' => array( + 'children' => array( + 'overview.forms' => array( + 'type' => 'core/concat' + ), + 'overview' => array( + 'type' => 'empire/overview', + 'template' => 'empire/overview.phtml' + ), + ) + ), + 'left' => array( + ) + ) + ), + + 'overview.rename-planet' => array( + 'update' => 'overview', + 'reference' => array( + 'overview.forms' => array( + 'children' => array( + 'rename-planet' => array( + 'type' => 'empire/overview.rename-planet', + 'template' => 'empire/overview/form/rename-planet.phtml' + ), + ) + ) + ) + ), + + 'overview.destroy-planet' => array( + 'update' => 'overview', + 'reference' => array( + 'overview.forms' => array( + 'children' => array( + 'destroy-planet' => array( + 'type' => 'empire/overview.destroy-planet', + 'template' => 'empire/overview/form/destroy-planet.phtml' + ), + ) + ) + ) + ), + + 'planet.buildings' => array( + 'update' => 'empire', + 'reference' => array( + 'content' => array( + 'children' => array( + 'topnav' => array( + 'type' => 'empire/topnav', + 'template' => 'empire/topnav.phtml', + ), + 'queue' => array( + 'type' => 'empire/planet.buildings.queue', + 'template' => 'empire/planet/buildings/queue.phtml', + 'actions' => array( + array( + 'method' => 'setItemTemplate', + 'params' => array( + 'template' => 'empire/planet/buildings/queue/item.phtml' + ) + ), + array( + 'method' => 'setItemBlockType', + 'params' => array( + 'blockType' => 'empire/planet.buildings.queue.item' + ) + ) + ) + ), + 'item-list' => array( + 'type' => 'empire/planet.buildings', + 'template' => 'empire/planet/buildings.phtml', + 'children' => array( + 'item-list.items' => array( + 'type' => 'core/concat' + ), + ), + 'actions' => array( + array( + 'method' => 'setItemTemplate', + 'params' => array( + 'template' => 'empire/planet/buildings/item.phtml' + ) + ), + array( + 'method' => 'setItemBlockType', + 'params' => array( + 'blockType' => 'empire/planet.buildings.item' + ) + ) + ) + ), + ) + ) + ) + ), + + 'planet.shipyard' => array( + 'update' => 'empire', + 'reference' => array( + 'content' => array( + 'children' => array( + 'topnav' => array( + 'type' => 'empire/topnav', + 'template' => 'empire/topnav.phtml', + ), + 'item-list' => array( + 'type' => 'legacies_empire/planet.shipyard', + 'template' => 'empire/planet/shipyard.phtml', + 'children' => array( + 'item-list.items' => array( + 'type' => 'core/concat' + ), + ), + 'actions' => array( + array( + 'method' => 'setItemTemplate', + 'params' => array( + 'template' => 'empire/planet/shipyard/item.phtml' + ) + ), + array( + 'method' => 'setItemBlockType', + 'params' => array( + 'blockType' => 'legacies_empire/planet.shipyard.item' + ) + ), + ) + ), + 'queue' => array( + 'type' => 'legacies_empire/planet.shipyard.queue', + 'template' => 'empire/planet/shipyard/queue.phtml', + 'actions' => array( + array( + 'method' => 'setItemTemplate', + 'params' => array( + 'template' => 'empire/planet/shipyard/queue/item.phtml' + ) + ), + array( + 'method' => 'setItemBlockType', + 'params' => array( + 'blockType' => 'legacies_empire/planet.shipyard.queue.item' + ) + ) + ) + ), + ) + ) + ) + ), + + 'planet.defense' => array( + 'update' => 'planet.shipyard', + 'reference' => array( + 'item-list' => array( + 'actions' => array( + array( + 'method' => 'setType', + 'params' => array( + 'type' => Legacies_Empire::TYPE_DEFENSE + ) + ) + ) + ) + ) + ), + + 'planet.research-lab' => array( + 'update' => 'empire', + 'reference' => array( + 'content' => array( + 'children' => array( + 'topnav' => array( + 'type' => 'empire/topnav', + 'template' => 'empire/topnav.phtml', + ), + 'item-list' => array( + 'type' => 'legacies_empire/planet.research-lab', + 'template' => 'empire/planet/research-lab.phtml', + 'children' => array( + 'item-list.items' => array( + 'type' => 'core/concat' + ), + ), + 'actions' => array( + array( + 'method' => 'setItemTemplate', + 'params' => array( + 'template' => 'empire/planet/research-lab/item.phtml' + ) + ), + array( + 'method' => 'setItemBlockType', + 'params' => array( + 'blockType' => 'legacies_empire/planet.research-lab.item' + ) + ), + ) + ), + 'queue' => array( + 'type' => 'legacies_empire/planet.research-lab.queue', + 'template' => 'empire/planet/research-lab/queue.phtml', + 'actions' => array( + array( + 'method' => 'setItemTemplate', + 'params' => array( + 'template' => 'empire/planet/research-lab/queue/item.phtml' + ) + ), + array( + 'method' => 'setItemBlockType', + 'params' => array( + 'blockType' => 'legacies_empire/planet.research-lab.queue.item' + ) + ) + ) + ) + ) + ) + ) + ) + ); diff --git a/application/design/base/default/layouts/page.php b/application/design/base/default/layouts/page.php new file mode 100644 index 0000000..df732a1 --- /dev/null +++ b/application/design/base/default/layouts/page.php @@ -0,0 +1,206 @@ + array( + 'update' => 'default' + ), + + '2columns-left' => array( + 'update' => 'default', + 'template' => 'page/2columns-left.phtml', + 'reference' => array( + 'root' => array( + 'children' => array( + 'left' => array( + 'type' => 'core/concat', + 'children' => array( + 'navigation' => array( + 'type' => 'core/html.navigation', + 'template' => 'page/html/navigation.phtml' + ) + ) + ) + ) + ) + ) + ), + + '2columns-right' => array( + 'update' => 'default', + 'template' => 'page/2columns-right.phtml', + 'reference' => array( + 'root' => array( + 'children' => array( + 'right' => array( + 'type' => 'core/concat' + ), + ) + ) + ) + ), + + '3columns' => array( + 'update' => 'default', + 'template' => 'page/3columns.phtml', + 'reference' => array( + 'root' => array( + 'children' => array( + 'left' => array( + 'type' => 'core/concat' + ), + 'right' => array( + 'type' => 'core/concat' + ), + ) + ) + ) + ), + + 'default' => array( + 'type' => 'core/html.page', + 'template' => 'page/1column.phtml', + 'children' => array( + 'head' => array( + 'type' => 'core/html.head', + 'template' => 'page/html/head.phtml', + 'actions' => array( + array( + 'method' => 'addCss', + 'params' => array( + 'stylesheet' => 'css/deprecated/default.css' + ) + ), + array( + 'method' => 'addCss', + 'params' => array( + 'stylesheet' => 'css/deprecated/formate.css' + ) + ), + array( + 'method' => 'addCss', + 'params' => array( + 'stylesheet' => 'css/legacies.css' + ) + ) + ) + ), + 'header' => array( + 'type' => 'core/template', + 'template' => 'page/html/header.phtml', + 'children' => array( + 'menu' => array( + 'type' => 'core/html.navigation', + 'template' => 'page/html/navigation.phtml', + ), + 'planet-list' => array( + 'type' => 'empire/planet-list', + 'template' => 'empire/planet-list.phtml', + ) + ) + ), + 'footer' => array( + 'type' => 'core/template', + 'template' => 'page/html/footer.phtml' + ), + 'content' => array( + 'type' => 'core/concat' + ) + ) + ), + + 'ajax' => array( + 'type' => 'core/html.page', + 'template' => 'page/empty.phtml', + 'children' => array( + 'content' => array( + 'type' => 'core/concat' + ) + ) + ), + + 'empty' => array( + 'type' => 'core/html.page', + 'template' => 'page/empty.phtml', + 'children' => array( + 'head' => array( + 'type' => 'core/html.head', + 'template' => 'page/html/head.phtml' + ), + 'content' => array( + 'type' => 'core/concat' + ) + ) + ), + + 'message' => array( + 'update' => 'default', + 'reference' => array( + 'content' => array( + 'children' => array( + 'message' => array( + 'type' => 'core/template', + 'template' => 'page/html/message.phtml' + ), + ) + ) + ) + ), + + 'login' => array( + 'update' => '1column', + 'reference' => array( + 'content' => array( + 'children' => array( + 'login' => array( + 'type' => 'core/template', + 'template' => 'user/login.phtml' + ), + ) + ), + 'head' => array( + 'actions' => array( + array( + 'method' => 'addCss', + 'params' => array( + 'stylesheet' => 'css/deprecated/styles.css' + ) + ), + array( + 'method' => 'addCss', + 'params' => array( + 'stylesheet' => 'css/deprecated/about.css' + ) + ) + ) + ) + ) + ), + + 'registration' => array( + 'update' => '1column', + 'reference' => array( + 'content' => array( + 'children' => array( + 'registration' => array( + 'type' => 'core/template', + 'template' => 'user/registration.phtml' + ), + ) + ), + 'head' => array( + 'actions' => array( + array( + 'method' => 'addCss', + 'params' => array( + 'stylesheet' => 'css/deprecated/styles.css' + ) + ), + array( + 'method' => 'addCss', + 'params' => array( + 'stylesheet' => 'css/deprecated/about.css' + ) + ) + ) + ) + ) + ) + ); diff --git a/src/application/design/frontend/base/default/scripts/deprecated/add_declare.tpl b/application/design/base/default/scripts/deprecated/add_declare.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/add_declare.tpl rename to application/design/base/default/scripts/deprecated/add_declare.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/activeplanet_body.tpl b/application/design/base/default/scripts/deprecated/admin/activeplanet_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/activeplanet_body.tpl rename to application/design/base/default/scripts/deprecated/admin/activeplanet_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/add_money.tpl b/application/design/base/default/scripts/deprecated/admin/add_money.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/add_money.tpl rename to application/design/base/default/scripts/deprecated/admin/add_money.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/add_moon.tpl b/application/design/base/default/scripts/deprecated/admin/add_moon.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/add_moon.tpl rename to application/design/base/default/scripts/deprecated/admin/add_moon.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_asw1.tpl b/application/design/base/default/scripts/deprecated/admin/admin_panel_asw1.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_asw1.tpl rename to application/design/base/default/scripts/deprecated/admin/admin_panel_asw1.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_asw2.tpl b/application/design/base/default/scripts/deprecated/admin/admin_panel_asw2.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_asw2.tpl rename to application/design/base/default/scripts/deprecated/admin/admin_panel_asw2.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_frm1.tpl b/application/design/base/default/scripts/deprecated/admin/admin_panel_frm1.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_frm1.tpl rename to application/design/base/default/scripts/deprecated/admin/admin_panel_frm1.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_frm2.tpl b/application/design/base/default/scripts/deprecated/admin/admin_panel_frm2.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_frm2.tpl rename to application/design/base/default/scripts/deprecated/admin/admin_panel_frm2.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_frm3.tpl b/application/design/base/default/scripts/deprecated/admin/admin_panel_frm3.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_frm3.tpl rename to application/design/base/default/scripts/deprecated/admin/admin_panel_frm3.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_frm4.tpl b/application/design/base/default/scripts/deprecated/admin/admin_panel_frm4.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_frm4.tpl rename to application/design/base/default/scripts/deprecated/admin/admin_panel_frm4.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_main.tpl b/application/design/base/default/scripts/deprecated/admin/admin_panel_main.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/admin_panel_main.tpl rename to application/design/base/default/scripts/deprecated/admin/admin_panel_main.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/banadni.tpl b/application/design/base/default/scripts/deprecated/admin/banadni.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/banadni.tpl rename to application/design/base/default/scripts/deprecated/admin/banadni.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/banned.tpl b/application/design/base/default/scripts/deprecated/admin/banned.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/banned.tpl rename to application/design/base/default/scripts/deprecated/admin/banned.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/changepass.tpl b/application/design/base/default/scripts/deprecated/admin/changepass.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/changepass.tpl rename to application/design/base/default/scripts/deprecated/admin/changepass.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/chat_body.tpl b/application/design/base/default/scripts/deprecated/admin/chat_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/chat_body.tpl rename to application/design/base/default/scripts/deprecated/admin/chat_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/credit_body.tpl b/application/design/base/default/scripts/deprecated/admin/credit_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/credit_body.tpl rename to application/design/base/default/scripts/deprecated/admin/credit_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/declarelist_body.tpl b/application/design/base/default/scripts/deprecated/admin/declarelist_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/declarelist_body.tpl rename to application/design/base/default/scripts/deprecated/admin/declarelist_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/declarelist_rows.tpl b/application/design/base/default/scripts/deprecated/admin/declarelist_rows.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/declarelist_rows.tpl rename to application/design/base/default/scripts/deprecated/admin/declarelist_rows.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/deletuser.tpl b/application/design/base/default/scripts/deprecated/admin/deletuser.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/deletuser.tpl rename to application/design/base/default/scripts/deprecated/admin/deletuser.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/errors_body.tpl b/application/design/base/default/scripts/deprecated/admin/errors_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/errors_body.tpl rename to application/design/base/default/scripts/deprecated/admin/errors_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/exec_query.tpl b/application/design/base/default/scripts/deprecated/admin/exec_query.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/exec_query.tpl rename to application/design/base/default/scripts/deprecated/admin/exec_query.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/fleet_body.tpl b/application/design/base/default/scripts/deprecated/admin/fleet_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/fleet_body.tpl rename to application/design/base/default/scripts/deprecated/admin/fleet_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/fleet_rows.tpl b/application/design/base/default/scripts/deprecated/admin/fleet_rows.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/fleet_rows.tpl rename to application/design/base/default/scripts/deprecated/admin/fleet_rows.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/left_menu.tpl b/application/design/base/default/scripts/deprecated/admin/left_menu.tpl similarity index 97% rename from src/application/design/backend/base/default/scripts/deprecated/admin/left_menu.tpl rename to application/design/base/default/scripts/deprecated/admin/left_menu.tpl index 9cc9100..6955190 100644 --- a/src/application/design/backend/base/default/scripts/deprecated/admin/left_menu.tpl +++ b/application/design/base/default/scripts/deprecated/admin/left_menu.tpl @@ -78,7 +78,7 @@ parent.frames['Hauptframe'].location.replace("overview.php"); - + diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/md5enc.tpl b/application/design/base/default/scripts/deprecated/admin/md5enc.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/md5enc.tpl rename to application/design/base/default/scripts/deprecated/admin/md5enc.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/message_body.tpl b/application/design/base/default/scripts/deprecated/admin/message_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/message_body.tpl rename to application/design/base/default/scripts/deprecated/admin/message_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/messagelist_body.tpl b/application/design/base/default/scripts/deprecated/admin/messagelist_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/messagelist_body.tpl rename to application/design/base/default/scripts/deprecated/admin/messagelist_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/messagelist_table_rows.tpl b/application/design/base/default/scripts/deprecated/admin/messagelist_table_rows.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/messagelist_table_rows.tpl rename to application/design/base/default/scripts/deprecated/admin/messagelist_table_rows.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/messall_body.tpl b/application/design/base/default/scripts/deprecated/admin/messall_body.tpl similarity index 51% rename from src/application/design/backend/base/default/scripts/deprecated/admin/messall_body.tpl rename to application/design/base/default/scripts/deprecated/admin/messall_body.tpl index b4b4fb8..cf4b14e 100644 --- a/src/application/design/backend/base/default/scripts/deprecated/admin/messall_body.tpl +++ b/application/design/base/default/scripts/deprecated/admin/messall_body.tpl @@ -3,13 +3,13 @@ - + - - + + diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/moonlist_body.tpl b/application/design/base/default/scripts/deprecated/admin/moonlist_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/moonlist_body.tpl rename to application/design/base/default/scripts/deprecated/admin/moonlist_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/multi_body.tpl b/application/design/base/default/scripts/deprecated/admin/multi_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/multi_body.tpl rename to application/design/base/default/scripts/deprecated/admin/multi_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/multi_rows.tpl b/application/design/base/default/scripts/deprecated/admin/multi_rows.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/multi_rows.tpl rename to application/design/base/default/scripts/deprecated/admin/multi_rows.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/options_body.tpl b/application/design/base/default/scripts/deprecated/admin/options_body.tpl similarity index 89% rename from src/application/design/backend/base/default/scripts/deprecated/admin/options_body.tpl rename to application/design/base/default/scripts/deprecated/admin/options_body.tpl index ecb278a..fb92f13 100644 --- a/src/application/design/backend/base/default/scripts/deprecated/admin/options_body.tpl +++ b/application/design/base/default/scripts/deprecated/admin/options_body.tpl @@ -102,17 +102,24 @@ - - + + - - - + + + + + + + + + + - + diff --git a/application/design/base/default/scripts/deprecated/admin/overview_body.tpl b/application/design/base/default/scripts/deprecated/admin/overview_body.tpl new file mode 100644 index 0000000..bcc3642 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/admin/overview_body.tpl @@ -0,0 +1,35 @@ +

+

getData('adm_ov_title')?>

+
__('General message')?>Message Général
Sujet
__('Content 0 / %1$d chars)', 5000)?>Texte (0 / 5000 Caractère)
__('Enable Google Analytics')?>getData('ga')?> type="checkbox" />getData('adm_opt_game_oth_chat')?>getData('chatframe')?> type="checkbox" />
__('Google Analytics Identifier')?>
getData('adm_opt_game_oth_adds')?>getData('googlead')?> type="checkbox" />
getData('adm_opt_game_debugmod')?>getData('debug')?> type="checkbox" />
getData('banner')?>
<?php echo $this->getData('banner_source_post')?>
+ + + + + + +
getData('adm_ov_infos')?>
getData('adm_ov_yourv')?>: getData('adm_ov_data_yourv')?>getData('adm_ov_lastv')?>: getData('adm_ov_here')?>
+
+ + + + + + + + + + + + + + + + + + + + getData('adm_ov_data_table')?> + + + +
getData('adm_ov_onlin')?>
getData('adm_ul_id')?>getData('adm_ul_name')?>getData('adm_ul_adip')?>getData('adm_ov_ally')?>getData('adm_ov_point')?>getData('adm_ov_activ')?>getData('usr_email')?>getData('xp_raid')?>getData('xp_min')?>getData('lang_vacancy')?>getData('banned_lang')?>getData('usr_current_planet')?>getData('usr_current_page')?>
getData('adm_ov_count')?>: getData('adm_ov_data_count')?>
\ No newline at end of file diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/overview_rows.tpl b/application/design/base/default/scripts/deprecated/admin/overview_rows.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/overview_rows.tpl rename to application/design/base/default/scripts/deprecated/admin/overview_rows.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/planetlist_body.tpl b/application/design/base/default/scripts/deprecated/admin/planetlist_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/planetlist_body.tpl rename to application/design/base/default/scripts/deprecated/admin/planetlist_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/reset_body.tpl b/application/design/base/default/scripts/deprecated/admin/reset_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/reset_body.tpl rename to application/design/base/default/scripts/deprecated/admin/reset_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/simple_header.tpl b/application/design/base/default/scripts/deprecated/admin/simple_header.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/simple_header.tpl rename to application/design/base/default/scripts/deprecated/admin/simple_header.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/unbanned.tpl b/application/design/base/default/scripts/deprecated/admin/unbanned.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/unbanned.tpl rename to application/design/base/default/scripts/deprecated/admin/unbanned.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/userlist_body.tpl b/application/design/base/default/scripts/deprecated/admin/userlist_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/userlist_body.tpl rename to application/design/base/default/scripts/deprecated/admin/userlist_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/userlist_rows.tpl b/application/design/base/default/scripts/deprecated/admin/userlist_rows.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/userlist_rows.tpl rename to application/design/base/default/scripts/deprecated/admin/userlist_rows.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/variables_body.tpl b/application/design/base/default/scripts/deprecated/admin/variables_body.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/variables_body.tpl rename to application/design/base/default/scripts/deprecated/admin/variables_body.tpl diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/variables_rows.tpl b/application/design/base/default/scripts/deprecated/admin/variables_rows.tpl similarity index 100% rename from src/application/design/backend/base/default/scripts/deprecated/admin/variables_rows.tpl rename to application/design/base/default/scripts/deprecated/admin/variables_rows.tpl diff --git a/application/design/base/default/scripts/deprecated/agreement.tpl b/application/design/base/default/scripts/deprecated/agreement.tpl new file mode 100644 index 0000000..44c2012 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/agreement.tpl @@ -0,0 +1 @@ +N/A \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin.tpl b/application/design/base/default/scripts/deprecated/alliance_admin.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin.tpl diff --git a/application/design/base/default/scripts/deprecated/alliance_admin_laws.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_laws.tpl new file mode 100644 index 0000000..2935d69 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/alliance_admin_laws.tpl @@ -0,0 +1,70 @@ +
+ + +getData('list')?> + + +
getData('Configure_laws')?>
+ +
+ +
+ + + + + + + + + + + + +
getData('Range_make')?>
getData('Range_name')?>
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
getData('Law_leyends')?>
getData('Alliance_dissolve')?>
getData('Expel_users')?>
getData('See_the_requests')?>
getData('See_the_list_members')?>
getData('Check_the_requests')?>
getData('Alliance_admin')?>
getData('See_the_online_list_member')?>
getData('Make_a_circular_message')?>
getData('Left_hand_text')?>
getData('Return_to_overview')?>
+ \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws_feet.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_laws_feet.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws_feet.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_laws_feet.tpl diff --git a/application/design/base/default/scripts/deprecated/alliance_admin_laws_head.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_laws_head.tpl new file mode 100644 index 0000000..131303d --- /dev/null +++ b/application/design/base/default/scripts/deprecated/alliance_admin_laws_head.tpl @@ -0,0 +1,15 @@ +
+
+ + + getData('Range_name')?> + + + + + + + + + + diff --git a/application/design/base/default/scripts/deprecated/alliance_admin_laws_row.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_laws_row.tpl new file mode 100644 index 0000000..014a5c6 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/alliance_admin_laws_row.tpl @@ -0,0 +1,16 @@ +
+ + getData('delete')?> +  getData('r0')?>  + + getData('r1')?> + getData('r2')?> + getData('r3')?> + getData('r4')?> + getData('r5')?> + getData('r6')?> + getData('r7')?> + getData('r8')?> + getData('r9')?> + + \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_members_function.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_members_function.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_members_function.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_members_function.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_members_row.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_members_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_members_row.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_members_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_members_row_edit.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_members_row_edit.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_members_row_edit.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_members_row_edit.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_members_table.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_members_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_members_table.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_members_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_rename.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_rename.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_rename.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_rename.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_rename1.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_rename1.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_rename1.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_rename1.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_rename2.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_rename2.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_rename2.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_rename2.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_request_form.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_request_form.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_request_form.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_request_form.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_request_row.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_request_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_request_row.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_request_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_request_table.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_request_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_request_table.tpl rename to application/design/base/default/scripts/deprecated/alliance_admin_request_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_ainfo.tpl b/application/design/base/default/scripts/deprecated/alliance_ainfo.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_ainfo.tpl rename to application/design/base/default/scripts/deprecated/alliance_ainfo.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_apply_waitform.tpl b/application/design/base/default/scripts/deprecated/alliance_apply_waitform.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_apply_waitform.tpl rename to application/design/base/default/scripts/deprecated/alliance_apply_waitform.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_applyform.tpl b/application/design/base/default/scripts/deprecated/alliance_applyform.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_applyform.tpl rename to application/design/base/default/scripts/deprecated/alliance_applyform.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_circular.tpl b/application/design/base/default/scripts/deprecated/alliance_circular.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_circular.tpl rename to application/design/base/default/scripts/deprecated/alliance_circular.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_circular_form.tpl b/application/design/base/default/scripts/deprecated/alliance_circular_form.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_circular_form.tpl rename to application/design/base/default/scripts/deprecated/alliance_circular_form.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_defaultmenu.tpl b/application/design/base/default/scripts/deprecated/alliance_defaultmenu.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_defaultmenu.tpl rename to application/design/base/default/scripts/deprecated/alliance_defaultmenu.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_frontpage.tpl b/application/design/base/default/scripts/deprecated/alliance_frontpage.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_frontpage.tpl rename to application/design/base/default/scripts/deprecated/alliance_frontpage.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_make.tpl b/application/design/base/default/scripts/deprecated/alliance_make.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_make.tpl rename to application/design/base/default/scripts/deprecated/alliance_make.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_makeform.tpl b/application/design/base/default/scripts/deprecated/alliance_makeform.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_makeform.tpl rename to application/design/base/default/scripts/deprecated/alliance_makeform.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_memberslist_row.tpl b/application/design/base/default/scripts/deprecated/alliance_memberslist_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_memberslist_row.tpl rename to application/design/base/default/scripts/deprecated/alliance_memberslist_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_memberslist_table.tpl b/application/design/base/default/scripts/deprecated/alliance_memberslist_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_memberslist_table.tpl rename to application/design/base/default/scripts/deprecated/alliance_memberslist_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_searchform.tpl b/application/design/base/default/scripts/deprecated/alliance_searchform.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_searchform.tpl rename to application/design/base/default/scripts/deprecated/alliance_searchform.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_searchresult_row.tpl b/application/design/base/default/scripts/deprecated/alliance_searchresult_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_searchresult_row.tpl rename to application/design/base/default/scripts/deprecated/alliance_searchresult_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_searchresult_table.tpl b/application/design/base/default/scripts/deprecated/alliance_searchresult_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/alliance_searchresult_table.tpl rename to application/design/base/default/scripts/deprecated/alliance_searchresult_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/banned_body.tpl b/application/design/base/default/scripts/deprecated/banned_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/banned_body.tpl rename to application/design/base/default/scripts/deprecated/banned_body.tpl diff --git a/application/design/base/default/scripts/deprecated/buildings_builds.tpl b/application/design/base/default/scripts/deprecated/buildings_builds.tpl new file mode 100644 index 0000000..d6085b8 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_builds.tpl @@ -0,0 +1,15 @@ +
+
+getData('BuildListScript')?> + + getData('BuildList')?> + + + + + getData('BuildingsList')?> +
getData('bld_usedcells')?> + getData('planet_field_current')?> / getData('planet_field_max')?> getData('bld_theyare')?> getData('field_libre')?> getData('bld_cellfree')?> +
+
+
\ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_builds_queue_script.tpl b/application/design/base/default/scripts/deprecated/buildings_builds_queue_script.tpl new file mode 100644 index 0000000..7d042ac --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_builds_queue_script.tpl @@ -0,0 +1,107 @@ + +
+ + +
+
+ + + + + + + + + + +
getData('work_todo')?>
+ +getData('total_left_time')?> + +getData('pretty_time_b_hangar')?> +
+
\ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_builds_row.tpl b/application/design/base/default/scripts/deprecated/buildings_builds_row.tpl new file mode 100644 index 0000000..86c0f05 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_builds_row.tpl @@ -0,0 +1,15 @@ + + + + + + + + getData('n')?>getData('nivel')?>
+ getData('descriptions')?>
+ getData('price')?> + getData('time')?> + getData('rest_price')?> + + getData('click')?> + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_builds_script.tpl b/application/design/base/default/scripts/deprecated/buildings_builds_script.tpl new file mode 100644 index 0000000..480c5dd --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_builds_script.tpl @@ -0,0 +1,8 @@ + +
\ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_defense.tpl b/application/design/base/default/scripts/deprecated/buildings_defense.tpl new file mode 100644 index 0000000..ee402c5 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_defense.tpl @@ -0,0 +1,19 @@ +
+
+ + + + + +
+
+ + getData('buildlist')?> + + + +
+
+
+getData('buildinglist')?> +
\ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_fleet.tpl b/application/design/base/default/scripts/deprecated/buildings_fleet.tpl new file mode 100644 index 0000000..0ab1b2f --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_fleet.tpl @@ -0,0 +1,19 @@ +
+
+ + + + + +
+
+ + getData('buildlist')?> + + + +
+
+
+getData('buildinglist')?> +
\ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_research.tpl b/application/design/base/default/scripts/deprecated/buildings_research.tpl new file mode 100644 index 0000000..080cc49 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_research.tpl @@ -0,0 +1,15 @@ +
+getData('noresearch')?> +
+ + + + +
+ + + getData('technolist')?> + +
+
+
\ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_research_row.tpl b/application/design/base/default/scripts/deprecated/buildings_research_row.tpl new file mode 100644 index 0000000..a7247a3 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_research_row.tpl @@ -0,0 +1,15 @@ + + + + + + + getData('tech_name')?> getData('tech_level')?>
getData('tech_descr')?>
+ getData('tech_price')?> + getData('search_time')?> + getData('tech_restp')?> + + + getData('tech_link')?> + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_research_script.tpl b/application/design/base/default/scripts/deprecated/buildings_research_script.tpl new file mode 100644 index 0000000..af1cb87 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_research_script.tpl @@ -0,0 +1,23 @@ +
+ \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/buildings_script.tpl b/application/design/base/default/scripts/deprecated/buildings_script.tpl new file mode 100644 index 0000000..9e251a6 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/buildings_script.tpl @@ -0,0 +1,39 @@ +
Production Actuelle: + +
+ \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/deprecated/changelog_body.tpl b/application/design/base/default/scripts/deprecated/changelog_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/changelog_body.tpl rename to application/design/base/default/scripts/deprecated/changelog_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/changelog_table.tpl b/application/design/base/default/scripts/deprecated/changelog_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/changelog_table.tpl rename to application/design/base/default/scripts/deprecated/changelog_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/chat_body.tpl b/application/design/base/default/scripts/deprecated/chat_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/chat_body.tpl rename to application/design/base/default/scripts/deprecated/chat_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/contact_body.tpl b/application/design/base/default/scripts/deprecated/contact_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/contact_body.tpl rename to application/design/base/default/scripts/deprecated/contact_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/contact_body_rows.tpl b/application/design/base/default/scripts/deprecated/contact_body_rows.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/contact_body_rows.tpl rename to application/design/base/default/scripts/deprecated/contact_body_rows.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/credit_body.tpl b/application/design/base/default/scripts/deprecated/credit_body.tpl similarity index 83% rename from src/application/design/frontend/base/default/scripts/deprecated/credit_body.tpl rename to application/design/base/default/scripts/deprecated/credit_body.tpl index 525309d..77c7886 100644 --- a/src/application/design/frontend/base/default/scripts/deprecated/credit_body.tpl +++ b/application/design/base/default/scripts/deprecated/credit_body.tpl @@ -6,7 +6,7 @@ getData('cred_link')?> getData('cred_site')?>:
getData('cred_forum')?>: - www.xnova-ng.org
www.xnova-ng.org/forum + www.xnova-ng.org
www.xnova-ng.org/forum getData('cred_credit')?> @@ -18,4 +18,5 @@ UGamela
Britania getData('cred_based')?>
getData('cred_start')?> +getData('ExtCopyFrame')?> \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/deprecated/galaxy_body.tpl b/application/design/base/default/scripts/deprecated/galaxy_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/galaxy_body.tpl rename to application/design/base/default/scripts/deprecated/galaxy_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/galaxy_row.tpl b/application/design/base/default/scripts/deprecated/galaxy_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/galaxy_row.tpl rename to application/design/base/default/scripts/deprecated/galaxy_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_action.tpl b/application/design/base/default/scripts/deprecated/galaxy_row_action.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_action.tpl rename to application/design/base/default/scripts/deprecated/galaxy_row_action.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_ally.tpl b/application/design/base/default/scripts/deprecated/galaxy_row_ally.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_ally.tpl rename to application/design/base/default/scripts/deprecated/galaxy_row_ally.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_debris.tpl b/application/design/base/default/scripts/deprecated/galaxy_row_debris.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_debris.tpl rename to application/design/base/default/scripts/deprecated/galaxy_row_debris.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_luna.tpl b/application/design/base/default/scripts/deprecated/galaxy_row_luna.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_luna.tpl rename to application/design/base/default/scripts/deprecated/galaxy_row_luna.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_planet.tpl b/application/design/base/default/scripts/deprecated/galaxy_row_planet.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_planet.tpl rename to application/design/base/default/scripts/deprecated/galaxy_row_planet.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_user.tpl b/application/design/base/default/scripts/deprecated/galaxy_row_user.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/galaxy_row_user.tpl rename to application/design/base/default/scripts/deprecated/galaxy_row_user.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/gate_fleet_rows.tpl b/application/design/base/default/scripts/deprecated/gate_fleet_rows.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/gate_fleet_rows.tpl rename to application/design/base/default/scripts/deprecated/gate_fleet_rows.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/gate_fleet_table.tpl b/application/design/base/default/scripts/deprecated/gate_fleet_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/gate_fleet_table.tpl rename to application/design/base/default/scripts/deprecated/gate_fleet_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/imperium_row.tpl b/application/design/base/default/scripts/deprecated/imperium_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/imperium_row.tpl rename to application/design/base/default/scripts/deprecated/imperium_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/imperium_row2.tpl b/application/design/base/default/scripts/deprecated/imperium_row2.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/imperium_row2.tpl rename to application/design/base/default/scripts/deprecated/imperium_row2.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/imperium_table.tpl b/application/design/base/default/scripts/deprecated/imperium_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/imperium_table.tpl rename to application/design/base/default/scripts/deprecated/imperium_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/info_buildings_defense.tpl b/application/design/base/default/scripts/deprecated/info_buildings_defense.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/info_buildings_defense.tpl rename to application/design/base/default/scripts/deprecated/info_buildings_defense.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/info_buildings_destroy.tpl b/application/design/base/default/scripts/deprecated/info_buildings_destroy.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/info_buildings_destroy.tpl rename to application/design/base/default/scripts/deprecated/info_buildings_destroy.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/info_buildings_fleet.tpl b/application/design/base/default/scripts/deprecated/info_buildings_fleet.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/info_buildings_fleet.tpl rename to application/design/base/default/scripts/deprecated/info_buildings_fleet.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/info_buildings_general.tpl b/application/design/base/default/scripts/deprecated/info_buildings_general.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/info_buildings_general.tpl rename to application/design/base/default/scripts/deprecated/info_buildings_general.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/info_buildings_table.tpl b/application/design/base/default/scripts/deprecated/info_buildings_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/info_buildings_table.tpl rename to application/design/base/default/scripts/deprecated/info_buildings_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/info_officiers_general.tpl b/application/design/base/default/scripts/deprecated/info_officiers_general.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/info_officiers_general.tpl rename to application/design/base/default/scripts/deprecated/info_officiers_general.tpl diff --git a/application/design/base/default/scripts/deprecated/install/ins_acc.tpl b/application/design/base/default/scripts/deprecated/install/ins_acc.tpl new file mode 100644 index 0000000..990f8db --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_acc.tpl @@ -0,0 +1,44 @@ + + +
getData('ins_tx_acc1')?>
+getData('ins_tx_acc2')?>

+ + + + + + + + + + + + + + + + + + + + + +
getData('ins_acc_user')?>:
getData('ins_acc_pass')?>:
getData('ins_acc_email')?>:
getData('ins_acc_planet')?>:
getData('ins_acc_sex')?>:
+
+ + + + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/install/ins_acc_done.tpl b/application/design/base/default/scripts/deprecated/install/ins_acc_done.tpl new file mode 100644 index 0000000..2e14361 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_acc_done.tpl @@ -0,0 +1,9 @@ + + +
getData('ins_tx_done2')?>
+getData('ins_tx_done3')?>

+ + + + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/install/ins_body.tpl b/application/design/base/default/scripts/deprecated/install/ins_body.tpl new file mode 100644 index 0000000..295e294 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_body.tpl @@ -0,0 +1,28 @@ +

+ + + + + + + + +getData('ins_page')?> + +
getData('ins_appname')?>getData('ins_tx_sys')?>
getData('ins_tx_state')?> getData('ins_state')?>
+ + + + + + + + + + + + + + + +
getData('ins_mnu_intro')?>
getData('ins_mnu_inst')?>
getData('ins_mnu_goto')?>
getData('ins_mnu_upgr')?>
getData('ins_mnu_quit')?>
\ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/install/ins_form.tpl b/application/design/base/default/scripts/deprecated/install/ins_form.tpl new file mode 100644 index 0000000..9b3b364 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_form.tpl @@ -0,0 +1,33 @@ + + +
getData('ins_tx_inst1')?>
+getData('ins_tx_inst2')?>
+getData('ins_tx_inst3')?>

+ + + + + + + + + + + + + + + + + + + + + +
getData('ins_form_server')?>:
getData('ins_form_db')?>:
getData('ins_form_prefix')?>:
getData('ins_form_login')?>:
getData('ins_form_pass')?>:
+
+ + + + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/install/ins_form_done.tpl b/application/design/base/default/scripts/deprecated/install/ins_form_done.tpl new file mode 100644 index 0000000..3d9426d --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_form_done.tpl @@ -0,0 +1,8 @@ + + +

getData('ins_tx_done1')?>

+ + + + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/install/ins_goto_done.tpl b/application/design/base/default/scripts/deprecated/install/ins_goto_done.tpl new file mode 100644 index 0000000..55d1b13 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_goto_done.tpl @@ -0,0 +1,9 @@ + + +
getData('ins_tx_done4')?>
+getData('ins_tx_done3')?>

+ + + + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/install/ins_goto_form.tpl b/application/design/base/default/scripts/deprecated/install/ins_goto_form.tpl new file mode 100644 index 0000000..0539d11 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_goto_form.tpl @@ -0,0 +1,33 @@ + + +
getData('ins_tx_inst1')?>
+getData('ins_tx_goto4')?>
+getData('ins_tx_goto5')?>

+ + + + + + + + + + + + + + + + + + + + + +
getData('ins_form_server')?>:
getData('ins_form_db')?>:
getData('ins_form_prefix')?>:
getData('ins_form_login')?>:
getData('ins_form_pass')?>:
+
+ + + + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/install/ins_goto_intro.tpl b/application/design/base/default/scripts/deprecated/install/ins_goto_intro.tpl new file mode 100644 index 0000000..16c01e9 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_goto_intro.tpl @@ -0,0 +1,10 @@ + + +
getData('ins_tx_goto1')?>
+getData('ins_tx_goto2')?>
+getData('ins_tx_goto3')?>

+ + + + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/install/ins_intro.tpl b/application/design/base/default/scripts/deprecated/install/ins_intro.tpl new file mode 100644 index 0000000..fe25771 --- /dev/null +++ b/application/design/base/default/scripts/deprecated/install/ins_intro.tpl @@ -0,0 +1,11 @@ + + +
getData('ins_tx_welco')?>
+getData('ins_tx_intr1')?>
+getData('ins_tx_intr2')?>
+getData('ins_tx_intr3')?>

+ + + + + \ No newline at end of file diff --git a/application/design/base/default/scripts/deprecated/left_menu.tpl b/application/design/base/default/scripts/deprecated/left_menu.tpl new file mode 100644 index 0000000..1a5a0be --- /dev/null +++ b/application/design/base/default/scripts/deprecated/left_menu.tpl @@ -0,0 +1,97 @@ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/deprecated/lostpassword.tpl b/application/design/base/default/scripts/deprecated/lostpassword.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/lostpassword.tpl rename to application/design/base/default/scripts/deprecated/lostpassword.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/marchand_cristal.tpl b/application/design/base/default/scripts/deprecated/marchand_cristal.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/marchand_cristal.tpl rename to application/design/base/default/scripts/deprecated/marchand_cristal.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/marchand_deuterium.tpl b/application/design/base/default/scripts/deprecated/marchand_deuterium.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/marchand_deuterium.tpl rename to application/design/base/default/scripts/deprecated/marchand_deuterium.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/marchand_main.tpl b/application/design/base/default/scripts/deprecated/marchand_main.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/marchand_main.tpl rename to application/design/base/default/scripts/deprecated/marchand_main.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/marchand_metal.tpl b/application/design/base/default/scripts/deprecated/marchand_metal.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/marchand_metal.tpl rename to application/design/base/default/scripts/deprecated/marchand_metal.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/message_body.tpl b/application/design/base/default/scripts/deprecated/message_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/message_body.tpl rename to application/design/base/default/scripts/deprecated/message_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/messages_pm_form.tpl b/application/design/base/default/scripts/deprecated/messages_pm_form.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/messages_pm_form.tpl rename to application/design/base/default/scripts/deprecated/messages_pm_form.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/messages_pm_form_bb.tpl b/application/design/base/default/scripts/deprecated/messages_pm_form_bb.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/messages_pm_form_bb.tpl rename to application/design/base/default/scripts/deprecated/messages_pm_form_bb.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/multi.tpl b/application/design/base/default/scripts/deprecated/multi.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/multi.tpl rename to application/design/base/default/scripts/deprecated/multi.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/notes_body.tpl b/application/design/base/default/scripts/deprecated/notes_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/notes_body.tpl rename to application/design/base/default/scripts/deprecated/notes_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/notes_body_entry.tpl b/application/design/base/default/scripts/deprecated/notes_body_entry.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/notes_body_entry.tpl rename to application/design/base/default/scripts/deprecated/notes_body_entry.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/notes_form.tpl b/application/design/base/default/scripts/deprecated/notes_form.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/notes_form.tpl rename to application/design/base/default/scripts/deprecated/notes_form.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/officier_body.tpl b/application/design/base/default/scripts/deprecated/officier_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/officier_body.tpl rename to application/design/base/default/scripts/deprecated/officier_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/officier_rows.tpl b/application/design/base/default/scripts/deprecated/officier_rows.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/officier_rows.tpl rename to application/design/base/default/scripts/deprecated/officier_rows.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/options_admadd.tpl b/application/design/base/default/scripts/deprecated/options_admadd.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/options_admadd.tpl rename to application/design/base/default/scripts/deprecated/options_admadd.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/options_body.tpl b/application/design/base/default/scripts/deprecated/options_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/options_body.tpl rename to application/design/base/default/scripts/deprecated/options_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/options_body_vmode.tpl b/application/design/base/default/scripts/deprecated/options_body_vmode.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/options_body_vmode.tpl rename to application/design/base/default/scripts/deprecated/options_body_vmode.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/overall_footer.tpl b/application/design/base/default/scripts/deprecated/overall_footer.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/overall_footer.tpl rename to application/design/base/default/scripts/deprecated/overall_footer.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/overview_body.tpl b/application/design/base/default/scripts/deprecated/overview_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/overview_body.tpl rename to application/design/base/default/scripts/deprecated/overview_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/overview_deleteplanet.tpl b/application/design/base/default/scripts/deprecated/overview_deleteplanet.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/overview_deleteplanet.tpl rename to application/design/base/default/scripts/deprecated/overview_deleteplanet.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/overview_fleet_event.tpl b/application/design/base/default/scripts/deprecated/overview_fleet_event.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/overview_fleet_event.tpl rename to application/design/base/default/scripts/deprecated/overview_fleet_event.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/overview_renameplanet.tpl b/application/design/base/default/scripts/deprecated/overview_renameplanet.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/overview_renameplanet.tpl rename to application/design/base/default/scripts/deprecated/overview_renameplanet.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/phalanx_body.tpl b/application/design/base/default/scripts/deprecated/phalanx_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/phalanx_body.tpl rename to application/design/base/default/scripts/deprecated/phalanx_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/records_body.tpl b/application/design/base/default/scripts/deprecated/records_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/records_body.tpl rename to application/design/base/default/scripts/deprecated/records_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/records_section_header.tpl b/application/design/base/default/scripts/deprecated/records_section_header.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/records_section_header.tpl rename to application/design/base/default/scripts/deprecated/records_section_header.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/records_section_rows.tpl b/application/design/base/default/scripts/deprecated/records_section_rows.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/records_section_rows.tpl rename to application/design/base/default/scripts/deprecated/records_section_rows.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/registry_form.tpl b/application/design/base/default/scripts/deprecated/registry_form.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/registry_form.tpl rename to application/design/base/default/scripts/deprecated/registry_form.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/resources.tpl b/application/design/base/default/scripts/deprecated/resources.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/resources.tpl rename to application/design/base/default/scripts/deprecated/resources.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/resources_row.tpl b/application/design/base/default/scripts/deprecated/resources_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/resources_row.tpl rename to application/design/base/default/scripts/deprecated/resources_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/rules_body.tpl b/application/design/base/default/scripts/deprecated/rules_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/rules_body.tpl rename to application/design/base/default/scripts/deprecated/rules_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/search_ally_row.tpl b/application/design/base/default/scripts/deprecated/search_ally_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/search_ally_row.tpl rename to application/design/base/default/scripts/deprecated/search_ally_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/search_ally_table.tpl b/application/design/base/default/scripts/deprecated/search_ally_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/search_ally_table.tpl rename to application/design/base/default/scripts/deprecated/search_ally_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/search_body.tpl b/application/design/base/default/scripts/deprecated/search_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/search_body.tpl rename to application/design/base/default/scripts/deprecated/search_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/search_user_row.tpl b/application/design/base/default/scripts/deprecated/search_user_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/search_user_row.tpl rename to application/design/base/default/scripts/deprecated/search_user_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/search_user_table.tpl b/application/design/base/default/scripts/deprecated/search_user_table.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/search_user_table.tpl rename to application/design/base/default/scripts/deprecated/search_user_table.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/serv_infos.tpl b/application/design/base/default/scripts/deprecated/serv_infos.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/serv_infos.tpl rename to application/design/base/default/scripts/deprecated/serv_infos.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/simple_footer.tpl b/application/design/base/default/scripts/deprecated/simple_footer.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/simple_footer.tpl rename to application/design/base/default/scripts/deprecated/simple_footer.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/simple_header.tpl b/application/design/base/default/scripts/deprecated/simple_header.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/simple_header.tpl rename to application/design/base/default/scripts/deprecated/simple_header.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/stat_alliancetable.tpl b/application/design/base/default/scripts/deprecated/stat_alliancetable.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/stat_alliancetable.tpl rename to application/design/base/default/scripts/deprecated/stat_alliancetable.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/stat_alliancetable_header.tpl b/application/design/base/default/scripts/deprecated/stat_alliancetable_header.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/stat_alliancetable_header.tpl rename to application/design/base/default/scripts/deprecated/stat_alliancetable_header.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/stat_body.tpl b/application/design/base/default/scripts/deprecated/stat_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/stat_body.tpl rename to application/design/base/default/scripts/deprecated/stat_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/stat_playertable.tpl b/application/design/base/default/scripts/deprecated/stat_playertable.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/stat_playertable.tpl rename to application/design/base/default/scripts/deprecated/stat_playertable.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/stat_playertable_header.tpl b/application/design/base/default/scripts/deprecated/stat_playertable_header.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/stat_playertable_header.tpl rename to application/design/base/default/scripts/deprecated/stat_playertable_header.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/statjoueur.tpl b/application/design/base/default/scripts/deprecated/statjoueur.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/statjoueur.tpl rename to application/design/base/default/scripts/deprecated/statjoueur.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/techtree_body.tpl b/application/design/base/default/scripts/deprecated/techtree_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/techtree_body.tpl rename to application/design/base/default/scripts/deprecated/techtree_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/techtree_details.tpl b/application/design/base/default/scripts/deprecated/techtree_details.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/techtree_details.tpl rename to application/design/base/default/scripts/deprecated/techtree_details.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/techtree_head.tpl b/application/design/base/default/scripts/deprecated/techtree_head.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/techtree_head.tpl rename to application/design/base/default/scripts/deprecated/techtree_head.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/techtree_row.tpl b/application/design/base/default/scripts/deprecated/techtree_row.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/techtree_row.tpl rename to application/design/base/default/scripts/deprecated/techtree_row.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/teleport.tpl b/application/design/base/default/scripts/deprecated/teleport.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/teleport.tpl rename to application/design/base/default/scripts/deprecated/teleport.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/tradingscrapmetal.tpl b/application/design/base/default/scripts/deprecated/tradingscrapmetal.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/tradingscrapmetal.tpl rename to application/design/base/default/scripts/deprecated/tradingscrapmetal.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/tradingscrapmetal_n.tpl b/application/design/base/default/scripts/deprecated/tradingscrapmetal_n.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/tradingscrapmetal_n.tpl rename to application/design/base/default/scripts/deprecated/tradingscrapmetal_n.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/usr_banned.tpl b/application/design/base/default/scripts/deprecated/usr_banned.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/usr_banned.tpl rename to application/design/base/default/scripts/deprecated/usr_banned.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/usuw_body.tpl b/application/design/base/default/scripts/deprecated/usuw_body.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/usuw_body.tpl rename to application/design/base/default/scripts/deprecated/usuw_body.tpl diff --git a/src/application/design/frontend/base/default/scripts/deprecated/zglos.tpl b/application/design/base/default/scripts/deprecated/zglos.tpl similarity index 100% rename from src/application/design/frontend/base/default/scripts/deprecated/zglos.tpl rename to application/design/base/default/scripts/deprecated/zglos.tpl diff --git a/application/design/base/default/scripts/empire/overview/fleet/item.phtml b/application/design/base/default/scripts/empire/overview/fleet/item.phtml new file mode 100644 index 0000000..f01fb8e --- /dev/null +++ b/application/design/base/default/scripts/empire/overview/fleet/item.phtml @@ -0,0 +1,21 @@ +getData('fleet')?> +getData('user')?> + + getData('fleet_javai')?> + +
-
+ getArrivalTime()?> + + + isOwnedBy($user) || $fleet->isMission(Legacies_Empire::ID_MISSION_TRANSPORT) || $fleet->isMission(Legacies_Empire::ID_MISSION_STATION) || $fleet->isMission(Legacies_Empire::ID_MISSION_STATION_ALLY)):?> + __('An hostile fleet sent by %1$s, coming from %2$s, reaches your planet %3$d. It has been sent with the mission: %4$d', $fleet->getOwner()->getUsername(), $fleet->getOriginPlanet()->getName(), $fleet->getDestinationPlanet()->getName(), $fleet->getMissionLabel())?> + isOwnedBy($user) || $fleet->isMission(Legacies_Empire::ID_MISSION_ATTACK) || $fleet->isMission(Legacies_Empire::ID_MISSION_GROUP_ATTACK) || $fleet->isMission(Legacies_Empire::ID_MISSION_DESTROY) || $fleet->isMission(Legacies_Empire::ID_MISSION_MISSILES) || $fleet->isMission(Legacies_Empire::ID_MISSION_SPY)):?> + __('Your hostile fleet, sent from %1$s, reaches %2$d\'s planet %3$d. It has been sent with the mission: %4$d', $fleet->getOriginPlanet()->getName(), $fleet->getDestinationPlanet()->getUser()->getUsername(), $fleet->getDestinationPlanet()->getName(), $fleet->getMissionLabel())?> + isOwnedBy($user)):?> + __('Your peaceful fleet, sent from %2$s, reaches the planet %3$d. It has been sent with the mission: %4$d', $fleet->getOwner()->getUsername(), $fleet->getOriginPlanet()->getName(), $fleet->getDestinationPlanet()->getName(), $fleet->getMissionLabel())?> + + __('A peaceful fleet sent by %1$s, coming from %2$s, reaches your planet %3$d. It has been sent with the mission: %4$d', $fleet->getOwner()->getUsername(), $fleet->getOriginPlanet()->getName(), $fleet->getDestinationPlanet()->getName(), $fleet->getMissionLabel())?> + + + getData('fleet_javas')?> + \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/player/overview/form/destroy-planet.phtml b/application/design/base/default/scripts/empire/overview/form/destroy-planet.phtml similarity index 100% rename from src/application/design/frontend/base/default/scripts/player/overview/form/destroy-planet.phtml rename to application/design/base/default/scripts/empire/overview/form/destroy-planet.phtml diff --git a/application/design/base/default/scripts/empire/overview/form/rename-planet.phtml b/application/design/base/default/scripts/empire/overview/form/rename-planet.phtml new file mode 100644 index 0000000..45ba7da --- /dev/null +++ b/application/design/base/default/scripts/empire/overview/form/rename-planet.phtml @@ -0,0 +1,10 @@ +
+
+ + + + + + +
+
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/player/overview/messages.phtml b/application/design/base/default/scripts/empire/overview/messages.phtml similarity index 100% rename from src/application/design/frontend/base/default/scripts/player/overview/messages.phtml rename to application/design/base/default/scripts/empire/overview/messages.phtml diff --git a/application/design/base/default/scripts/empire/overview/planet/list/item.phtml b/application/design/base/default/scripts/empire/overview/planet/list/item.phtml new file mode 100644 index 0000000..7d778ea --- /dev/null +++ b/application/design/base/default/scripts/empire/overview/planet/list/item.phtml @@ -0,0 +1,10 @@ + +

escape($this['planet']->getData('name'))?>

+

+ +

+ count() > 0):?> +

escape($this['queue_item']->getData('building_id'))?>

+ +

__('Idle.')?>

+ \ No newline at end of file diff --git a/application/design/base/default/scripts/empire/overview/planet/view.phtml b/application/design/base/default/scripts/empire/overview/planet/view.phtml new file mode 100644 index 0000000..8230a16 --- /dev/null +++ b/application/design/base/default/scripts/empire/overview/planet/view.phtml @@ -0,0 +1 @@ +planetList->render() ?> diff --git a/application/design/base/default/scripts/empire/planet/buildings.phtml b/application/design/base/default/scripts/empire/planet/buildings.phtml new file mode 100644 index 0000000..c8e4fd9 --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/buildings.phtml @@ -0,0 +1,4 @@ +
+

__('Buildings')?>

+ getPartial('item-list.items')->render()?> +
\ No newline at end of file diff --git a/application/design/base/default/scripts/empire/planet/buildings/item.phtml b/application/design/base/default/scripts/empire/planet/buildings/item.phtml new file mode 100644 index 0000000..30c6f33 --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/buildings/item.phtml @@ -0,0 +1,27 @@ + +
+

escape($this->getName())?> (renderNumber($this->getLevel())?>)

+
+
+ +
+

getDescription()?>

+
    + getResourcesConfigForNextLevel() as $resourceId => $resourceConfig):?> +
  • + getResourceName($resourceId)?> + renderNumber($resourceConfig->getData('value'))?> + hasData('requirement')):?> + (renderNumber($resourceConfig->getData('requirement'))?>) + + (renderNumber($resourceConfig->getData('overflow'))?>) + +
  • + +
+

__('Building time: %s', $this->renderTime($this->getBuildingTimeForNextLevel(), true))?> +

+ +
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue.phtml b/application/design/base/default/scripts/empire/planet/buildings/queue.phtml similarity index 100% rename from src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue.phtml rename to application/design/base/default/scripts/empire/planet/buildings/queue.phtml diff --git a/application/design/base/default/scripts/empire/planet/buildings/queue/item.phtml b/application/design/base/default/scripts/empire/planet/buildings/queue/item.phtml new file mode 100644 index 0000000..0825de3 --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/buildings/queue/item.phtml @@ -0,0 +1,8 @@ + +
+ + escape($this->getName())?> (renderNumber($this->getItemQueuedLevel())?>) + +
\ No newline at end of file diff --git a/application/design/base/default/scripts/empire/planet/research-lab.phtml b/application/design/base/default/scripts/empire/planet/research-lab.phtml new file mode 100644 index 0000000..78be4c0 --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/research-lab.phtml @@ -0,0 +1,4 @@ +
+

__('Research Laboratory')?>

+ getPartial('item-list.items')->render()?> +
\ No newline at end of file diff --git a/application/design/base/default/scripts/empire/planet/research-lab/item.phtml b/application/design/base/default/scripts/empire/planet/research-lab/item.phtml new file mode 100644 index 0000000..9fd2017 --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/research-lab/item.phtml @@ -0,0 +1,27 @@ + +
+

escape($this->getName())?> (renderNumber($this->getLevel())?>)

+
+
+ +
+

getDescription()?>

+
    + getResourcesConfigForNextLevel() as $resourceId => $resourceConfig):?> +
  • + getResourceName($resourceId)?> + renderNumber($resourceConfig->getData('value'))?> + hasData('requirement')):?> + (renderNumber($resourceConfig->getData('requirement'))?>) + + (renderNumber($resourceConfig->getData('overflow'))?>) + +
  • + +
+

__('Building time: %s', $this->renderTime($this->getBuildingTime(1), false))?> +

+ +
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/queue.phtml b/application/design/base/default/scripts/empire/planet/research-lab/queue.phtml similarity index 92% rename from src/application/design/frontend/base/default/scripts/empire/planet/shipyard/queue.phtml rename to application/design/base/default/scripts/empire/planet/research-lab/queue.phtml index c63a203..d11b574 100644 --- a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/queue.phtml +++ b/application/design/base/default/scripts/empire/planet/research-lab/queue.phtml @@ -3,4 +3,4 @@

__('Work in progress')?>

getPartial('item-list')->render() ?> - + \ No newline at end of file diff --git a/application/design/base/default/scripts/empire/planet/research-lab/queue/item.phtml b/application/design/base/default/scripts/empire/planet/research-lab/queue/item.phtml new file mode 100644 index 0000000..0825de3 --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/research-lab/queue/item.phtml @@ -0,0 +1,8 @@ + +
+ + escape($this->getName())?> (renderNumber($this->getItemQueuedLevel())?>) + +
\ No newline at end of file diff --git a/application/design/base/default/scripts/empire/planet/shipyard.phtml b/application/design/base/default/scripts/empire/planet/shipyard.phtml new file mode 100644 index 0000000..9a7d684 --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/shipyard.phtml @@ -0,0 +1,20 @@ +
+

__('Shipyard')?>

+
+
+ getPartial('item-list.items')->render()?> +
+ +
+ +
\ No newline at end of file diff --git a/application/design/base/default/scripts/empire/planet/shipyard/item.phtml b/application/design/base/default/scripts/empire/planet/shipyard/item.phtml new file mode 100644 index 0000000..184683e --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/shipyard/item.phtml @@ -0,0 +1,29 @@ + +
+

escape($this->getName())?> (renderNumber($this->getQty())?>)

+
+
+ +
+

getDescription()?>

+
    + getResourcesConfigForQty(1) as $resourceId => $resourceConfig):?> +
  • + getResourceName($resourceId)?> + renderNumber($resourceConfig->getData('value'))?> + hasData('requirement')):?> + (renderNumber($resourceConfig->getData('requirement'))?>) + + (renderNumber($resourceConfig->getData('overflow'))?>) + +
  • + +
+

__('Building time: %s', $this->renderTime($this->getBuildingTime(1), false))?> +

+ +
\ No newline at end of file diff --git a/src/application/code/core/Wootook/Server/Mvc/Dispatcher.php b/application/design/base/default/scripts/empire/planet/shipyard/queue.phtml similarity index 100% rename from src/application/code/core/Wootook/Server/Mvc/Dispatcher.php rename to application/design/base/default/scripts/empire/planet/shipyard/queue.phtml diff --git a/application/design/base/default/scripts/empire/planet/shipyard/queue.phtml~HEAD b/application/design/base/default/scripts/empire/planet/shipyard/queue.phtml~HEAD new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/application/design/base/default/scripts/empire/planet/shipyard/queue.phtml~HEAD @@ -0,0 +1 @@ + +
⇦
+
+getPlanetCollection() as $planet):?> +
+ getId() != $this->getCurrentPlanet()->getId()):?> + escape($planet->getName())?> [escape($planet->getCoords())?>] + + escape($planet->getName())?> [escape($planet->getCoords())?>] + +
+ +
+
⇨
+ +
+
+ <?php echo $this->__('Metal')?> +

+ getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_METAL)):?> + renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?> + + renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?> + +

+
+
+ <?php echo $this->__('Cristal')?> +

+ getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_CRISTAL)):?> + renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?> + + renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?> + +

+
+
+ <?php echo $this->__('Deuterium')?> +

+ getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_DEUTERIUM)):?> + renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?> + + renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?> + +

+
+
+ <?php echo $this->__('Energy')?> +

+ getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_ENERGY)):?> + renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?> + + renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?> + +

+
+
+ <?php echo $this->__('Messages')?> +

+ getCurrentUser()->getNewMessagesCount()) > 1):?> + __('%1$d messages.', $count)?> + + __('1 message.')?> + + __('No message.')?> + +

+
+
diff --git a/src/application/design/install/base/default/scripts/page/1column.phtml b/application/design/base/default/scripts/page/1column.phtml similarity index 100% rename from src/application/design/install/base/default/scripts/page/1column.phtml rename to application/design/base/default/scripts/page/1column.phtml diff --git a/src/application/design/install/base/default/scripts/page/2columns-left.phtml b/application/design/base/default/scripts/page/2columns-left.phtml similarity index 100% rename from src/application/design/install/base/default/scripts/page/2columns-left.phtml rename to application/design/base/default/scripts/page/2columns-left.phtml diff --git a/src/application/design/install/base/default/scripts/page/2columns-right.phtml b/application/design/base/default/scripts/page/2columns-right.phtml similarity index 100% rename from src/application/design/install/base/default/scripts/page/2columns-right.phtml rename to application/design/base/default/scripts/page/2columns-right.phtml diff --git a/src/application/design/install/base/default/scripts/page/3columns.phtml b/application/design/base/default/scripts/page/3columns.phtml similarity index 100% rename from src/application/design/install/base/default/scripts/page/3columns.phtml rename to application/design/base/default/scripts/page/3columns.phtml diff --git a/src/application/design/backend/base/default/scripts/page/html/head.phtml b/application/design/base/default/scripts/page/html/head.phtml similarity index 82% rename from src/application/design/backend/base/default/scripts/page/html/head.phtml rename to application/design/base/default/scripts/page/html/head.phtml index b98b464..7933554 100644 --- a/src/application/design/backend/base/default/scripts/page/html/head.phtml +++ b/application/design/base/default/scripts/page/html/head.phtml @@ -1,5 +1,5 @@ -<?php echo $this->escape($this->getTitle())?> - +XNova:Legacies + getCss() as $css):?> @@ -12,7 +12,7 @@ getJs() as $js):?> - + getSkinJs() as $js):?> diff --git a/src/application/design/backend/base/default/scripts/page/html/message.phtml b/application/design/base/default/scripts/page/html/message.phtml similarity index 100% rename from src/application/design/backend/base/default/scripts/page/html/message.phtml rename to application/design/base/default/scripts/page/html/message.phtml diff --git a/application/design/base/default/scripts/page/html/navigation.phtml b/application/design/base/default/scripts/page/html/navigation.phtml new file mode 100644 index 0000000..7552419 --- /dev/null +++ b/application/design/base/default/scripts/page/html/navigation.phtml @@ -0,0 +1,5 @@ + diff --git a/application/design/base/default/scripts/page/html/navigation/link.phtml b/application/design/base/default/scripts/page/html/navigation/link.phtml new file mode 100644 index 0000000..8e44687 --- /dev/null +++ b/application/design/base/default/scripts/page/html/navigation/link.phtml @@ -0,0 +1 @@ +escape($link->getLabel())?> diff --git a/application/design/base/default/scripts/page/html/navigation/node.phtml b/application/design/base/default/scripts/page/html/navigation/node.phtml new file mode 100644 index 0000000..adebdab --- /dev/null +++ b/application/design/base/default/scripts/page/html/navigation/node.phtml @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/application/design/base/default/scripts/user/login.phtml b/application/design/base/default/scripts/user/login.phtml new file mode 100644 index 0000000..4e51e00 --- /dev/null +++ b/application/design/base/default/scripts/user/login.phtml @@ -0,0 +1,54 @@ +
+
+
+
+ + + + + + + + + + +
+ __('Username')?> + __('Password')?> +
+ __('Remember me')?> + +
+ __('I have lost my password.')?> +
+
+
+
+ +
+
__('Welcome on %s!', $this->escape($this->getData('server_name')))?>
+
+
+
+
__('%1$s make you an emperor. Conquer outer space and master other players on %1$s.', $this->getData('server_name'))?>
+
+
__('Register now!')?>
+
+
+
+ + __('Player count: ')?>getData('user_count')?> - + __('Latest player: ')?>getData('latest_player')?> - + __('Online players: ')?> getData('online_players')?> + +
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/player/registration.phtml b/application/design/base/default/scripts/user/registration.phtml similarity index 68% rename from src/application/design/frontend/base/default/scripts/player/registration.phtml rename to application/design/base/default/scripts/user/registration.phtml index efdea56..f2503bc 100644 --- a/src/application/design/frontend/base/default/scripts/player/registration.phtml +++ b/application/design/base/default/scripts/user/registration.phtml @@ -1,40 +1,36 @@ -getLayout()->getMessagesBlock()->renderGroupedHtml()?> -
-

__('Register')?>

+
__('User data:')?> -

+

-

+

-

+

__('Password:')?> -

+

-

+

__('Planet:')?> -

+

-

- -

-
+ + \ No newline at end of file diff --git a/src/application/gamedata/legacies/default/combat.php b/application/gamedata/legacies/default/combat.php similarity index 100% rename from src/application/gamedata/legacies/default/combat.php rename to application/gamedata/legacies/default/combat.php diff --git a/application/gamedata/legacies/default/events.php b/application/gamedata/legacies/default/events.php new file mode 100644 index 0000000..379ac37 --- /dev/null +++ b/application/gamedata/legacies/default/events.php @@ -0,0 +1,33 @@ + array(), + 'login.success' => array(), + 'logout.success' => array(), + 'register.before' => array(), + 'register.failure' => array(), + 'register.success' => array( + array('Wootook_Empire_Model_Planet', 'registrationListener') + ), + 'planet.update' => array( + array('Wootook_Empire_Model_Planet', 'planetUpdateListener'), + array('Legacies_Empire_Model_Planet_Building_Shipyard', 'planetUpdateListener') + ), + 'user.init' => array( + array('Wootook_Empire_Model_Planet', 'registrationListener') + ), + 'planet.init' => array( + array('Legacies_Empire_Model_Galaxy_Position', 'initPlanetListerner') + ), + 'planet.shipyard.check-availability' => array(), + 'planet.shipyard.update-queue.before' => array(), + 'planet.shipyard.update-queue.after' => array(), + 'planet.shipyard.append-queue.before' => array(), + 'planet.shipyard.append-queue.after' => array(), + 'planet.building.building-time' => array( + array('Legacies_Empire_Model_Planet_Building_NaniteFactory', 'buildingTimeListener'), + array('Legacies_Empire_Model_Planet_Building_RoboticFactory', 'buildingTimeListener') + ), + 'planet.shipyard.building-time' => array( + array('Legacies_Empire_Model_Planet_Building_NaniteFactory', 'buildingTimeListener'), + array('Legacies_Empire_Model_Planet_Building_RoboticFactory', 'buildingTimeListener') + ) + ); diff --git a/src/application/gamedata/legacies/default/fields-alias.php b/application/gamedata/legacies/default/fields-alias.php similarity index 90% rename from src/application/gamedata/legacies/default/fields-alias.php rename to application/gamedata/legacies/default/fields-alias.php index 788a72c..2a56eb1 100644 --- a/src/application/gamedata/legacies/default/fields-alias.php +++ b/application/gamedata/legacies/default/fields-alias.php @@ -41,7 +41,6 @@ Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK => "intergalactic_tech", Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY => "expedition_tech", Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => "graviton_tech", - Legacies_Empire::ID_RESEARCH_ORE_MINING => "ore_mining_tech", // }}} // @@ -62,7 +61,6 @@ Legacies_Empire::ID_SHIP_DEATH_STAR => "dearth_star", Legacies_Empire::ID_SHIP_BATTLECRUISER => "battleship", Legacies_Empire::ID_SHIP_SUPERNOVA => "supernova", - Legacies_Empire::ID_SHIP_ORE_MININER => "ore_miner", // // @@ -80,4 +78,24 @@ Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => "interceptor_misil", Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => "interplanetary_misil", // }}} + +// +// Officers +// {{{ + 601 => "rpg_geologue", + 602 => "rpg_amiral", + 603 => "rpg_ingenieur", + 604 => "rpg_technocrate", + 605 => "rpg_constructeur", + 606 => "rpg_scientifique", + 607 => "rpg_stockeur", + 608 => "rpg_defenseur", + 609 => "rpg_bunker", + 610 => "rpg_espion", + 611 => "rpg_commandant", + 612 => "rpg_destructeur", + 613 => "rpg_general", + 614 => "rpg_raideur", + 615 => "rpg_empereur" +// }}} ); diff --git a/application/gamedata/legacies/default/modules.php b/application/gamedata/legacies/default/modules.php new file mode 100644 index 0000000..5a2bd48 --- /dev/null +++ b/application/gamedata/legacies/default/modules.php @@ -0,0 +1,9 @@ + array( + 'core' => array('Wootook_Core_Block_' => 'Wootook/Core/Block'), + 'empire' => array('Wootook_Empire_Block_' => 'Wootook/Empire/Block'), + 'legacies_core' => array('Legacies_Core_Block_' => 'Legacies/Core/Block'), + 'legacies_empire' => array('Legacies_Empire_Block_' => 'Legacies/Empire/Block'), + 'legacies_officers' => array('Legacies_Officers_Block_' => 'Legacies/Officers/Block') + ) + ); \ No newline at end of file diff --git a/src/application/gamedata/legacies/default/prices.php b/application/gamedata/legacies/default/prices.php similarity index 100% rename from src/application/gamedata/legacies/default/prices.php rename to application/gamedata/legacies/default/prices.php diff --git a/application/gamedata/legacies/default/production.php b/application/gamedata/legacies/default/production.php new file mode 100644 index 0000000..125faa4 --- /dev/null +++ b/application/gamedata/legacies/default/production.php @@ -0,0 +1,71 @@ + array( + Legacies_Empire::RESOURCE_METAL => 40, + Legacies_Empire::RESOURCE_CRISTAL => 10, + Legacies_Empire::RESOURCE_DEUTERIUM => 0, + Legacies_Empire::RESOURCE_ENERGY => 0, + Legacies_Empire::RESOURCE_MULTIPLIER => 1.5, + Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_MetalMine' + ), + + Legacies_Empire::ID_BUILDING_CRISTAL_MINE => array( + Legacies_Empire::RESOURCE_METAL => 30, + Legacies_Empire::RESOURCE_CRISTAL => 15, + Legacies_Empire::RESOURCE_DEUTERIUM => 0, + Legacies_Empire::RESOURCE_ENERGY => 0, + Legacies_Empire::RESOURCE_MULTIPLIER => 1.6, + Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_CristalMine' + ), + + Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => array( + Legacies_Empire::RESOURCE_METAL => 150, + Legacies_Empire::RESOURCE_CRISTAL => 50, + Legacies_Empire::RESOURCE_DEUTERIUM => 0, + Legacies_Empire::RESOURCE_ENERGY => 0, + Legacies_Empire::RESOURCE_MULTIPLIER => 1.5, + Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser' + ), + + Legacies_Empire::ID_BUILDING_SOLAR_PLANT => array( + Legacies_Empire::RESOURCE_METAL => 50, + Legacies_Empire::RESOURCE_CRISTAL => 20, + Legacies_Empire::RESOURCE_DEUTERIUM => 0, + Legacies_Empire::RESOURCE_ENERGY => 0, + Legacies_Empire::RESOURCE_MULTIPLIER => 1.5, + Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_SolarPlant' + ), + + Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array( + Legacies_Empire::RESOURCE_METAL => 500, + Legacies_Empire::RESOURCE_CRISTAL => 200, + Legacies_Empire::RESOURCE_DEUTERIUM => 100, + Legacies_Empire::RESOURCE_ENERGY => 0, + Legacies_Empire::RESOURCE_MULTIPLIER => 1.8, + Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_FusionReactor' + ), +// }}} + +// +// Ships production +// {{{ + Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array( + Legacies_Empire::RESOURCE_METAL => 0, + Legacies_Empire::RESOURCE_CRISTAL => 2000, + Legacies_Empire::RESOURCE_DEUTERIUM => 500, + Legacies_Empire::RESOURCE_ENERGY => 0, + Legacies_Empire::RESOURCE_MULTIPLIER => 0.5, + Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Ship_SolarSatellite' + ), + Legacies_Empire::ID_SHIP_SUPERNOVA => array( + Legacies_Empire::RESOURCE_METAL => 0, + Legacies_Empire::RESOURCE_CRISTAL => 2000, + Legacies_Empire::RESOURCE_DEUTERIUM => 500, + Legacies_Empire::RESOURCE_ENERGY => 0, + Legacies_Empire::RESOURCE_MULTIPLIER => 0.5, + Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Ship_Supernova' + ) +// }}} + ); diff --git a/src/application/gamedata/legacies/default/requirements.php b/application/gamedata/legacies/default/requirements.php similarity index 95% rename from src/application/gamedata/legacies/default/requirements.php rename to application/gamedata/legacies/default/requirements.php index 2ed5430..838a930 100644 --- a/src/application/gamedata/legacies/default/requirements.php +++ b/application/gamedata/legacies/default/requirements.php @@ -114,10 +114,6 @@ Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => 3 ), - Legacies_Empire::ID_RESEARCH_ORE_MINING => array( - Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 2 - ), - Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => array( Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 12 ), @@ -211,13 +207,6 @@ Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 14, Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => 3 ), - - Legacies_Empire::ID_SHIP_ORE_MININER => array( - Legacies_Empire::ID_BUILDING_SHIPYARD => 12, - Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => 8, - Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => 1, - Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => 16 - ), // }}} // diff --git a/src/application/gamedata/legacies/default/resources.php b/application/gamedata/legacies/default/resources.php similarity index 100% rename from src/application/gamedata/legacies/default/resources.php rename to application/gamedata/legacies/default/resources.php diff --git a/src/application/gamedata/legacies/default/types.php b/application/gamedata/legacies/default/types.php similarity index 97% rename from src/application/gamedata/legacies/default/types.php rename to application/gamedata/legacies/default/types.php index c67c74d..76c773d 100644 --- a/src/application/gamedata/legacies/default/types.php +++ b/application/gamedata/legacies/default/types.php @@ -75,7 +75,6 @@ Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY, Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK, Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY, - Legacies_Empire::ID_RESEARCH_ORE_MINING, Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY ), // }}} @@ -98,8 +97,7 @@ Legacies_Empire::ID_SHIP_DESTRUCTOR, Legacies_Empire::ID_SHIP_DEATH_STAR, Legacies_Empire::ID_SHIP_BATTLECRUISER, - Legacies_Empire::ID_SHIP_SUPERNOVA, - Legacies_Empire::ID_SHIP_ORE_MININER + Legacies_Empire::ID_SHIP_SUPERNOVA ), // }}} diff --git a/src/application/locale/en_US/Legacies_User.csv b/application/locale/en_US/Legacies_User.csv similarity index 100% rename from src/application/locale/en_US/Legacies_User.csv rename to application/locale/en_US/Legacies_User.csv diff --git a/src/application/locale/fr_FR/Legacies_User.csv b/application/locale/fr_FR/Legacies_User.csv similarity index 100% rename from src/application/locale/fr_FR/Legacies_User.csv rename to application/locale/fr_FR/Legacies_User.csv diff --git a/src/application/locale/fr_FR/Legacies_User.txt b/application/locale/fr_FR/Legacies_User.txt similarity index 100% rename from src/application/locale/fr_FR/Legacies_User.txt rename to application/locale/fr_FR/Legacies_User.txt diff --git a/application/scripts/legacies/client.js b/application/scripts/legacies/client.js new file mode 100644 index 0000000..203285c --- /dev/null +++ b/application/scripts/legacies/client.js @@ -0,0 +1,265 @@ +/** + * This file is part of Wootook + * + * @license http://www.gnu.org/licenses/gpl-3.0.txt +* @see http://www.wootook.com/ + * + * Copyright (c) 2009-Present, XNova Support Team + * 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. + * + */ +/** + * Main application script execution class + * + * @param string responder + * @param int messageOffset + */ + +function Legacies_Client(responder, messageOffset) { + if (!document.querySelectorAll) { + alert("Your browser is not compatible with CSS selectors API.\n\nCould not continue."); + return; + } + this.responder = responder; + this.messages = []; + this.messageId = messageOffset || 1; + this.callbacks = {}; + this.recurrentMessages = []; + + this.send = (function() { + if (this.messages.length == 0) { + return this; + } + var request = new XMLHttpRequest(); + request.open('POST', this.responder, false); + request.send(JSON.stringify(this.messages)); + this.messages = []; + for (var i in this.recurrentMessages) { + this.enqueue(this.recurrentMessages[i].action, this.recurrentMessages[i].params, this.recurrentMessages[i].callback); + } + if(request.status == 404) { + alert('Request failed, responder not found.'); + return this; + } + try { + var response = JSON.parse(request.responseText); + } catch (e) { + alert('Invalid response.'); + return this; + } + if(request.status == 200) { + for (var i in response) { + this._callback(response[i]); + } + } + return this; + }).bind(this); + + this.main = (function(interval) { + setInterval(this.send, interval || 30000); + }).bind(this); + + this.enqueue = (function(action, params){ + this.messages.push({'uid':this.messageId++,'action':action,'params':params}); + return this; + }).bind(this); + + this.enqueueRecurrent = (function(action, params, callback) { + this.recurrentMessages.push({'callback':callback,'action':action,'params':params}); + this.enqueue(action, params, callback); + }).bind(this); + + this._callback = (function(message){ + if (message.error === undefined || message.payload === undefined) { + return this; + } + if (message.error === true) { + if (typeof(message.payload.messages) == 'string') { + alert(message.payload.messages); + } else { + var info = ''; + for (var i in message.payload.messages) { + info = info + "\n[" + i + "]:\n" + message.payload.messages[i].join("\n") + "\n"; + } + alert("Errors were returned:\n" + info); + } + return this; + } + if (message.callback && this.CallbackType[message.callback]) { + (this.CallbackType[message.callback]).bind(this)(message.payload); + } + return this; + }).bind(this); + + this.login = (function(username, password, rememberme) { + var params = { + 'username': username, + 'password': password, + 'rememberme': rememberme || false + }; + this.enqueue('user.account.login', params).send(); + return this; + }).bind(this); + + this.logout = (function() { + this.enqueue('user.account.logout', {}).send(); + return this; + }).bind(this); + + this.form = (function(event) { + event.preventDefault(); + var form = event.target; + var params = {}; + for (var i = 0; i < form.length; i++) { + if (!form[i].name || !form[i].type) { + continue; + } + if (form[i].type == 'checkbox') { + if (form[i].checked) { + params[form[i].name] = true; + } else { + params[form[i].name] = false; + } + } else if (form[i].type == 'radio') { + params[form[i].name] = form[i].value; + } else if (form[i].value !== undefined) { + params[form[i].name] = form[i].value; + } + } + var action = form.action.slice(form.action.indexOf('#') + 1); + this.enqueue(action, params, this.CallbackType.updater).send(); + }).bind(this); + + this.CallbackType = { + redirector: function(payload) { + if (payload.redirect) { + document.location.href = payload.redirect; + } + }, + updater: function(payload) { + if (payload.html && payload.selector) { + var parent = $$(payload.selector); + var handler = document.createElement("div"); + handler.innerHTML = payload.html; + + var fragment = document.createDocumentFragment(); + for (var i = 0; i < handler.childNodes.length; i++) { + fragment.appendChild(handler.childNodes[i]); + } + + for (var i = 0; i < parent.length; i++) { + parent[i].appendChild(fragment.cloneNode(true)); + } + } + }, + script: function(payload) { + if (payload.script) { + eval(payload.script); + } + }, + error: function(payload) { + if (payload.messages) { + alert(payload.messages.join(', ')); + } + }, + show: function(payload) { + if (payload.selector) { + var elementList = $$(payload.selector); + for (var i = 0; i < elementList.length; i++) { + elementList[i].style.display = 'block'; + } + } + }, + hide: function(payload) { + if (payload.selector) { + var elementList = $$(payload.selector); + for (var i = 0; i < elementList.length; i++) { + elementList[i].style.display = 'none'; + } + } + }, + callback: function(payload) { + if (payload.callback) { + payload.callback.apply(this, payload.params); + } + }, + enqueueRecurrent: function(payload) { + if (payload.action && payload.params && payload.callback) { + this.enqueueRecurrent(payload.action, payload.params, payload.callback); + } + } + }; +} + +function Legacies_Element(object) { + object.listen = (function(event, callback) { + this.addEventListener(event, callback, false); + return this; + }).bind(object); + + return object; +} + +function Legacies_List(object) { + object.listen = (function(event, callback) { + for (var i in this) { + Legacies_Element(Legacies_Element[i]); + this[i].listen(event, callback); + } + return this; + }).bind(object); + + return object; +} + +function $A(object) { + return Array.prototype.slice.call(object); +} + +function $(element) { + if (typeof(element) == 'string') { + element = document.getElementById(element); + } + Legacies_Element(element); + return element; +} + +function $$(selector, context) { + context = context || document; + var nodeList = context.querySelectorAll(selector); + Legacies_List(nodeList); + return nodeList; +} + +function $E(element, methods) { + for (var i in methods) { + if (methods[i] === undefined) { + continue; + } + element[i] = function(){ + var args = $A(arguments); + args.unshift(element); + methods[i].apply(element, args); + } + element[i].bind(element); + } + return element; +} \ No newline at end of file diff --git a/application/scripts/sizzle.js b/application/scripts/sizzle.js new file mode 100644 index 0000000..07654d5 --- /dev/null +++ b/application/scripts/sizzle.js @@ -0,0 +1,1413 @@ +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true, + rBackslash = /\\/g, + rNonWord = /\W/; + +// Here we check if the JavaScript engine is using some sort of +// optimization where it does not always call our comparision +// function. If that is the case, discard the hasDuplicate value. +// Thus far that includes Google Chrome. +[0, 0].sort(function() { + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function( selector, context, results, seed ) { + results = results || []; + context = context || document; + + var origContext = context; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var m, set, checkSet, extra, ret, cur, pop, i, + prune = true, + contextXML = Sizzle.isXML( context ), + parts = [], + soFar = selector; + + // Reset the position of the chunker regexp (start from head) + do { + chunker.exec( "" ); + m = chunker.exec( soFar ); + + if ( m ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + } while ( m ); + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context ); + + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) { + selector += parts.shift(); + } + + set = posProcess( selector, set ); + } + } + + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + + ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? + Sizzle.filter( ret.expr, ret.set )[0] : + ret.set[0]; + } + + if ( context ) { + ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + + set = ret.expr ? + Sizzle.filter( ret.expr, ret.set ) : + ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray( set ); + + } else { + prune = false; + } + + while ( parts.length ) { + cur = parts.pop(); + pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + Sizzle.error( cur || selector ); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + + } else if ( context && context.nodeType === 1 ) { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + + } else { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function( results ) { + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[ i - 1 ] ) { + results.splice( i--, 1 ); + } + } + } + } + + return results; +}; + +Sizzle.matches = function( expr, set ) { + return Sizzle( expr, null, null, set ); +}; + +Sizzle.matchesSelector = function( node, expr ) { + return Sizzle( expr, null, null, [node] ).length > 0; +}; + +Sizzle.find = function( expr, context, isXML ) { + var set; + + if ( !expr ) { + return []; + } + + for ( var i = 0, l = Expr.order.length; i < l; i++ ) { + var match, + type = Expr.order[i]; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + var left = match[1]; + match.splice( 1, 1 ); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace( rBackslash, "" ); + set = Expr.find[ type ]( match, context, isXML ); + + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( "*" ) : + []; + } + + return { set: set, expr: expr }; +}; + +Sizzle.filter = function( expr, set, inplace, not ) { + var match, anyFound, + old = expr, + result = [], + curLoop = set, + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); + + while ( expr && set.length ) { + for ( var type in Expr.filter ) { + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { + var found, item, + filter = Expr.filter[ type ], + left = match[1]; + + anyFound = false; + + match.splice(1,1); + + if ( left.substr( left.length - 1 ) === "\\" ) { + continue; + } + + if ( curLoop === result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( var i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + var pass = not ^ !!found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + + } else { + curLoop[i] = false; + } + + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr === old ) { + if ( anyFound == null ) { + Sizzle.error( expr ); + + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +Sizzle.error = function( msg ) { + throw "Syntax error, unrecognized expression: " + msg; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + + match: { + ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ + }, + + leftMatch: {}, + + attrMap: { + "class": "className", + "for": "htmlFor" + }, + + attrHandle: { + href: function( elem ) { + return elem.getAttribute( "href" ); + }, + type: function( elem ) { + return elem.getAttribute( "type" ); + } + }, + + relative: { + "+": function(checkSet, part){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !rNonWord.test( part ), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag ) { + part = part.toLowerCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + + ">": function( checkSet, part ) { + var elem, + isPartStr = typeof part === "string", + i = 0, + l = checkSet.length; + + if ( isPartStr && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; + } + } + + } else { + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + + "": function(checkSet, part, isXML){ + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); + }, + + "~": function( checkSet, part, isXML ) { + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); + } + }, + + find: { + ID: function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }, + + NAME: function( match, context ) { + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], + results = context.getElementsByName( match[1] ); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + + TAG: function( match, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( match[1] ); + } + } + }, + preFilter: { + CLASS: function( match, curLoop, inplace, result, not, isXML ) { + match = " " + match[1].replace( rBackslash, "" ) + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { + if ( !inplace ) { + result.push( elem ); + } + + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + + ID: function( match ) { + return match[1].replace( rBackslash, "" ); + }, + + TAG: function( match, curLoop ) { + return match[1].replace( rBackslash, "" ).toLowerCase(); + }, + + CHILD: function( match ) { + if ( match[1] === "nth" ) { + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + match[2] = match[2].replace(/^\+|\s*/g, ''); + + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + + ATTR: function( match, curLoop, inplace, result, not, isXML ) { + var name = match[1] = match[1].replace( rBackslash, "" ); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + // Handle if an un-quoted value was used + match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + + PSEUDO: function( match, curLoop, inplace, result, not ) { + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + + if ( !inplace ) { + result.push.apply( result, ret ); + } + + return false; + } + + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + + POS: function( match ) { + match.unshift( true ); + + return match; + } + }, + + filters: { + enabled: function( elem ) { + return elem.disabled === false && elem.type !== "hidden"; + }, + + disabled: function( elem ) { + return elem.disabled === true; + }, + + checked: function( elem ) { + return elem.checked === true; + }, + + selected: function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + parent: function( elem ) { + return !!elem.firstChild; + }, + + empty: function( elem ) { + return !elem.firstChild; + }, + + has: function( elem, i, match ) { + return !!Sizzle( match[3], elem ).length; + }, + + header: function( elem ) { + return (/h\d/i).test( elem.nodeName ); + }, + + text: function( elem ) { + var attr = elem.getAttribute( "type" ), type = elem.type; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); + }, + + radio: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; + }, + + checkbox: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; + }, + + file: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; + }, + + password: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; + }, + + submit: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "submit" === elem.type; + }, + + image: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; + }, + + reset: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "reset" === elem.type; + }, + + button: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && "button" === elem.type || name === "button"; + }, + + input: function( elem ) { + return (/input|select|textarea|button/i).test( elem.nodeName ); + }, + + focus: function( elem ) { + return elem === elem.ownerDocument.activeElement; + } + }, + setFilters: { + first: function( elem, i ) { + return i === 0; + }, + + last: function( elem, i, match, array ) { + return i === array.length - 1; + }, + + even: function( elem, i ) { + return i % 2 === 0; + }, + + odd: function( elem, i ) { + return i % 2 === 1; + }, + + lt: function( elem, i, match ) { + return i < match[3] - 0; + }, + + gt: function( elem, i, match ) { + return i > match[3] - 0; + }, + + nth: function( elem, i, match ) { + return match[3] - 0 === i; + }, + + eq: function( elem, i, match ) { + return match[3] - 0 === i; + } + }, + filter: { + PSEUDO: function( elem, match, i, array ) { + var name = match[1], + filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; + + } else if ( name === "not" ) { + var not = match[3]; + + for ( var j = 0, l = not.length; j < l; j++ ) { + if ( not[j] === elem ) { + return false; + } + } + + return true; + + } else { + Sizzle.error( name ); + } + }, + + CHILD: function( elem, match ) { + var type = match[1], + node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + + case "nth": + var first = match[2], + last = match[3]; + + if ( first === 1 && last === 0 ) { + return true; + } + + var doneName = match[0], + parent = elem.parentNode; + + if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { + var count = 0; + + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + + parent.sizcache = doneName; + } + + var diff = elem.nodeIndex - last; + + if ( first === 0 ) { + return diff === 0; + + } else { + return ( diff % first === 0 && diff / first >= 0 ); + } + } + }, + + ID: function( elem, match ) { + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + + TAG: function( elem, match ) { + return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; + }, + + CLASS: function( elem, match ) { + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + + ATTR: function( elem, match ) { + var name = match[1], + result = Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value !== check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + + POS: function( elem, match, i, array ) { + var name = match[2], + filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS, + fescape = function(all, num){ + return "\\" + (num - 0 + 1); + }; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); +} + +var makeArray = function( array, results ) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +// Also verifies that the returned array holds DOM nodes +// (which is not the case in the Blackberry browser) +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; + +// Provide a fallback method if it does not work +} catch( e ) { + makeArray = function( array, results ) { + var i = 0, + ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + + } else { + if ( typeof array.length === "number" ) { + for ( var l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + + } else { + for ( ; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder, siblingCheck; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + return a.compareDocumentPosition ? -1 : 1; + } + + return a.compareDocumentPosition(b) & 4 ? -1 : 1; + }; + +} else { + sortOrder = function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + + siblingCheck = function( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; + }; +} + +// Utility function for retreiving the text value of an array of DOM nodes +Sizzle.getText = function( elems ) { + var ret = "", elem; + + for ( var i = 0; elems[i]; i++ ) { + elem = elems[i]; + + // Get the text from text nodes and CDATA nodes + if ( elem.nodeType === 3 || elem.nodeType === 4 ) { + ret += elem.nodeValue; + + // Traverse everything else, except comment nodes + } else if ( elem.nodeType !== 8 ) { + ret += Sizzle.getText( elem.childNodes ); + } + } + + return ret; +}; + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date()).getTime(), + root = document.documentElement; + + form.innerHTML = ""; + + // Inject it into the root element, check its status, and remove it quickly + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( document.getElementById( id ) ) { + Expr.find.ID = function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + + return m ? + m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? + [m] : + undefined : + []; + } + }; + + Expr.filter.ID = function( elem, match ) { + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + + // release memory in IE + root = form = null; +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function( match, context ) { + var results = context.getElementsByTagName( match[1] ); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = ""; + + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + + Expr.attrHandle.href = function( elem ) { + return elem.getAttribute( "href", 2 ); + }; + } + + // release memory in IE + div = null; +})(); + +if ( document.querySelectorAll ) { + (function(){ + var oldSizzle = Sizzle, + div = document.createElement("div"), + id = "__sizzle__"; + + div.innerHTML = "

"; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function( query, context, extra, seed ) { + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && !Sizzle.isXML(context) ) { + // See if we find a selector to speed up + var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); + + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { + // Speed-up: Sizzle("TAG") + if ( match[1] ) { + return makeArray( context.getElementsByTagName( query ), extra ); + + // Speed-up: Sizzle(".CLASS") + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { + return makeArray( context.getElementsByClassName( match[2] ), extra ); + } + } + + if ( context.nodeType === 9 ) { + // Speed-up: Sizzle("body") + // The body element only exists once, optimize finding it + if ( query === "body" && context.body ) { + return makeArray( [ context.body ], extra ); + + // Speed-up: Sizzle("#ID") + } else if ( match && match[3] ) { + var elem = context.getElementById( match[3] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id === match[3] ) { + return makeArray( [ elem ], extra ); + } + + } else { + return makeArray( [], extra ); + } + } + + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(qsaError) {} + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + var oldContext = context, + old = context.getAttribute( "id" ), + nid = old || id, + hasParent = context.parentNode, + relativeHierarchySelector = /^\s*[+~]/.test( query ); + + if ( !old ) { + context.setAttribute( "id", nid ); + } else { + nid = nid.replace( /'/g, "\\$&" ); + } + if ( relativeHierarchySelector && hasParent ) { + context = context.parentNode; + } + + try { + if ( !relativeHierarchySelector || hasParent ) { + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); + } + + } catch(pseudoError) { + } finally { + if ( !old ) { + oldContext.removeAttribute( "id" ); + } + } + } + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + // release memory in IE + div = null; + })(); +} + +(function(){ + var html = document.documentElement, + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; + + if ( matches ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9 fails this) + var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), + pseudoWorks = false; + + try { + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( document.documentElement, "[test!='']:sizzle" ); + + } catch( pseudoError ) { + pseudoWorks = true; + } + + Sizzle.matchesSelector = function( node, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); + + if ( !Sizzle.isXML( node ) ) { + try { + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { + var ret = matches.call( node, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || !disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9, so check for that + node.document && node.document.nodeType !== 11 ) { + return ret; + } + } + } catch(e) {} + } + + return Sizzle(expr, null, null, [node]).length > 0; + }; + } +})(); + +(function(){ + var div = document.createElement("div"); + + div.innerHTML = "
"; + + // Opera can't find a second classname (in 9.6) + // Also, make sure that getElementsByClassName actually exists + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { + return; + } + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) { + return; + } + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function( match, context, isXML ) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + // release memory in IE + div = null; +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem.sizcache = doneName; + elem.sizset = i; + } + + if ( elem.nodeName.toLowerCase() === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem.sizcache = doneName; + elem.sizset = i; + } + + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +if ( document.documentElement.contains ) { + Sizzle.contains = function( a, b ) { + return a !== b && (a.contains ? a.contains(b) : true); + }; + +} else if ( document.documentElement.compareDocumentPosition ) { + Sizzle.contains = function( a, b ) { + return !!(a.compareDocumentPosition(b) & 16); + }; + +} else { + Sizzle.contains = function() { + return false; + }; +} + +Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; + + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +var posProcess = function( selector, context ) { + var match, + tmpSet = [], + later = "", + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE + +window.Sizzle = Sizzle; + +})(); diff --git a/application/test/UpdatePlanet.php b/application/test/UpdatePlanet.php new file mode 100644 index 0000000..f91e5af --- /dev/null +++ b/application/test/UpdatePlanet.php @@ -0,0 +1,163 @@ + 0, + + 'b_laboratory' => 0, + 'b_laboratory_id' => serialize(array()), + + "spy_tech" => 12, + "computer_tech" => 8, + "military_tech" => 10, + "defence_tech" => 10, + "shield_tech" => 10, + "energy_tech" => 8, + "hyperspace_tech" => 8, + "combustion_tech" => 6, + "impulse_motor_tech" => 6, + "hyperspace_motor_tech" => 6, + "laser_tech" => 6, + "ionic_tech" => 6, + "buster_tech" => 6, + "intergalactic_tech" => 0, + "expedition_tech" => 0, + "graviton_tech" => 0, + )); + +$data = array( + 'last_update' => 0, + 'planet_type' => 1, + + 'b_building_id' => '', + 'b_hangar_id' => serialize(array(/*array( + 'ship_id' => Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT, + 'qty' => 10, + 'created_at' => 0, + 'updated_at' => 0 + ), array( + 'ship_id' => Legacies_Empire::ID_SHIP_LARGE_TRANSPORT, + 'qty' => 20, + 'created_at' => 600, + 'updated_at' => 600 + ), array( + 'ship_id' => Legacies_Empire::ID_SHIP_LARGE_TRANSPORT, + 'qty' => 30, + 'created_at' => 650, + 'updated_at' => 650 + ), array( + 'ship_id' => Legacies_Empire::ID_SHIP_LARGE_TRANSPORT, + 'qty' => 40, + 'created_at' => 700, + 'updated_at' => 700 + )*/)), + + 'metal' => 500000, + 'metal_perhour' => 20, + 'cristal' => 500000, + 'cristal_perhour' => 10, + 'deuterium' => 300000, + 'deuterium_perhour' => 0, + 'energy_max' => 0, + 'energy_used' => 0, + + 'metal_mine_porcent' => 10, + 'cristal_mine_porcent' => 10, + 'solar_plant_porcent' => 10, + 'fusion_plant_porcent' => 10, + 'solar_satelit_porcent' => 10, + 'deuterium_sintetizer_porcent' => 10, + + 'metal_mine' => 20, + 'cristal_mine' => 19, + 'deuterium_sintetizer' => 0, + 'solar_plant' => 20, + 'fusion_plant' => 0, + 'robot_factory' => 0, + 'nano_factory' => 0, + 'hangar' => 12, + 'metal_store' => 10, + 'cristal_store' => 10, + 'deuterium_store' => 10, + + 'rpg_stockeur' => 0 + ); +$planet = new Legacies_Empire_Model_Planet($data); + +$planet->setUser($user); +//var_dump(array('$planet->setUser($user)', array_diff($planet->getAllDatas(), $data))); +$data = $planet->getAllDatas(); + +$planet->updateStorages(0); +//var_dump(array('$planet->updateStorages(0)', array_diff($planet->getAllDatas(), $data))); +$data = $planet->getAllDatas(); + +$planet->updateResourceProduction(0); +//var_dump(array('$planet->updateResourceProduction(0)', array_diff($planet->getAllDatas(), $data))); +$data = $planet->getAllDatas(); + +$planet->getShipyard()->appendQueue(Legacies_Empire::ID_SHIP_LIGHT_FIGHTER, 10, 0); +//var_dump(array('$planet->getShipyard()->appendQueue(Legacies_Empire::ID_SHIP_LIGHT_FIGHTER, 10, 0)', array_diff($planet->getAllDatas(), $data))); +$data = $planet->getAllDatas(); + +$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_CRISTAL_MINE, false, 0); +//var_dump(array('$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_CRISTAL_MINE, false, 0)', array_diff($planet->getAllDatas(), $data))); +$data = $planet->getAllDatas(); + +$userData = $user->getAllDatas(); +$planet->getResearchLab()->appendQueue(Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY, false, 0); +var_dump(array('$planet->getResearchLab()->appendQueue(Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY, false, 0)', array_diff($planet->getAllDatas(), $data), array_diff($user->getAllDatas(), $userData))); +$data = $planet->getAllDatas(); + +var_dump(array_diff($planet->getAllDatas(), $data)); +$data = $planet->getAllDatas(); + +Wootook::dispatchEvent('planet.update', array( + 'planet' => $planet, + 'time' => 5400 + )); + +var_dump(array_diff($planet->getAllDatas(), $data)); +$data = $planet->getAllDatas(); + +Wootook::dispatchEvent('planet.update', array( + 'planet' => $planet, + 'time' => (3600 * 20) + )); + +$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_CRISTAL_MINE, false, 3600); + +var_dump(array_diff($planet->getAllDatas(), $data)); +$data = $planet->getAllDatas(); + +Wootook::dispatchEvent('planet.update', array( + 'planet' => $planet, + 'time' => (3600 * 30) + )); + +var_dump(array_diff($planet->getAllDatas(), $data)); +$data = $planet->getAllDatas(); + +Wootook::dispatchEvent('planet.update', array( + 'planet' => $planet, + 'time' => (3600 * 5000) + )); + +var_dump(array_diff($planet->getAllDatas(), $data)); +$data = $planet->getAllDatas(); + +$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_CRISTAL_MINE, false, 0); +$planet->appendBuildingQueue(Legacies_Empire::ID_BUILDING_SOLAR_PLANT, false, 0); + +Wootook::dispatchEvent('planet.update', array( + 'planet' => $planet, + 'time' => (3600 * 10000) + )); + +var_dump(array_diff($planet->getAllDatas(), $data)); +$data = $planet->getAllDatas(); \ No newline at end of file diff --git a/application/test/bootstrap.php b/application/test/bootstrap.php new file mode 100644 index 0000000..3eb5410 --- /dev/null +++ b/application/test/bootstrap.php @@ -0,0 +1,46 @@ + $listenerList) { + foreach ($listenerList as $listener) { + Wootook::registerListener($event, $listener); + } +} + +include ROOT_PATH . 'includes/constants.php'; \ No newline at end of file diff --git a/application/test/registration.php b/application/test/registration.php new file mode 100644 index 0000000..e02fbe7 --- /dev/null +++ b/application/test/registration.php @@ -0,0 +1,43 @@ + array(), + 'system' => array(), + ); +*/ +for ($i = 0; $i < 10000; $i++) { + $collection = Legacies_Empire_Model_Planet::searchMostFreeSystems(); + $collection->limit(1)->load(); + $systemInfo = $collection->current(); + + //var_dump($systemInfo->getallDatas()); + echo $systemInfo->getData('galaxy') . ';' . $systemInfo->getData('system') . PHP_EOL; +/* + $galaxy = $systemInfo->getData('galaxy'); + if (!isset($datas['galaxy'][$galaxy])) { + $datas['galaxy'][$galaxy] = 1; + } else { + $datas['galaxy'][$galaxy]++; + } + + $system = $systemInfo->getData('system'); + if (!isset($datas['system'][$system])) { + $datas['system'][$system] = 1; + } else { + $datas['system'][$system]++; + } +*/ +} +/* +asort($datas['galaxy'], SORT_NUMERIC); +asort($datas['system'], SORT_NUMERIC); + +var_dump($datas); +*/ \ No newline at end of file diff --git a/src/banned.php b/banned.php similarity index 94% rename from src/banned.php rename to banned.php index 7874d75..53c3b94 100644 --- a/src/banned.php +++ b/banned.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/buddy.php b/buddy.php similarity index 98% rename from src/buddy.php rename to buddy.php index edc72dc..a59aca3 100644 --- a/src/buddy.php +++ b/buddy.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/build.xml b/build.xml deleted file mode 100644 index fe8adf3..0000000 --- a/build.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/phpcs.xml b/build/phpcs.xml deleted file mode 100644 index b2c5440..0000000 --- a/build/phpcs.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - Default coding standard - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/phpmd.xml b/build/phpmd.xml deleted file mode 100644 index 6a8b260..0000000 --- a/build/phpmd.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - Default coding standard - - - - - - - - - - - - - - - - - - diff --git a/buildings.php b/buildings.php new file mode 100644 index 0000000..babc392 --- /dev/null +++ b/buildings.php @@ -0,0 +1,151 @@ + + * 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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +require_once dirname(__FILE__) .'/application/bootstrap.php'; + +includeLang('buildings'); + +$user = Wootook_Empire_Model_User::getSingleton(); +$planet = $user->getCurrentPlanet(); +$mode = isset($_GET['mode']) ? $_GET['mode'] : null; + +switch ($mode) { +case 'fleet': + if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) < 1) { + $layout = new Wootook_Core_Layout(); + $layout->load('message'); + + $block = $layout->getBlock('message'); + $block['title'] = Wootook::__('Shipyard is required'); + $block['message'] = Wootook::__('In order to build ships you will need to build a shipyard building.'); + + $layout->render(); + break; + } + + /** @var Legacies_Empire_Model_Planet_Building_Shipyard $shipyard */ + $shipyard = $planet->getShipyard(); + if (isset($_POST['ship']) && is_array($_POST['ship'])) { + foreach ($_POST['ship'] as $shipId => $count) { + $shipId = intval($shipId); + $count = intval($count); + + $shipyard->appendQueue($shipId, $count); + } + $planet->save(); + } + + $layout = new Wootook_Core_Layout(); + $layout->load('planet.shipyard'); + + echo $layout->render(); + break; + +case 'research': + if ($planet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB) < 1) { + $layout = new Wootook_Core_Layout(); + $layout->load('message'); + + $block = $layout->getBlock('message'); + $block['title'] = Wootook::__('Research lab is required'); + $block['title'] = Wootook::__('In order to do technological researches, you will need to build a research lab building.'); + + $layout->render(); + break; + } + + if (isset($_GET['research']) && !empty($_GET['research'])) { + $data = $planet->getAllDatas(); + $planet->appendBuildingQueue(intval($_GET['research']), isset($_GET['destroy'])); + $planet->save(); + } else if (isset($_GET['cancel']) && !empty($_GET['cancel'])) { + $planet->dequeueItem($_GET['cancel']); + $planet->save(); + } + + $layout = new Wootook_Core_Layout(); + $layout->load('planet.research-lab'); + + echo $layout->render(); + break; + +case 'defense': + if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) < 1) { + $layout = new Wootook_Core_Layout(); + $layout->load('message'); + + $block = $layout->getBlock('message'); + $block['title'] = Wootook::__('Shipyard is required'); + $block['title'] = Wootook::__('In order to build ships you will need to build a shipyard building.'); + + $layout->render(); + break; + } + + /** @var Legacies_Empire_Model_Planet_Building_Shipyard $shipyard */ + $shipyard = $planet->getShipyard(); + if (isset($_POST['defense']) && is_array($_POST['defense'])) { + foreach ($_POST['defense'] as $defenseId => $count) { + $defenseId = intval($defenseId); + $count = intval($count); + + $shipyard->appendQueue($defenseId, $count); + } + $planet->save(); + } + + $layout = new Wootook_Core_Layout(); + $layout->load('planet.defense'); + + /** @var Legacies_Empire_Block_Planet_Shipyard $block */ + $block = $layout->getBlock('item-list'); + $block->setType(Legacies_Empire::TYPE_DEFENSE); + + echo $layout->render(); + break; + +default: + if (isset($_GET['building']) && !empty($_GET['building'])) { + $data = $planet->getAllDatas(); + $planet->appendBuildingQueue(intval($_GET['building']), isset($_GET['destroy'])); + $planet->save(); + } else if (isset($_GET['cancel']) && !empty($_GET['cancel'])) { + $planet->dequeueItem($_GET['cancel']); + $planet->save(); + } + + $layout = new Wootook_Core_Layout(); + $layout->load('planet.buildings'); + echo $layout->render(); + break; +} + diff --git a/src/calc.php b/calc.php similarity index 98% rename from src/calc.php rename to calc.php index ab69276..13c5db8 100644 --- a/src/calc.php +++ b/calc.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/changelog.php b/changelog.php similarity index 93% rename from src/changelog.php rename to changelog.php index ff78373..00df85d 100644 --- a/src/changelog.php +++ b/changelog.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/chat.php b/chat.php similarity index 92% rename from src/chat.php rename to chat.php index a10f64b..16254dd 100644 --- a/src/chat.php +++ b/chat.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/chat_add.php b/chat_add.php similarity index 94% rename from src/chat_add.php rename to chat_add.php index 62381d4..f3f8c13 100644 --- a/src/chat_add.php +++ b/chat_add.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/chat_msg.php b/chat_msg.php similarity index 94% rename from src/chat_msg.php rename to chat_msg.php index 7228440..acb1bfa 100644 --- a/src/chat_msg.php +++ b/chat_msg.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -62,7 +62,7 @@ while($v=mysql_fetch_object($query)){ $msg=preg_replace("#:\(#isU","\":(\"",$msg); $msg=preg_replace("#;\)#isU","\";)\"",$msg); $msg=preg_replace("#:s#isU","\":s\"",$msg); - $msg=preg_replace("#xnova#","Wootook",$msg); + $msg=preg_replace("#xnova#","Wootook",$msg); // Affichage du message $msg="
".$nick." > ".$msg."
"; diff --git a/src/application/code/core/Wootook/Empire/install/mysql5/.placeholder b/config.php similarity index 100% rename from src/application/code/core/Wootook/Empire/install/mysql5/.placeholder rename to config.php diff --git a/config.php.default b/config.php.default new file mode 100644 index 0000000..782d3d5 --- /dev/null +++ b/config.php.default @@ -0,0 +1,28 @@ + array( + 'storyline' => array( + 'universe' => 'legacies', + 'episode' => 'default', + ), + 'web' => array( + 'base_url' => 'http://testing.xnova-legacies.org/' + ), + 'date' => array( + 'timezone' => 'Europe/Paris' + ), + 'database' => array( + 'engine' => 'mysql', + 'options' => array( + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => '', + 'database' => 'db_xnova' + ), + 'table_prefix' => 'game_', + ), + 'layout' => array( + 'page' => 'page.php', + 'empire' => 'empire.php' + ) + ) + ); \ No newline at end of file diff --git a/src/contact.php b/contact.php similarity index 95% rename from src/contact.php rename to contact.php index 437950c..17fc8bf 100644 --- a/src/contact.php +++ b/contact.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify diff --git a/src/emoticones/Oo.png b/emoticones/Oo.png similarity index 100% rename from src/emoticones/Oo.png rename to emoticones/Oo.png diff --git a/src/emoticones/Smile.png b/emoticones/Smile.png similarity index 100% rename from src/emoticones/Smile.png rename to emoticones/Smile.png diff --git a/src/emoticones/cool.png b/emoticones/cool.png similarity index 100% rename from src/emoticones/cool.png rename to emoticones/cool.png diff --git a/src/emoticones/grrr.png b/emoticones/grrr.png similarity index 100% rename from src/emoticones/grrr.png rename to emoticones/grrr.png diff --git a/src/emoticones/love.png b/emoticones/love.png similarity index 100% rename from src/emoticones/love.png rename to emoticones/love.png diff --git a/src/emoticones/msn.png b/emoticones/msn.png similarity index 100% rename from src/emoticones/msn.png rename to emoticones/msn.png diff --git a/src/emoticones/perdu.png b/emoticones/perdu.png similarity index 100% rename from src/emoticones/perdu.png rename to emoticones/perdu.png diff --git a/src/emoticones/wink.png b/emoticones/wink.png similarity index 100% rename from src/emoticones/wink.png rename to emoticones/wink.png diff --git a/src/emoticones/wow.png b/emoticones/wow.png similarity index 100% rename from src/emoticones/wow.png rename to emoticones/wow.png diff --git a/extension.inc b/extension.inc new file mode 100644 index 0000000..4c28188 --- /dev/null +++ b/extension.inc @@ -0,0 +1 @@ + + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -31,7 +31,6 @@ define('INSIDE' , true); define('INSTALL' , false); require_once dirname(__FILE__) .'/application/bootstrap.php'; -$labels = Wootook_Empire_Helper_Config_Labels::getSingleton(); //Compteur de flotte en expéditions et nombre d'expédition maximum $maxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY); @@ -69,18 +68,18 @@ $position = isset($_GET['planet']) ? intval($_GET['planet']) : 0; $planetType = isset($_GET['planettype']) ? intval($_GET['planettype']) : 0; $targetMission = isset($_GET['target_mission']) ? intval($_GET['target_mission']) : 0; -$user = Wootook_Player_Model_Session::getSingleton()->getPlayer(); +$user = Wootook_Empire_Model_User::getSingleton(); $planet = $user->getCurrentPlanet(); $MaxFlyingFleets = $user->getFleetCount(); -if ($galaxy <= 0 || $galaxy > Wootook::getGameConfig('engine/universe/galaxies')) { +if ($galaxy <= 0 || $galaxy > MAX_GALAXY_IN_WORLD) { $galaxy = $planet['galaxy']; } -if ($system <= 0 || $system > Wootook::getGameConfig('engine/universe/systems')) { +if ($system <= 0 || $system > MAX_SYSTEM_IN_GALAXY) { $system = $planet['system']; } -if ($position <= 0 || $position > Wootook::getGameConfig('engine/universe/positions')) { +if ($position <= 0 || $position > MAX_PLANET_IN_SYSTEM) { $position = $planet['planet']; } @@ -229,13 +228,12 @@ if (!$planet) { $ShipData = ""; -$have_ships = false; foreach ($reslist['fleet'] as $n => $i) { - if ($planet->getElement($i) > 0) { + if ($planet[$resource[$i]] > 0) { $page .= ""; - $page .= "" . $labels[$i]['name'] . ""; - $page .= "". pretty_number ($planet->getElement($i)); - $ShipData .= "getElement($i) ."\" />"; + $page .= "" . $lang['tech'][$i] . ""; + $page .= "". pretty_number ($planet[$resource[$i]]); + $ShipData .= ""; $ShipData .= ""; $ShipData .= ""; $ShipData .= ""; @@ -245,11 +243,11 @@ foreach ($reslist['fleet'] as $n => $i) { $page .= ""; } else { $page .= "".$lang['fl_selmax']." "; - $page .= "getElement($i) ."\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" />"; + $page .= ""; } $page .= ""; - $have_ships = true; } + $have_ships = true; } $btncontinue = ""; diff --git a/fleetback.php b/fleetback.php new file mode 100644 index 0000000..d82571b --- /dev/null +++ b/fleetback.php @@ -0,0 +1,73 @@ + +Website: http://project.galacticnova.vinilox.eu/ +Last revision: 13/07/11 + +*/ + +define('INSIDE' , true); +define('INSTALL' , false); +require_once dirname(__FILE__) .'/application/bootstrap.php'; + includeLang('fleet'); + + $BoxTitle = $lang['fl_error']; + $TxtColor = "red"; + $BoxMessage = $lang['fl_notback']; + if ( is_numeric($_POST['fleetid']) ) { + $fleetid = intval($_POST['fleetid']); + + $FleetRow = doquery("SELECT * FROM {{table}} WHERE `fleet_id` = '". $fleetid ."';", 'fleets', true); + $i = 0; + + if ($FleetRow['fleet_owner'] == $user['id']) { + if ($FleetRow['fleet_mess'] == 0 || $FleetRow['fleet_mess'] == 2) { + if ($FleetRow['fleet_end_stay'] != 0) { + // Faut calculer le temps reel de retour + if ($FleetRow['fleet_start_time'] > time()) { + // On a pas encore entamé le stationnement + // Il faut calculer la parcelle de temps ecoulée depuis le lancement de la flotte + $CurrentFlyingTime = time() - $FleetRow['start_time']; + } else { + // On est deja en stationnement + // Il faut donc directement calculer la durée d'un vol aller ou retour + $CurrentFlyingTime = $FleetRow['fleet_start_time'] - $FleetRow['start_time']; + } + } else { + // C'est quoi le stationnement ?? + // On calcule sagement la parcelle de temps ecoulée depuis le depart + $CurrentFlyingTime = time() - $FleetRow['start_time']; + } + // Allez houste au bout du compte y a la maison !! (E.T. phone home.............) + $ReturnFlyingTime = $CurrentFlyingTime + time(); + + $QryUpdateFleet = "UPDATE {{table}} SET "; + $QryUpdateFleet .= "`fleet_start_time` = '". (time() - 1) ."', "; + $QryUpdateFleet .= "`fleet_end_stay` = '0', "; + $QryUpdateFleet .= "`fleet_end_time` = '". ($ReturnFlyingTime + 1) ."', "; + $QryUpdateFleet .= "`fleet_target_owner` = '". $user['id'] ."', "; + $QryUpdateFleet .= "`fleet_mess` = '1' "; + $QryUpdateFleet .= "WHERE "; + $QryUpdateFleet .= "`fleet_id` = '" . $fleetid . "';"; + doquery( $QryUpdateFleet, 'fleets'); + + $BoxTitle = $lang['fl_sback']; + $TxtColor = "lime"; + $BoxMessage = $lang['fl_isback']; + } elseif ($FleetRow['fleet_mess'] == 1) { + $BoxMessage = $lang['fl_notback']; + } + } else { + $BoxMessage = $lang['fl_onlyyours']; + } + } + + message ("". $BoxMessage ."", $BoxTitle, "fleet.". PHPEXT, 2); + +// ----------------------------------------------------------------------------------------------------------- +?> diff --git a/fleetshortcut.php b/fleetshortcut.php new file mode 100644 index 0000000..538c8ae --- /dev/null +++ b/fleetshortcut.php @@ -0,0 +1,165 @@ + + * 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 Wootook. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +require_once dirname(__FILE__) .'/application/bootstrap.php'; + + +$mode = $_GET['mode']; +$a = $_GET['a']; +/* + Este script es original xD + La funcion de este script es administrar una variable del $user + Permite agregar y quitar arrays... +*/ +//Lets start! +if(isset($_GET['mode'])){ + if($_POST){ + //Pegamos el texto :P + if($_POST["n"] == ""){$_POST["n"] = "Unbenannt";} + + $r = strip_tags($_POST[n]).",".intval($_POST[g]).",".intval($_POST[s]).",".intval($_POST[p]).",".intval($_POST[t])."\r\n"; + $user['fleet_shortcut'] .= $r; + doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users"); + message("Le raccourcis a été enregistré !","Enregistrment","fleetshortcut.php"); + } + $page = "
+ + + + "; + $page .= '
Nom [Galaxie/Système solaire/Planète]
+ + + + + +
"; + //Muestra un (L) si el destino pertenece a luna, lo mismo para escombros + $page .= "
Effacer
'; +} +elseif(isset($_GET['a'])){ + if($_POST){ + //Armamos el array... + $scarray = explode("\r\n",$user['fleet_shortcut']); + if($_POST["delete"]){ + unset($scarray[$a]); + $user['fleet_shortcut'] = implode("\r\n",$scarray); + doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users"); + message("Shortcut wurde gelöscht","Gelöscht","fleetshortcut.php"); + } + else{ + $r = explode(",",$scarray[$a]); + $r[0] = strip_tags($_POST['n']); + $r[1] = intval($_POST['g']); + $r[2] = intval($_POST['s']); + $r[3] = intval($_POST['p']); + $r[4] = intval($_POST['t']); + $scarray[$a] = implode(",",$r); + $user['fleet_shortcut'] = implode("\r\n",$scarray); + doquery("UPDATE {{table}} SET fleet_shortcut='{$user[fleet_shortcut]}' WHERE id={$user[id]}","users"); + message("Le raccourcis a été édité !.","Editer","fleetshortcut.php"); + } + } + if($user['fleet_shortcut']){ + + $scarray = explode("\r\n",$user['fleet_shortcut']); + $c = explode(',',$scarray[$a]); + + $page = "
+ + + "; + //if($i==0){$page .= "";} + $page .= " + "; + + }else{$page .= message("Le raccourcis a été enregistré !","Enregistrer","fleetshortcut.php");} + + $page .= '
Editer: {$c[0]} [{$c[1]}:{$c[2]}:{$c[3]}]
+ + + + + + +
"; + $page .= "
Retour
'; + + +} +else{ + + $page = ' + + + '; + + if($user['fleet_shortcut']){ + /* + Dentro de fleet_shortcut, se pueden almacenar las diferentes direcciones + de acceso directo, el formato es el siguiente. + Nombre, Galaxia,Sistema,Planeta,Tipo + */ + $scarray = explode("\r\n",$user['fleet_shortcut']); + $i=$e=0; + foreach($scarray as $a => $b){ + if($b!=""){ + $c = explode(',',$b); + if($i==0){$page .= "";} + $page .= ""; + if($i==1){$page .= "";} + if($i==1){$i=0;}else{$i=1;} + } + + } + if($i==1){$page .= "";} + + }else{$page .= "";} + + $page .= '
Raccourcis(Ajout)
"; + $page .= "{$c[0]} {$c[1]}:{$c[2]}:{$c[3]}"; + //Muestra un (L) si el destino pertenece a luna, lo mismo para escombros + if($c[4]==2){$page .= " (E)";}elseif($c[4]==3){$page .= " (L)";} + $page .= "
Pas de Raccourcis
Retour
'; +} +display($page,"Shortcutmanager"); + +// Created by Perberos. All rights reversed (C) 2006 +?> diff --git a/src/floten1.php b/floten1.php similarity index 86% rename from src/floten1.php rename to floten1.php index 5c881a1..42bb9c7 100644 --- a/src/floten1.php +++ b/floten1.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -46,7 +46,7 @@ $speed = array( 1 => 10, ); -$user = Wootook_Player_Model_Session::getSingleton()->getPlayer(); +$user = Wootook_Empire_Model_User::getSingleton(); $planetrow = $user->getCurrentPlanet(); $g = isset($_POST['galaxy']) ? intval($_POST['galaxy']) : 0; @@ -54,13 +54,13 @@ $s = isset($_POST['system']) ? intval($_POST['system']) : 0; $p = isset($_POST['planet']) ? intval($_POST['planet']) : 0; $t = isset($_POST['planet_type']) ? intval($_POST['planet_type']) : 0; -if ($g <= 0 || $g > Wootook::getGameConfig('engine/universe/galaxies')) { +if ($g <= 0 || $g > MAX_GALAXY_IN_WORLD) { $g = $planetrow['galaxy']; } -if ($s <= 0 || $s > Wootook::getGameConfig('engine/universe/systems')) { +if ($s <= 0 || $s > MAX_SYSTEM_IN_GALAXY) { $s = $planetrow['system']; } -if ($p <= 0 || $p > Wootook::getGameConfig('engine/universe/positions')) { +if ($p <= 0 || $p > MAX_PLANET_IN_SYSTEM) { $p = $planetrow['planet']; } $allowedPlanetTypes = array( @@ -128,8 +128,8 @@ if (empty($fleetArray)) { $speedFactor = GetGameSpeedFactor(); $session['speedallsmin'] = $speedallsmin; -$scriptPath = Wootook::getStaticUrl('scripts/flotten.js'); -$page = ""; +$scriptPath = Wootook::getUrl('scripts/flotten.js'); +$page .= ""; $page .= ""; diff --git a/src/floten2.php b/floten2.php similarity index 80% rename from src/floten2.php rename to floten2.php index 1563070..367df96 100644 --- a/src/floten2.php +++ b/floten2.php @@ -3,9 +3,9 @@ * This file is part of Wootook * * @license http://www.gnu.org/licenses/gpl-3.0.txt - * @see http://wootook.org/ + * @see http://www.wootook.com/ * - * Copyright (c) 2009-Present, Wootook Support Team + * Copyright (c) 2009-Present, Wootook Support Team * All rights reserved. * * This program is free software: you can redistribute it and/or modify @@ -37,20 +37,20 @@ $session = Wootook::getSession('fleet'); $galaxy = isset($_POST['galaxy']) ? intval($_POST['galaxy']) : 0; $system = isset($_POST['system']) ? intval($_POST['system']) : 0; -$position = isset($_POST['planet']) ? intval($_POST['planet']) : 0; -$planetType = isset($_POST['planettype']) ? intval($_POST['planettype']) : 0; +$planet = isset($_POST['planet']) ? intval($_POST['planet']) : 0; +$planettype = isset($_POST['planettype']) ? intval($_POST['planettype']) : 0; $speed = isset($_POST['speed']) ? intval($_POST['speed']) : 10; $coords = array( 'galaxy' => $galaxy, 'system' => $system, - 'position' => $position + 'position' => $planet ); -$destination = Wootook_Empire_Model_Planet::factoryFromCoords($coords, $planetType); +$destination = Wootook_Empire_Model_Planet::factoryFromCoords($coords, $planettype); $session['planet_destination'] = $destination->getId(); -$user = Wootook_Player_Model_Session::getSingleton()->getPlayer(); -$planet = $user->getCurrentPlanet(); +$user = Wootook_Empire_Model_User::getSingleton(); +$planetrow = $user->getCurrentPlanet(); $YourPlanet = false; if ($destination->getUserId() == $user->getId()) { @@ -62,28 +62,22 @@ if ($destination->getId()) { } $fleetArray = $session['fleet']; -if (empty($fleetArray)) { - Wootook::getResponse() - ->setRedirect(Wootook::getStaticUrl('fleet.php')) - ->sendHeaders(); - exit(0); -} $missionTypes = array(); // Determinons les type de missions possibles par rapport a la planete cible -if ($position == (Wootook::getGameConfig('engine/universe/positions') + 1)) { +if ($position == (MAX_PLANET_IN_SYSTEM + 1)) { $missionTypes[Legacies_Empire::ID_MISSION_EXPEDITION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION]; } else { - if ($planetType == Wootook_Empire_Model_Planet::TYPE_DEBRIS) { + if ($planettype == Wootook_Empire_Model_Planet::TYPE_DEBRIS) { if (isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) { $missionTypes[Legacies_Empire::ID_MISSION_RECYCLE] = $lang['type_mission'][Legacies_Empire::ID_MISSION_RECYCLE]; } - } else if ($planetType == Wootook_Empire_Model_Planet::TYPE_PLANET) { + } else if ($planettype == Wootook_Empire_Model_Planet::TYPE_PLANET) { if (isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0 && !$UsedPlanet) { $missionTypes[Legacies_Empire::ID_MISSION_SETTLE_COLONY] = $lang['type_mission'][7]; } - } else if ($planetType == Wootook_Empire_Model_Planet::TYPE_MOON) { + } else if ($planettype == Wootook_Empire_Model_Planet::TYPE_MOON) { if (((isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) || (isset($fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA]) && $fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA] > 0)) && !$YourPlanet && $UsedPlanet) { @@ -91,7 +85,7 @@ if ($position == (Wootook::getGameConfig('engine/universe/positions') + 1)) { } } - if (in_array($planetType, array(Wootook_Empire_Model_Planet::TYPE_MOON, Wootook_Empire_Model_Planet::TYPE_PLANET))) { + if (in_array($planettype, array(Wootook_Empire_Model_Planet::TYPE_MOON, Wootook_Empire_Model_Planet::TYPE_PLANET))) { if (isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && !$YourPlanet) { $missionTypes[Legacies_Empire::ID_MISSION_SPY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_SPY]; } @@ -102,8 +96,9 @@ if ($position == (Wootook::getGameConfig('engine/universe/positions') + 1)) { (isset($fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER] > 0) || (isset($fleetArray[Legacies_Empire::ID_SHIP_CRUISER]) && $fleetArray[Legacies_Empire::ID_SHIP_CRUISER] > 0) || (isset($fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP] > 0) || + (isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0) || (isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && Wootook::getGameConfig('engine/combat/allow_spy_drone_attacks')) || + (isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && ALLOW_SPY_DRONE_ATTACKS) || (isset($fleetArray[Legacies_Empire::ID_SHIP_BOMBER]) && $fleetArray[Legacies_Empire::ID_SHIP_BOMBER] > 0) || (isset($fleetArray[Legacies_Empire::ID_SHIP_DESTRUCTOR]) && $fleetArray[Legacies_Empire::ID_SHIP_DESTRUCTOR] > 0) || (isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) || @@ -130,11 +125,11 @@ if (isset($fleetArray[Legacies_Empire::ID_SHIP_SOLAR_SATELLITE])) { $mission = isset($_POST['target_mission']) ? $_POST['target_mission'] : 0; -$SpeedFactor = Wootook::getGameConfig('game/speed/general'); +$SpeedFactor = GetGameSpeedFactor(); $AllFleetSpeed = GetFleetMaxSpeed($fleetArray, 0, $user); $MaxFleetSpeed = min($AllFleetSpeed); -$distance = GetTargetDistance($planet->getGalaxy(), $galaxy, $planet->getSystem(), $system, $planet->getPosition(), $position); +$distance = GetTargetDistance($planetrow->getGalaxy(), $galaxy, $planetrow->getSystem(), $system, $planetrow->getPosition(), $planet); $duration = GetMissionDuration($speed, $MaxFleetSpeed, $distance, $SpeedFactor); $consumption = GetFleetConsumption($fleetArray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user ); @@ -144,12 +139,12 @@ $session['consumption'] = $consumption; $session['speed'] = $speed; $session['galaxy'] = $galaxy; $session['system'] = $system; -$session['position'] = $position; -$session['type'] = $planetType; +$session['position'] = $planet; +$session['type'] = $planettype; $MissionSelector = ""; if (count($missionTypes) > 0) { - if ($position == (Wootook::getGameConfig('engine/universe/positions') + 1)) { + if ($planet == (MAX_PLANET_IN_SYSTEM + 1)) { $MissionSelector .= ""; $MissionSelector .= ""; $MissionSelector .= "". $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION] ."

"; @@ -176,36 +171,27 @@ if (count($missionTypes) > 0) { $MissionSelector .= ""; } -if ($planet->isPlanet()) { - $TableTitle = "{$planet->getCoords()} - {$lang['fl_planet']}"; -} elseif ($planet->isMoon()) { - $TableTitle = "{$planet->getCoords()} - {$lang['fl_moon']}"; +if ($planetrow->isPlanet()) { + $TableTitle = "{$planetrow->getCoords()} - {$lang['fl_planet']}"; +} elseif ($planetrow->isMoon()) { + $TableTitle = "{$planetrow->getCoords()} - {$lang['fl_moon']}"; } -$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read'); $maxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY); $ExpeditionEnCours = 0; $EnvoiMaxExpedition = 0; if ($maxExpedition >= 1) { - $ExpeditionEnCours = $readAdapter->select() - ->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)')) - ->from(array('fleet' => $readAdapter->getTable('fleets'))) - ->where('fleet_owner', $user->getId()) - ->where('fleet_mission', Legacies_Empire::ID_MISSION_EXPEDITION) - ->prepare() - ->fetchColumn() - ; + $maxexpde = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets'); + $ExpeditionEnCours = $maxexpde->rowCount(); + $maxexpde->closeCursor(); - $EnvoiMaxExpedition = 1 + floor(sqrt($maxExpedition)); + $EnvoiMaxExpedition = 1 + floor($maxExpedition / 3); } -$MaxFlyingFleets = $readAdapter->select() - ->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)')) - ->from(array('fleet' => $readAdapter->getTable('fleets'))) - ->where('fleet_owner', $user->getId()) - ->prepare() - ->fetchColumn() -; +$maxfleet = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets'); + +$MaxFlyingFleets = $maxfleet->rowCount(); +$maxfleet->closeCursor(); $page = ""; $page .= " -HTML_EOF; - } - return $render; - } - - public function renderSkinJs() - { - $render = ''; - foreach ($this->getJs() as $js) { - if (!isset($js['type'])) { - $js['type'] = 'text/javascript'; - } - $url = $this->getSkinUrl($js['path'], array(), $js['theme'], $js['package']); - $render .=<< -HTML_EOF; - } - return $render; - } - - public function renderInlineJs() - { - foreach ($this->getInlineJs() as $js) { - $render .=<</**/ -HTML_EOF; - } - return $render; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Block/Html/Home.php b/src/application/code/core/Wootook/Core/Block/Html/Home.php deleted file mode 100644 index ac43612..0000000 --- a/src/application/code/core/Wootook/Core/Block/Html/Home.php +++ /dev/null @@ -1,22 +0,0 @@ -_getNode($explodedPath); - - $child = $this->getLayout() - ->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array( - 'url' => array( - 'uri' => $uri, - 'params' => $params - ), - 'label' => $label, - 'title' => $title, - 'classes' => $classes, - 'attributes' => $attributes - )); - $parent->setPartial($baseName, $child); - - if ($template !== null) { - $child->setTemplate($template); - } - - return $this; - } - public function addStaticLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null, Array $attributes = array()) - { - $explodedPath = explode('/', $name); - $baseName = array_pop($explodedPath); - $parent = $this->_getNode($explodedPath); - - $child = $this->getLayout() - ->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array( - 'url' => array( - 'uri' => $uri, - 'params' => $params, - 'static' => true - ), - 'label' => $label, - 'title' => $title, - 'classes' => $classes, - 'attributes' => $attributes - )); - $parent->setPartial($baseName, $child); - - if ($template !== null) { - $child->setTemplate($template); - } - - return $this; - } - - public function addExternalLink($name, $label, $title, $url, Array $classes = array(), $template = null, Array $attributes = array()) - { - $explodedPath = explode('/', $name); - $baseName = array_pop($explodedPath); - $parent = $this->_getNode($explodedPath); - - $child = $this->getLayout() - ->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array( - 'url' => $url, - 'label' => $label, - 'title' => $title, - 'classes' => $classes, - 'attributes' => $attributes - )); - $parent->setPartial($baseName, $child); - - if ($template !== null) { - $child->setTemplate($template); - } - - return $this; - } - - public function addPopupLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null, Array $attributes = array()) - { - $uri = $this->getStaticUrl($uri, $params); - - $attributes['onclick'] = "f('{$params}', '{$label}');return false;"; - - return $this->addLink($name, $label, $title, null, array(), $classes, $template, $attributes); - } - - public function setNodeTitle($path, $title) - { - return $this->getNode($path)->setTitle($title); - } - - public function setNodeTemplate($path, $template) - { - return $this->getNode($path)->setTemplate($template); - } - - public function getNode($path) - { - return $this->_getNode(explode('/', $path)); - } - - protected function _getNode($explodedPath) - { - $name = array_shift($explodedPath); - - if ($this->hasPartial($name)) { - $child = $this->getPartial($name); - } else { - $child = $this->getLayout() - ->createBlock('core/html.navigation.node', $this->getNameInLayout() . '.' . $name); - - $this->setPartial($name, $child); - } - - if ($child instanceof Wootook_Core_Block_Html_Navigation_Link) { - throw new Wootook_Core_Exception_RuntimeException('Node is a link. Could not append a child node to a link node.'); - } - - if (count($explodedPath) == 0) { - return $child; - } - return $child->_getNode($explodedPath); - } -} diff --git a/src/application/code/core/Wootook/Core/Block/Html/Navigation/Link.php b/src/application/code/core/Wootook/Core/Block/Html/Navigation/Link.php deleted file mode 100644 index 82a09fa..0000000 --- a/src/application/code/core/Wootook/Core/Block/Html/Navigation/Link.php +++ /dev/null @@ -1,201 +0,0 @@ -_template !== null) { - return $this->_template; - } - return 'page/html/navigation/link.phtml'; - } - - public function setLabel($label) - { - $this->_label = $label; - - return $this; - } - - public function getLabel() - { - return $this->_label; - } - - public function setTitle($title) - { - $this->_title = $title; - - return $this; - } - - public function getTitle() - { - return $this->_title; - } - - public function setStaticUrl($uri, $params = array()) - { - if ($uri === null) { - return $this; - } - - $this->_uri = $uri; - $this->_params = $params; - $this->_url = $this->getStaticUrl($uri, $params); - - return $this; - } - - public function setUrl($uri, $params = array()) - { - if ($uri === null) { - return $this; - } - - $this->_uri = $uri; - $this->_params = $params; - $this->_url = $this->getUrl($uri, $params); - - return $this; - } - - public function setExternalUrl($url) - { - $this->_url = $url; - $this->_uri = null; - $this->_params = array(); - - return $this; - } - - public function getLinkUrl($moreParams = array()) - { - if (empty($moreParams) || $this->_uri === null) { - return $this->_url; - } - $params = array_merge($this->_params, $moreParams); - return $this->getStaticUrl($this->_uri, $params); - } - - public function setAttribute($attributeName, $attributeValue) - { - $this->_attributes[$attributeName] = $attributeValue; - - return $this; - } - - public function getAttribute($attributeName) - { - if ($this->hasAttribute($attributeName)) { - return $this->_attributes[$attributeName]; - } - return null; - } - - public function hasAttribute($attributeName) - { - if (isset($this->_attributes[$attributeName])) { - return true; - } - return false; - } - - public function unsetAttribute($attributeName) - { - if ($this->hasAttribute($attributeName)) { - unset($this->_attributes[$attributeName]); - } - return $this; - } - - public function getAttributes() - { - return $this->_attributes; - } - - public function addClass($class) - { - $this->_classes[] = $class; - - return $this; - } - - public function clearClasses() - { - $this->_classes = array(); - - return $this; - } - - public function renderClasses(Array $moreClasses = array()) - { - $classes = array_merge($this->_classes, $moreClasses); - return implode(' ', $classes); - } - - public function __construct(Array $data = array()) - { - if (isset($data['label'])) { - $this->setLabel($data['label']); - unset($data['label']); - } - - if (isset($data['title'])) { - $this->setTitle($data['title']); - unset($data['title']); - } - - if (isset($data['url'])) { - if (is_array($data['url']) && isset($data['url']['uri'])) { - if (isset($data['url']['static']) && $data['url']['static']) { - if (isset($data['url']['params'])) { - $this->setStaticUrl($data['url']['uri'], $data['url']['params']); - } else { - $this->setStaticUrl($data['url']['uri']); - } - } else { - if (isset($data['url']['params'])) { - $this->setUrl($data['url']['uri'], $data['url']['params']); - } else { - $this->setUrl($data['url']['uri']); - } - } - } else { - $this->setExternalUrl($data['url']); - } - unset($data['url']); - } - - if (isset($data['classes'])) { - $classes = (array) $data['classes']; - unset($data['classes']); - - foreach ($classes as $class) { - $this->addClass(trim($class)); - } - } - - if (isset($data['attributes'])) { - $attributes = (array) $data['attributes']; - unset($data['attributes']); - - foreach ($attributes as $attributeName => $attributeValue) { - $this->setAttribute($attributeName, $attributeValue); - } - } - - parent::__construct($data); - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Block/Messages.php b/src/application/code/core/Wootook/Core/Block/Messages.php deleted file mode 100644 index 5aa7cb4..0000000 --- a/src/application/code/core/Wootook/Core/Block/Messages.php +++ /dev/null @@ -1,47 +0,0 @@ -_storages[] = $namespace; - } - - public function renderGroupedHtml() - { - $messages = array(); - - foreach ($this->_storages as $namespace) { - $session = Wootook::getSession($namespace); - - $messageList = $session->getMessages(); - if (!is_array($messageList)) { - continue; - } - foreach ($messageList as $messageLevel => $messageList) { - if (!isset($messages[$messageLevel])) { - $messages[$messageLevel] = $messageList; - } else { - $messages[$messageLevel] += $messageList; - } - } - } - - rsort($messages, SORT_NUMERIC); - - $output = '
'; - foreach ($messages as $messageLevel => $messageList) { - $output .= "
    "; - foreach ($messageList as $message) { - $output .= "
  • {$message}
  • "; - } - $output .= '
'; - } - $output .= '
'; - - return $output; - } -} diff --git a/src/application/code/core/Wootook/Core/Block/Template.php b/src/application/code/core/Wootook/Core/Block/Template.php deleted file mode 100644 index 1383a4e..0000000 --- a/src/application/code/core/Wootook/Core/Block/Template.php +++ /dev/null @@ -1,46 +0,0 @@ -getScriptPath() == '') { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException(new Wootook_Core_Exception_RuntimeException("No script path defined in block {$this->getNameInLayout()}.")); - return null; - } - - $pattern = "{$this->getScriptPath()}/%s/%s/scripts/{$file}"; - if (($layout = $this->getLayout()) !== null) { - $package = $this->getLayout()->getPackage(); - $theme = $this->getLayout()->getTheme(); - - if ($package !== Wootook_Core_Model_Layout::DEFAULT_PACKAGE) { - if ($theme !== Wootook_Core_Model_Layout::DEFAULT_THEME) { - $path = sprintf($pattern, $package, $theme); - if (Wootook::fileExists($path)) { - return $path; - } - } - - $path = sprintf($pattern, $package, Wootook_Core_Model_Layout::DEFAULT_THEME); - if (Wootook::fileExists($path)) { - return $path; - } - } - } else { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException(new Wootook_Core_Exception_RuntimeException("No layout defined.")); - } - - $path = sprintf($pattern, Wootook_Core_Model_Layout::DEFAULT_PACKAGE, Wootook_Core_Model_Layout::DEFAULT_THEME); - if (Wootook::fileExists($path)) { - return $path; - } - - Wootook_Core_ErrorProfiler::getSingleton() - ->addException(new Wootook_Core_Exception_RuntimeException("Template '{$file}' could not be found.")); - return null; - } -} diff --git a/src/application/code/core/Wootook/Core/Config/Adapter/Adapter.php b/src/application/code/core/Wootook/Core/Config/Adapter/Adapter.php deleted file mode 100644 index bec4430..0000000 --- a/src/application/code/core/Wootook/Core/Config/Adapter/Adapter.php +++ /dev/null @@ -1,6 +0,0 @@ -load($filename); - } - } - - public function load($filename) - { - if (!file_exists($filename)) { - throw new Wootook_Core_Exception_DataAccessException(sprintf('Could not load config file "%s"', $filename)); - } - $data = include $filename; - - if (!is_array($data)) { - throw new Wootook_Core_Exception_DataAccessException('Configuration file could not be loaded.'); - } - - $this->_init($data); - - return $this; - } - - public function save($filename) - { - file_put_contents($filename, '<' . '?p' . 'hp return ' . var_export($this->toArray(), true) . ';'); - - return $this; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Config/Node.php b/src/application/code/core/Wootook/Core/Config/Node.php deleted file mode 100644 index 309c1cf..0000000 --- a/src/application/code/core/Wootook/Core/Config/Node.php +++ /dev/null @@ -1,247 +0,0 @@ -_init($data, $parent); - } - - public function setData(Array $data = array()) - { - $this->_init($data); - - return $this; - } - - protected function _init(Array $data, $parent = null) - { - if ($parent !== null) { - $this->_parent = $parent; - } - - $this->_children = array(); - - foreach ($data as $key => $value) { - if (is_array($value)) { - $this->offsetSet($key, new self($value, $this)); - } else { - $this->offsetSet($key, $value); - } - } - - return $this; - } - - public function getParent() - { - return $this->_parent; - } - - public function setConfig($path, $value) - { - $explodedPath = explode('/', $path); - - $length = count($explodedPath); - $currentNode = $this; - for ($i = 0; $i < $length; $i++) { - if ($i < ($length - 1)) { - if (!$currentNode->offsetExists($explodedPath[$i])) { - $newNode = new Wootook_Core_Config_Node(array(), $currentNode); - $currentNode->offsetSet($explodedPath[$i], $newNode); - } - } else if (is_array($value)) { - $currentNode->offsetSet($explodedPath[$i], new self($value, $this)); - break; - } else { - $currentNode->offsetSet($explodedPath[$i], $value); - break; - } - - $currentNode = $currentNode->offsetGet($explodedPath[$i]); - - if (!$currentNode instanceof Wootook_Core_Config_Node) { - throw new Wootook_Core_Exception_RuntimeException(); - } - } - - return $this; - } - - public function getConfig($path) - { - $explodedPath = explode('/', $path); - - $length = count($explodedPath); - $currentNode = $this; - for ($i = 0; $i < $length; $i++) { - if (!$currentNode instanceof Wootook_Core_Config_Node) { - throw new Wootook_Core_Exception_RuntimeException(); - } - if (!$currentNode->offsetExists($explodedPath[$i])) { - return null; - } - - $currentNode = $currentNode->offsetGet($explodedPath[$i]); - } - - return $currentNode; - } - - public function toArray() - { - $result = array(); - foreach ($this->_children as $key => $child) { - if ($child instanceof self) { - $result[$key] = $child->toArray(); - } else if ($child instanceof Wootook_Core_Config_Leaf) { - $result[$key] = $child->getValue(); - } else { - $result[$key] = $child; - } - } - return $result; - } - - public function reset() - { - $this->_children = array(); - $this->_parent = null; - - return $this; - } - - public function merge(self $node) - { - foreach ($node->_children as $offset => $value) { - if ($value instanceof self) { - if (!$this->offsetExists($offset)) { - $this->offsetSet($offset, new self(array(), $this)); - } - $this->offsetGet($offset)->merge($value); - } else { - $this->offsetSet($offset, $value); - } - } - - return $this; - } - - private function _resolveAttributeName($key) - { - if (is_numeric($key)) { - return $key; - } - if (!isset(self::$_attributeNameCache[$key])) { - self::$_attributeNameCache[$key] = strtolower(preg_replace('#([A-Z])#', '-\\1', $key)); - } - return self::$_attributeNameCache[$key]; - } - - public function __get($offset) - { - return $this->offsetGet($this->_resolveAttributeName($offset)); - } - - public function __set($offset, $value) - { - return $this->offsetSet($this->_resolveAttributeName($offset), $value); - } - - public function __isset($offset) - { - return $this->offsetExists($this->_resolveAttributeName($offset)); - } - - public function __unset($offset) - { - return $this->offsetUnset($this->_resolveAttributeName($offset)); - } - - public function __clone() - { - $clone = new self(); - - foreach ($this->_children as $childName => $childNode) { - if ($childNode instanceof self) { - $childNode = clone $childNode; - $childNode->_parent = $clone; - } - - $clone->offsetSet($childName, $childNode); - } - - return $clone; - } - - public function offsetGet($offset) - { - if ($this->offsetExists($offset)) { - return $this->_children[$offset]; - } - return null; - } - - public function offsetSet($offset, $value) - { - if ($offset === null) { - $this->_children[] = $value; - } else { - $this->_children[$offset] = $value; - } - - return $value; - } - - public function offsetExists($offset) - { - if (isset($this->_children[$offset])) { - return true; - } - return false; - } - - public function offsetUnset($offset) - { - if ($this->offsetExists($offset)) { - unset($this->_children[$offset]); - } - } - - public function valid() - { - return key($this->_children); - } - - public function next() - { - next($this->_children); - } - - public function current() - { - return current($this->_children); - } - - public function rewind() - { - reset($this->_children); - } - - public function key() - { - return key($this->_children); - } - - public function count() - { - return count($this->_children); - } -} diff --git a/src/application/code/core/Wootook/Core/Controller/ErrorController.php b/src/application/code/core/Wootook/Core/Controller/ErrorController.php deleted file mode 100644 index 0a2e348..0000000 --- a/src/application/code/core/Wootook/Core/Controller/ErrorController.php +++ /dev/null @@ -1,11 +0,0 @@ -loadLayout('no-route'); - $this->renderLayout(); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Controller/IndexController.php b/src/application/code/core/Wootook/Core/Controller/IndexController.php deleted file mode 100644 index c77c6f0..0000000 --- a/src/application/code/core/Wootook/Core/Controller/IndexController.php +++ /dev/null @@ -1,11 +0,0 @@ -loadLayout('home'); - $this->renderLayout(); - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Adapter/Adapter.php b/src/application/code/core/Wootook/Core/Database/Adapter/Adapter.php deleted file mode 100644 index 41d8bdb..0000000 --- a/src/application/code/core/Wootook/Core/Database/Adapter/Adapter.php +++ /dev/null @@ -1,199 +0,0 @@ -_handler; - } - - public function getDataMapper() - { - return new Wootook_Core_Database_Orm_DataMapper(); - } - - /** - * - * @param string $prefix - * @return Wootook_Core_Database_Adapter_Pdo_Mysql - */ - public function setTablePrefix($prefix) - { - $this->_tablePrefix = $prefix; - - return $this; - } - - /** - * @return string - */ - public function getTablePrefix() - { - return $this->_tablePrefix; - } - - /** - * @return string - */ - public function getTable($table) - { - return $this->getTablePrefix() . $table; - } - - /** - * @return Wootook_Core_Database_Sql_Select - */ - public function select() - { - return new Wootook_Core_Database_Sql_Select($this); - } - - /** - * @return Wootook_Core_Database_Sql_Insert - */ - public function insert() - { - return new Wootook_Core_Database_Sql_Insert($this); - } - - /** - * @return Wootook_Core_Database_Sql_Update - */ - public function update() - { - return new Wootook_Core_Database_Sql_Update($this); - } - - /** - * @return Wootook_Core_Database_Sql_Delete - */ - public function delete() - { - return new Wootook_Core_Database_Sql_Delete($this); - } - - /** - * @param string $data - * @return string - */ - abstract public function quote($data); - - /** - * @param string $identifier - * @return string - */ - abstract public function quoteIdentifier($identifier); - - /** - * @param string $identifier - * @return string - */ - public function quoteInto($string, $values) - { - $parts = preg_split('#(:[\w_]+|[?])#', $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - - $result = ''; - if (is_array($values)) { - $index = 0; - foreach ($parts as $part) { - if ($part == '?') { - $result .= $this->quote($values[$index++]); - } else if (!empty($part) && $part[0] == ':') { - $key = substr($part, 1); - - if (isset($values[$key])) { - $result .= $this->quote($values[$key]); - } else if (isset($values[$part])) { - $result .= $this->quote($values[$part]); - } else { - $result .= $part; - } - } else { - $result .= $part; - } - } - } else { - foreach ($parts as $part) { - if ($part == '?' || $part[0] == ':') { - $result .= $this->quote($values); - } else { - $result .= $part; - } - } - } - - return $result; - } - - /** - * @return Wootook_Core_Database_Statement_Statement - */ - public function query($sql, Array $params = null) - { - $statement = $this->prepare($sql, $params); - if (!$statement->execute()) { - $message = sprintf('[SQLSTATE %s] Could not execute query: %s', $statement->errorState(), $statement->errorMessage()); - throw new Wootook_Core_Exception_Database_StatementError($statement, $message); - } - - return $statement; - } - - /** - * @return bool - */ - public function execute($sql, Array $params = null) - { - $statement = $this->prepare($sql); - return $statement->execute($params); - } - - /** - * @return Wootook_Core_Database_Statement_Statement - */ - abstract public function prepare($sql, Array $params = null); - - /** - * @return bool - */ - abstract public function beginTransaction(); - - /** - * @return bool - */ - abstract public function commit(); - - /** - * @return bool - */ - abstract public function rollback(); - - /** - * @return bool - */ - abstract public function lastInsertId(); - - /** - * @return string - */ - abstract public function errorCode(); - - /** - * @return string - */ - abstract public function errorMessage(); - - /** - * @return array - */ - abstract public function errorInfo(); - - /** - * @return string - */ - abstract public function errorState(); -} diff --git a/src/application/code/core/Wootook/Core/Database/Adapter/Pdo/Mysql.php b/src/application/code/core/Wootook/Core/Database/Adapter/Pdo/Mysql.php deleted file mode 100644 index 5270cf2..0000000 --- a/src/application/code/core/Wootook/Core/Database/Adapter/Pdo/Mysql.php +++ /dev/null @@ -1,170 +0,0 @@ -hostname};dbname={$config->database}"; - if (is_numeric($config->port)) { - $dsn .= ";port={$config->database}"; - } - - if (!isset($options[Wootook_Core_Database_ConnectionManager::ATTR_ERRMODE])) { - $options[Wootook_Core_Database_ConnectionManager::ATTR_ERRMODE] = Wootook_Core_Database_ConnectionManager::ERRMODE_EXCEPTION; - } - - try { - $this->_handler = new PDO($dsn, $config->username, $config->password, $options); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e); - } - } - - /** - * (non-PHPdoc) - * @see Wootook_Core_Database_Adapter_Adapter::quoteIdentifier() - */ - public function quoteIdentifier($identifier) - { - return "`$identifier`"; - } - - public function quote($data) - { - try { - return $this->_handler->quote($data); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e); - } - return null; - } - - /** - * - * @param string $name - * @return string - */ - public function getTable($name) - { - return $this->getTablePrefix() . $name; - } - - /** - * @see Wootook_Core_Database_Adapter_Adapter::select() - */ - public function select($tableName = null) - { - return new Wootook_Core_Database_Sql_Mysql_Select($this, $tableName); - } - - /** - * @return Wootook_Core_Database_Statement_Statement - */ - public function prepare($sql, Array $params = null) - { - $statement = new Wootook_Core_Database_Statement_Pdo_Mysql($this, $sql); - - if ($params !== null) { - foreach ($params as $paramKey => $paramValue) { - $statement->bindValue($paramKey, $paramValue, $statement->getParamType($paramValue)); - } - } - - return $statement; - } - - /** - * @return bool - */ - public function beginTransaction() - { - try { - return $this->_handler->beginTransaction(); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * @return bool - */ - public function commit() - { - try { - return $this->_handler->commit(); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * @return bool - */ - public function rollback() - { - try { - return $this->_handler->rollback(); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * @return int - */ - public function lastInsertId() - { - try { - return $this->_handler->lastInsertId(); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * @return string - */ - public function errorCode() - { - return $this->_handler->errorCode(); - } - - /** - * @return array - */ - public function errorInfo() - { - return $this->_handler->errorInfo(); - } - - /** - * @return string - */ - public function errorMessage() - { - $info = $this->_handler->errorInfo(); - - return $info[2]; - } - - /** - * @return string - */ - public function errorState() - { - $info = $this->_handler->errorInfo(); - - return $info[0]; - } -} diff --git a/src/application/code/core/Wootook/Core/Database/ConnectionManager.php b/src/application/code/core/Wootook/Core/Database/ConnectionManager.php deleted file mode 100644 index 4ba8289..0000000 --- a/src/application/code/core/Wootook/Core/Database/ConnectionManager.php +++ /dev/null @@ -1,202 +0,0 @@ -registerNamespace('Wootook_Core_Database_Adapter_'); - } - - /** - * @return Wootook_Core_Database_ConnectionManager - */ - public static function getSingleton() - { - if (self::$_singleton === null) { - self::$_singleton = new self(); - } - return self::$_singleton; - } - - protected $_defaultOptions = array( - self::ATTR_ERRMODE => self::ERRMODE_EXCEPTION - ); - - /** - * @param $connectionName - * @return Wootook_Core_Database_Adapter_Adapter - */ - public function getConnection($connectionName) - { - if (empty($connectionName) || $connectionName === null) { - return null; - } - - if (!isset($this->_connections[$connectionName])) { - if (isset($this->_connectionAliases[$connectionName])) { - return $this->_connectionAliases[$connectionName]; - } - - $connectionConfig = Wootook::getConfig("resource/database/{$connectionName}"); - if ($connectionConfig === null) { - return null; - } - if ($alias = $connectionConfig->use) { - $this->_connectionAliases[$connectionName] = self::getConnection($alias); - - return $this->_connectionAliases[$connectionName]; - } - - $this->_connections[$connectionName] = self::_initConnection($connectionName, - $connectionConfig->engine, $connectionConfig->params, $connectionConfig->options); - } - - return $this->_connections[$connectionName]; - } - - private function _initConnection($connectionName, $engine, $params, $options = array()) - { - if (is_array($params)) { - $params = new Wootook_Core_Config_Node($params); - } else if (!$params instanceof Wootook_Core_Config_Node) { - $params = new Wootook_Core_Config_Node(array()); - } - - if ($options instanceof Wootook_Core_Config_Node) { - $options = $options->toArray(); - } else if (!is_array($options)) { - $options = array(); - } - - if (empty($params->hostname) || empty($params->username) || empty($params->database)) { - return null; - } - - $event = Wootook::dispatchEvent('database.prepare-options', array( - 'name' => $connectionName, - 'options' => array_merge($this->_defaultOptions, $options) - )); - - $options = $event->getData('options'); - - $connection = $this->load($engine, false, array($params, $options)); - - if (!$connection) { - throw new Wootook_Core_Exception_Database_AdapterError('Could not find data connection handler.'); - } - - if (($prefix = Wootook::getConfig("resource/database/{$connectionName}/table_prefix")) !== null) { - $connection->setTablePrefix($prefix); - } - - Wootook::dispatchEvent('database.init', array( - 'name' => $connectionName, - 'handler' => $connection - )); - - return $connection; - } - - protected function _load($className, $useSingleton, Array $constructorParams = array()) - { - $reflection = new ReflectionClass($className); - return $reflection->newInstanceArgs($constructorParams); - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper.php b/src/application/code/core/Wootook/Core/Database/Orm/DataMapper.php deleted file mode 100644 index d4dc61f..0000000 --- a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper.php +++ /dev/null @@ -1,115 +0,0 @@ -registerNamespace('Wootook_Core_Database_Orm_DataMapper_'); - - if (!is_array($config) || !$config instanceof Wootook_Core_Config_Node) { - return; - } - - foreach ($config as $field => $typeConfig) { - if (is_string($typeConfig)) { - $this->addRule($field, $typeConfig); - } else if (is_array($typeConfig) && isset($typeConfig['type'])) { - if (isset($typeConfig['alias'])) { - $this->addRule($field, $typeConfig['type'], $typeConfig['alias']); - } else { - $this->addRule($field, $typeConfig['type']); - } - } - } - } - - public function addRule($field, $type, $alias = null) - { - if (($instance = $this->load($type)) !== null) { - $this->_rules[$field] = $instance; - } - - if ($alias === null) { - $alias = $field; - } - - $this->_alias[$field] = $alias; - - return $this; - } - - public function removeRule($field) - { - unset($this->_rules[$field]); - unset($this->_alias[$field]); - - return $this; - } - - protected function _load($className, $useSingleton, Array $constructorParams = array()) - { - $reflection = new ReflectionClass($className); - if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) { - $method = $reflection->getMethod('getSingleton'); - return $method->invoke(null); - } - - try { - return $reflection->newInstance($this); - } catch (ReflectionException $e) { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException($e); - return null; - } - } - - /** - * - * @param Wootook_Core_Database_Resource $entity - * @param Array $datas - * @return Array - */ - public function encode(Wootook_Core_Database_Resource $entity, Array $datas = array()) - { - $aliasTable = array_flip($this->_alias); - foreach ($entity->getAllDatas() as $aliasedField => $decodedValue) { - if (!isset($aliasTable[$aliasedField])) { - $field = $aliasedField; - } else { - $field = $aliasTable[$aliasedField]; - } - - if (isset($this->_rules[$field])) { - $datas[$field] = $this->_rules[$field]->encode($decodedValue); - } else { - $datas[$field] = $decodedValue; - } - } - - return $datas; - } - - /** - * - * @param Wootook_Core_Database_Resource $entity - * @param Array $datas - * @return Wootook_Core_Database_Resource - */ - public function decode(Wootook_Core_Database_Resource $entity, Array $datas = array()) - { - foreach ($datas as $field => $encodedValue) { - if (isset($this->_rules[$field])) { - $entity->setData($this->_alias[$field], $this->_rules[$field]->decode($encodedValue)); - } else { - $entity->setData($field, $encodedValue); - } - } - - return $entity; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/Array.php b/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/Array.php deleted file mode 100644 index f1db44d..0000000 --- a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/Array.php +++ /dev/null @@ -1,15 +0,0 @@ -toArray()); - } - - public function decode($value) - { - return new Wootook_Core_Config_Node(parent::decode($value)); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/DateTime.php b/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/DateTime.php deleted file mode 100644 index 1e37d12..0000000 --- a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/DateTime.php +++ /dev/null @@ -1,38 +0,0 @@ -_format = self::DATE_FORMAT_MYSQL; - } else { - $this->_format = $format; - } - return $this; - } - - public function getFormat() - { - return $this->_format; - } - - public function encode($value) - { - if (!$value instanceof Wootook_Core_DateTime) { - $value = new Wootook_Core_DateTime($value); - } - - return $value->toString($this->getFormat()); - } - - public function decode($value) - { - return new Wootook_Core_DateTime($value, $this->getFormat()); - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/FieldMapper.php b/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/FieldMapper.php deleted file mode 100644 index a7e989c..0000000 --- a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/FieldMapper.php +++ /dev/null @@ -1,15 +0,0 @@ -_mapper = $mapper; - } - - abstract public function encode($value); - - abstract public function decode($value); -} diff --git a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/Object.php b/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/Object.php deleted file mode 100644 index 7af245b..0000000 --- a/src/application/code/core/Wootook/Core/Database/Orm/DataMapper/Object.php +++ /dev/null @@ -1,43 +0,0 @@ -_entityClass = $class; - - return $this; - } - - public function getEntityClass() - { - return $this->_entityClass; - } - - protected function _newInstance(Array $args = array()) - { - if ($this->_reflectionClass === null && $this->_entityClass !== null) { - $this->_reflectionClass = new ReflectionClass($this->_entityClass); - } - - return $this->newInstanceArgs($args); - } - - public function encode($value) - { - return parent::encode($value->getAllDatas()); - } - - public function decode($value) - { - $object = $this->_newInstance(); - $object->addData(parent::decode($value)); - - return $object; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Database/Resource.php b/src/application/code/core/Wootook/Core/Database/Resource.php deleted file mode 100644 index 5501b32..0000000 --- a/src/application/code/core/Wootook/Core/Database/Resource.php +++ /dev/null @@ -1,89 +0,0 @@ -_dataMapper === null) { - $this->_dataMapper = new Wootook_Core_Database_Orm_DataMapper(); - } - return $this->_dataMapper; - } - - public function setTableName($tableName) - { - $this->_tableName = $tableName; - - return $this; - } - - public function getTableName() - { - return $this->_tableName; - } - - /** - * @return Wootook_Core_Database_Adapter_Adapter - */ - public function getReadConnection() - { - if ($this->_readConnection === null) { - $this->_readConnection = Wootook_Core_Database_ConnectionManager::getSingleton() - ->getConnection('core_read'); - } - - return $this->_readConnection; - } - - public function setReadConnection($connection) - { - if ($connection instanceof Wootook_Core_Database_Adapter_Pdo_Mysql) { - $this->_readConnection = $connection; - } else if (is_string($connection)) { - $this->_readConnection = $this->getConnection($connection); - } else { - throw new Wootook_Core_Exception_RuntimeException( - 'First parameter should be either a database connection object or a string identifier.'); - } - - return $this; - } - - /** - * @return Wootook_Core_Database_Adapter_Adapter - */ - public function getWriteConnection() - { - if ($this->_writeConnection === null) { - $this->_writeConnection = Wootook_Core_Database_ConnectionManager::getSingleton() - ->getConnection('core_write'); - } - return $this->_writeConnection; - } - - public function setWriteConnection($connection) - { - if ($connection instanceof Wootook_Core_Database_Adapter_Pdo_Mysql) { - $this->_readConnection = $connection; - } else if (is_string($connection)) { - $this->_readConnection = $this->getConnection($connection); - } else { - throw new Wootook_Core_Exception_RuntimeException( - 'First parameter should be either a database connection object or a string identifier.'); - } - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Delete.php b/src/application/code/core/Wootook/Core/Database/Sql/Delete.php deleted file mode 100644 index 84d8e37..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Delete.php +++ /dev/null @@ -1,90 +0,0 @@ -into($tableName); - } - - return $this; - } - - public function reset($part = null) - { - if ($part === null) { - $this->_parts = array( - self::FROM => null, - self::WHERE => array(), - self::OFFSET => null, - self::LIMIT => null, - ); - } else if (isset($this->_parts[$part])) { - $this->_parts[$part] = array(); - } - - return $this; - } - - public function from($table, $schema = null) - { - $this->_parts[self::FROM] = array( - 'table' => $table, - 'schema' => $schema - ); - - return $this; - } - - public function __toString() - { - return $this->render(); - } - - public function toString($part = null) - { - if ($part === null) { - return $this->render(); - } - - switch ($part) { - case self::FROM: - return $this->renderFrom(); - break; - case self::WHERE: - return $this->renderWhere(); - break; - case self::WHERE: - return $this->renderWhere(); - break; - case self::LIMIT: - return $this->renderLimit(); - break; - } - - return null; - } - - public function renderFrom() - { - if ($this->_parts[self::FROM]['schema'] !== null) { - return "DELETE FROM {$this->getConnection()->quoteIdentifier($this->_parts[self::FROM]['schema'])}.{$this->getConnection()->quoteIdentifier($this->_parts[self::FROM]['table'])}"; - } - return "DELETE FROM {$this->getConnection()->quoteIdentifier($this->_parts[self::FROM]['table'])}"; - } - - public function render() - { - return implode("\n", array( - $this->renderFrom(), - $this->renderWhere(), - $this->renderLimit(), - )); - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Dml.php b/src/application/code/core/Wootook/Core/Database/Sql/Dml.php deleted file mode 100644 index de0c17b..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Dml.php +++ /dev/null @@ -1,24 +0,0 @@ -_placeholders[] = $condition; - $this->_parts[self::WHERE][] = $condition; - } else if (is_array($value)) { - $where = $this->_translateSqlWhere($condition, 'or', $value); - if ($where !== null) { - $this->_parts[self::WHERE][] = $where; - } - } else if ($value instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) { - $this->_parts[self::WHERE][] = "{$this->getConnection()->quoteIdentifier($condition)}=" . $value; - } else { - $this->_parts[self::WHERE][] = $this->getConnection()->quoteInto("{$this->getConnection()->quoteIdentifier($condition)}=?", $value); - } - - return $this; - } - - public function limit($limit, $offset = null) - { - $this->_parts[self::LIMIT] = intval($limit); - $this->_parts[self::OFFSET] = intval($offset); - - return $this; - } - - public function renderWhere() - { - if (count($this->_parts[self::WHERE]) <= 0) { - return ''; - } - - return " WHERE (" . implode(")\n AND (", $this->_parts[self::WHERE]) . ')'; - } - - public function renderLimit() - { - if (!$this->_parts[self::LIMIT]) { - return ''; - } - if (!$this->_parts[self::OFFSET]) { - return sprintf(" LIMIT %d", $this->_parts[self::LIMIT]); - } - return sprintf(" LIMIT %d,%d", $this->_parts[self::LIMIT], $this->_parts[self::OFFSET]); - } - - protected function _translateSqlWhere($field, $operator, $value) - { - if ($value === null) { - return null; - } - $operator = strtoupper($operator); - $adapter = $this->getConnection(); - - $basicBinayOperatorList = array( - self::OPERATOR_EQUALS => '=', - self::OPERATOR_NOT_EQUALS => '!=', - self::OPERATOR_LOWER => '<', - self::OPERATOR_GREATER => '>', - self::OPERATOR_LOWER_EQUALS => '<=', - self::OPERATOR_GREATER_EQUALS => '>=' - ); - - if (in_array($operator, $basicBinayOperatorList)) { - if ($value === true) { - return "{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}TRUE"; - } else if ($value === false) { - return "{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}FALSE"; - } else if (is_numeric($value)) { - return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%d", $value); - } else if ($value instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) { - $this->_placeholders[] = $value; - return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%s", $adapter->quote($value->toString())); - } else { - return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%s", $adapter->quote($value)); - } - } - - switch ($operator) { - case self::OPERATOR_IS_NULL: - if ($value == false) { - return "{$adapter->quoteIdentifier($field)} IS NOT NULL"; - } else { - return "{$adapter->quoteIdentifier($field)} IS NULL"; - } - break; - - case self::OPERATOR_AND: - case self::OPERATOR_OR: - case self::OPERATOR_XOR: - $where = array(); - foreach ($value as $valueItem) { - $subOperator = key($valueItem); - $realValue = current($valueItem); - - if (is_array($realValue) && isset($realValue['field'])) { - if (!isset($realValue['value'])) { - continue; - } - - $realField = $realValue['field']; - $realValue = $realValue['value']; - } else { - $realField = $field; - } - - if ($realValue === null) { - continue; - } - $actualValue = $this->_translateSqlWhere($realField, $subOperator, $realValue); - if ($actualValue !== null) { - $where[] = $actualValue; - } - } - - if (count($where)) { - return '((' . implode(') ' . strtoupper($operator) . ' (', $where) . '))'; - } - break; - - case self::OPERATOR_IN: - $valueList = array(); - foreach ($value as $setValue) { - $valueList[] = $adapter->quote($setValue); - } - $implodedList = implode(',', $valueList); - return "{$adapter->quoteIdentifier($field)} IN({$implodedList})"; - break; - - case self::OPERATOR_NOT_IN: - $valueList = array(); - foreach ($value as $setValue) { - $valueList[] = $adapter->quote($setValue); - } - $implodedList = implode(',', $valueList); - return "{$adapter->quoteIdentifier($field)} NOT IN({$implodedList})"; - break; - - case self::OPERATOR_FIND_IN_SET: - if (is_array($value)) { - $subField = current($value); - $subOperator = key($value); - - if (in_array($subOperator, $basicBinayOperatorList)) { - return "FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)}){$basicBinayOperatorList[$operator]}{$adapter->quoteIdentifier($subField)}"; - } - } else { - return "0 < FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)})"; - } - break; - - case self::OPERATOR_NOT_FIND_IN_SET: - return "0 = FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)})"; - break; - - case self::OPERATOR_DATE: - $dateValues = array(); - if (isset($value['from'])) { - if ($value['from'] instanceof Wootook_Core_DateTime) { - $dateValues['from'] = "{$adapter->quoteIdentifier($field)} >= {$adapter->quote($this->getConnection()->getDataMapper()->load('DateTime')->encode($value['from']))}"; - } else if (is_string($value['from'])) { - $dateValues['from'] = "{$adapter->quoteIdentifier($field)} >= {$adapter->quote($value['from'])}"; - } else if (is_numeric($value['from'])) { - $dateValues['from'] = "UNIX_TIMESTAMP({$adapter->quoteIdentifier($field)}) >= {$adapter->quote($value['from'])}"; - } - } - if (isset($value['to'])) { - if ($value['to'] instanceof Wootook_Core_DateTime) { - $dateValues['to'] = "{$adapter->quoteIdentifier($field)} <= {$adapter->quote($this->getConnection()->getDataMapper()->load('DateTime')->encode($value['to']))}"; - } else if (is_string($value['to'])) { - $dateValues['to'] = "{$adapter->quoteIdentifier($field)} <= {$adapter->quote($value['to'])}"; - } else if (is_numeric($value['to'])) { - $dateValues['to'] = "UNIX_TIMESTAMP({$adapter->quoteIdentifier($field)}) <= {$adapter->quote($value['to'])}"; - } - } - - return '(' . implode(' AND ', $dateValues) . ')'; - break; - } - - return null; - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/DmlQuery.php b/src/application/code/core/Wootook/Core/Database/Sql/DmlQuery.php deleted file mode 100644 index ebb569e..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/DmlQuery.php +++ /dev/null @@ -1,107 +0,0 @@ -setConnection($connection); - - $this->reset(); - $this->_init($tableName); - } - - /** - * @return Wootook_Core_Database_Adapter_Adapter - */ - public function getConnection() - { - return $this->_connection; - } - - public function setConnection(Wootook_Core_Database_Adapter_Adapter $connection) - { - $this->_connection = $connection; - - return $this; - } - - protected function _init($param = null) - { - return $this; - } - - public function getPart($part = null) - { - if ($part === null) { - return $this->_parts; - } - if (isset($this->_parts[$part])) { - return $this->_parts[$part]; - } - - return null; - } - - public function quote($data) - { - return $this->getConnection()->quote($data); - } - - public function quoteIdentifier($identifier) - { - return $this->getConnection()->quoteIdentifier($identifier); - } - - public function beforePrepare(Wootook_Core_Database_Statement_Statement $statement) - { - foreach ($this->_placeholders as $placeholder) { - $placeholder->beforePrepare($statement); - } - - return $this; - } - - public function afterPrepare(Wootook_Core_Database_Statement_Statement $statement) - { - foreach ($this->_placeholders as $placeholder) { - $placeholder->afterPrepare($statement); - } - - return $this; - } - - public function beforeExecute(Wootook_Core_Database_Statement_Statement $statement) - { - foreach ($this->_placeholders as $placeholder) { - $placeholder->beforeExecute($statement); - } - - return $this; - } - - public function afterExecute(Wootook_Core_Database_Statement_Statement $statement) - { - foreach ($this->_placeholders as $placeholder) { - $placeholder->afterExecute($statement); - } - - return $this; - } - - public function prepare() - { - return $this->getConnection()->prepare($this); - } - - public function execute(Array $params = null) - { - return $this->getConnection()->execute($this, $params); - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Insert.php b/src/application/code/core/Wootook/Core/Database/Sql/Insert.php deleted file mode 100644 index cccbcc8..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Insert.php +++ /dev/null @@ -1,150 +0,0 @@ -into($tableName); - } - - return $this; - } - - public function reset($part = null) - { - if ($part === null) { - $this->_parts = array( - self::INTO => array(), - self::SET => array(), - self::SELECT => array(), - ); - } else if (isset($this->_parts[$part])) { - $this->_parts[$part] = array(); - } - - return $this; - } - - public function set($column, $value = null) - { - if (!is_array($column)) { - $column = array($column => $value); - } - - foreach ($column as $field => $value) { - if ($value instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) { - $this->_placeholders[] = $value; - } - - $this->_parts[self::SET][] = array( - 'value' => $value, - 'field' => $field - ); - } - - return $this; - } - - public function into($table, $schema = null) - { - $this->_parts[self::INTO] = array( - 'table' => $table, - 'schema' => $schema, - ); - - return $this; - } - - public function select() - { - if (!isset($this->_parts[self::SELECT])) { - $this->_parts[self::SELECT] = $this->getConnection()->select(); - } - - return $this->_parts[self::SELECT]; - } - - public function __toString() - { - return $this->render(); - } - - public function toString($part = null) - { - if ($part === null) { - return $this->render(); - } - - switch ($part) { - case self::COLUMNS: - return $this->renderSet(); - break; - case self::INTO: - return $this->renderInto(); - break; - case self::SELECT: - return $this->renderSelect(); - break; - } - - return null; - } - - public function renderSet() - { - $fields = array(); - foreach ($this->_parts[self::SET] as $field) { - if ($field['value'] instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) { - $fields[] = "{$this->_connection->quoteIdentifier($field['field'])}={$field['value']->toString()}"; - } else { - $fields[] = "{$this->_connection->quoteIdentifier($field['field'])}={$this->_connection->quote($field['value'])}"; - } - } - - if (!empty($fields)) { - return "SET " . implode(", ", $fields); - } - } - - public function renderInto() - { - if ($this->_parts[self::INTO]['schema'] !== null) { - $output = "{$this->_connection->quoteIdentifier($this->_parts[self::INTO]['schema'])}.{$this->_connection->quoteIdentifier($this->_parts[self::INTO]['table'])}"; - } else { - $output = "{$this->_connection->quoteIdentifier($this->_parts[self::INTO]['table'])}"; - } - - return "INSERT INTO " . $output; - } - - public function renderSelect() - { - if (isset($this->_parts[self::SELECT])) { - return ' ' . $this->_parts[self::SELECT]->render(); - } - return ''; - } - - public function render() - { - if (empty($this->_parts[self::SELECT])) { - return implode("\n", array( - $this->renderInto(), - $this->renderSet(), - )); - } else { - return implode("\n", array( - $this->renderInto(), - $this->renderSelect(), - )); - } - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Mysql/Select.php b/src/application/code/core/Wootook/Core/Database/Sql/Mysql/Select.php deleted file mode 100644 index 5e8c80c..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Mysql/Select.php +++ /dev/null @@ -1,6 +0,0 @@ -_expression = (string) $expression; - $this->_params = $params; - } - - public function __toString() - { - return $this->_expression; - } - - public function beforeExecute(Wootook_Core_Database_Statement_Statement $statement) - { - parent::beforeExecute($statement); - - foreach ($this->_params as $paramName => $value) { - $statement->bindValue($paramName, $value, $statement->getParamType($value)); - } - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Param.php b/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Param.php deleted file mode 100644 index 5a77287..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Param.php +++ /dev/null @@ -1,31 +0,0 @@ -_paramName = $paramName; - $this->_paramType = $type; - $this->_value = $value; - } - - public function __toString() - { - return ':' . $this->_paramName; - } - - public function beforeExecute(Wootook_Core_Database_Statement_Statement $statement) - { - parent::beforeExecute($statement); - - $type = $this->_paramType !== null ? $this->_paramType : $statement->getParamType($this->_value); - $statement->bindValue($this->_paramName, $this->_value, $type); - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Placeholder.php b/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Placeholder.php deleted file mode 100644 index b601575..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Placeholder.php +++ /dev/null @@ -1,31 +0,0 @@ -__toString(); - } - - abstract public function __toString(); - - public function beforePrepare(Wootook_Core_Database_Statement_Statement $statement) - { - return $this; - } - - public function afterPrepare(Wootook_Core_Database_Statement_Statement $statement) - { - return $this; - } - - public function beforeExecute(Wootook_Core_Database_Statement_Statement $statement) - { - return $this; - } - - public function afterExecute(Wootook_Core_Database_Statement_Statement $statement) - { - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Variable.php b/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Variable.php deleted file mode 100644 index 04e4217..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Placeholder/Variable.php +++ /dev/null @@ -1,20 +0,0 @@ -_paramName = $paramName; - $this->_paramType = $type; - } - - public function __toString() - { - return ':' . $this->_paramName; - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Select.php b/src/application/code/core/Wootook/Core/Database/Sql/Select.php deleted file mode 100644 index 3c67203..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Select.php +++ /dev/null @@ -1,332 +0,0 @@ -from($tableName); - } - - return $this; - } - - public function reset($part = null) - { - if ($part === null) { - $this->_parts = array( - self::COLUMNS => array(), - self::FROM => array(), - self::JOIN => array(), - self::WHERE => array(), - self::UNION => array(), - self::LIMIT => null, - self::OFFSET => null, - self::GROUP => array(), - self::HAVING => array(), - self::ORDER => array(), - ); - } else if (isset($this->_parts[$part])) { - $this->_parts[$part] = array(); - } - - return $this; - } - - public function column($column = '*', $table = null) - { - if (is_array($column)) { - foreach ($column as $alias => $field) { - if (is_int($alias)) { - $this->_parts[self::COLUMNS][] = array( - 'table' => $table, - 'alias' => null, - 'field' => $field - ); - } else { - $this->_parts[self::COLUMNS][] = array( - 'table' => $table, - 'alias' => $alias, - 'field' => $field - ); - } - } - } else { - if ($column instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) { - $this->_placeholders[] = $column; - } - - $this->_parts[self::COLUMNS][] = array( - 'table' => $table, - 'alias' => null, - 'field' => $column - ); - } - - return $this; - } - - public function from($table, $schema = null) - { - if (is_array($table)) { - $alias = key($table); - $table = current($table); - } else { - $alias = null; - } - - $this->_parts[self::FROM][] = array( - 'table' => $table, - 'alias' => $alias, - 'schema' => $schema - ); - - return $this; - } - - public function join($table, $condition, $fields = array('*'), $mode = self::JOIN_INNER, $schema = null) - { - $this->column($fields); - if (is_array($table)) { - $alias = key($table); - $table = $this->_connection->getTable(current($table)); - - if ($schema !== null) { - $this->_parts[self::JOIN][] = "\n{$mode} JOIN {$this->_connection->quoteIdentifier($schema)}{$this->_connection->quoteIdentifier($table)} AS {$this->_connection->quoteIdentifier($alias)}" - . "\n ON {$condition}"; - } else { - $this->_parts[self::JOIN][] = "\n{$mode} JOIN {$this->_connection->quoteIdentifier($table)} AS {$this->_connection->quoteIdentifier($alias)}" - . "\n ON {$condition}"; - } - } else { - $this->_parts[self::JOIN][] = "\n{$mode} JOIN {$this->_connection->quoteIdentifier($table)}" - . "\n ON {$condition}"; - } - - return $this; - } - - public function joinLeft($table, $condition, $fields = array('*')) - { - return $this->join($table, $condition, $fields, self::JOIN_LEFT); - } - - public function joinRight($table, $condition, $fields = array('*')) - { - return $this->join($table, $condition, $fields, self::JOIN_RIGHT); - } - - public function joinInner($table, $condition, $fields = array('*')) - { - return $this->join($table, $condition, $fields, self::JOIN_INNER); - } - - public function joinOuter($table, $condition, $fields = array('*')) - { - return $this->join($table, $condition, $fields, self::JOIN_OUTER); - } - - public function order($field, $direction = 'ASC') - { - $this->_parts[self::ORDER][] = "{$field} {$direction}"; - - return $this; - } - - public function union($collection) - { - $this->_parts[self::UNION][] = $collection; - - return $this; - } - - public function group($groupField) - { - $this->_parts[self::GROUP][] = $groupField; - - return $this; - } - - public function __toString() - { - return $this->render(); - } - - public function toString($part = null) - { - if ($part === null) { - return $this->render(); - } - - switch ($part) { - case self::COLUMNS: - return $this->renderColumns(); - break; - case self::FROM: - return $this->renderFrom(); - break; - case self::WHERE: - return $this->renderWhere(); - break; - case self::JOIN: - return $this->renderJoin(); - break; - case self::ORDER: - return $this->renderOrder(); - break; - case self::UNION: - return $this->renderUnion(); - break; - case self::LIMIT: - return $this->renderLimit(); - break; - case self::GROUP: - return $this->renderGroup(); - break; - case self::HAVING: - return $this->renderHaving(); - break; - } - - return null; - } - - public function renderColumns() - { - $fields = array(); - foreach ($this->_parts[self::COLUMNS] as $field) { - if ($field['field'] instanceof Wootook_Core_Database_Sql_Dml) { - if ($field['alias'] !== null) { - $fields[] = "({$field['field']}) AS {$field['alias']}"; - } else { - $fields[] = "({$field['field']})"; - } - } else if ($field['field'] instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) { - if ($field['alias'] !== null) { - $fields[] = "({$field['field']}) AS {$field['alias']}"; - } else { - $fields[] = "({$field['field']})"; - } - } else if ($field['alias'] !== null) { - if ($field['table'] !== null) { - $fields[] = "{$field['table']}.{$field['field']} AS {$field['alias']}"; - } else { - $fields[] = "{$field['field']} AS {$field['alias']}"; - } - } else if ($field['table'] !== null) { - $fields[] = "{$field['table']}.{$field['field']}"; - } else { - $fields[] = "{$field['field']}"; - } - } - - if (!empty($fields)) { - return 'SELECT ' . implode(", ", $fields); - } - return 'SELECT *'; - } - - public function renderFrom() - { - $tables = array(); - foreach ($this->_parts[self::FROM] as $table) { - if ($table['table'] instanceof Wootook_Core_Database_Sql_Dml) { - if ($table['alias'] !== null) { - $tables[] = "({$table['table']}) AS {$this->_connection->quoteIdentifier($table['alias'])}"; - } else { - $tables[] = "({$table['table']})"; - } - } else if ($table['alias'] !== null) { - if ($table['schema'] !== null) { - $tables[] = "{$this->_connection->quoteIdentifier($table['schema'])}.{$this->_connection->quoteIdentifier($table['table'])} AS {$this->_connection->quoteIdentifier($table['alias'])}"; - } else { - $tables[] = "{$this->_connection->quoteIdentifier($table['table'])} AS {$this->_connection->quoteIdentifier($table['alias'])}"; - } - } else if ($table['schema'] !== null) { - $tables[] = "{$this->_connection->quoteIdentifier($table['schema'])}.{$this->_connection->quoteIdentifier($table['table'])}"; - } else { - $tables[] = "({$this->_connection->quoteIdentifier($table['table'])})"; - } - } - - return " FROM " . implode(', ', $tables); - } - - public function renderJoin() - { - return implode('', $this->_parts[self::JOIN]); - } - - public function renderOrder() - { - if (count($this->_parts[self::ORDER]) <= 0) { - return null; - } - return " ORDER BY " . implode(', ', $this->_parts[self::ORDER]); - } - - public function renderUnion() - { - $statements = array(); - foreach ($this->_parts[self::UNION] as $statement) { - $statements[] = $statement->render(); - } - - return " (\n" . implode(" )\n UNION\n (\n", $statements) . "\n )"; - } - - public function renderGroup() - { - if (count($this->_parts[self::GROUP]) <= 0) { - return null; - } - return " GROUP BY " . implode(', ', $this->_parts[self::GROUP]); - } - - public function renderHaving() - { - if (count($this->_parts[self::HAVING]) <= 0) { - return null; - } - return " HAVING " . implode(', ', $this->_parts[self::HAVING]); - } - - public function render() - { - if (empty($this->_parts[self::UNION])) { - return implode("\n", array( - $this->renderColumns(), - $this->renderFrom(), - $this->renderJoin(), - $this->renderWhere(), - $this->renderGroup(), - $this->renderHaving(), - $this->renderOrder(), - $this->renderLimit() - )); - } else { - return implode("\n", array( - $this->renderUnion(), - $this->renderWhere(), - $this->renderOrder(), - $this->renderLimit() - )); - } - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Sql/Update.php b/src/application/code/core/Wootook/Core/Database/Sql/Update.php deleted file mode 100644 index 5cd83b8..0000000 --- a/src/application/code/core/Wootook/Core/Database/Sql/Update.php +++ /dev/null @@ -1,126 +0,0 @@ -into($tableName); - } - - return $this; - } - - public function reset($part = null) - { - if ($part === null) { - $this->_parts = array( - self::INTO => array(), - self::SET => array(), - self::WHERE => array(), - self::LIMIT => null, - self::OFFSET => null, - ); - } else if (isset($this->_parts[$part])) { - $this->_parts[$part] = array(); - } - - return $this; - } - - public function set($column, $value = null) - { - if (!is_array($column)) { - $column = array($column => $value); - } - - foreach ($column as $field => $value) { - if ($value instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) { - $this->_placeholders[] = $value; - } - - $this->_parts[self::SET][] = array( - 'value' => $value, - 'field' => $field - ); - } - - return $this; - } - - public function into($table, $schema = null) - { - $this->_parts[self::INTO] = array( - 'table' => $table, - 'schema' => $schema, - ); - - return $this; - } - - public function __toString() - { - return $this->render(); - } - - public function toString($part = null) - { - if ($part === null) { - return $this->render(); - } - - switch ($part) { - case self::SET: - return $this->renderSet(); - break; - case self::INTO: - return $this->renderInto(); - break; - } - - return null; - } - - public function renderSet() - { - $fields = array(); - foreach ($this->_parts[self::SET] as $field) { - if ($field['value'] instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) { - $fields[] = "{$this->_connection->quoteIdentifier($field['field'])}={$field['value']->toString()}"; - } else { - $fields[] = "{$this->_connection->quoteIdentifier($field['field'])}={$this->_connection->quote($field['value'])}"; - } - } - - if (!empty($fields)) { - return ' SET ' . implode(', ', $fields); - } - } - - public function renderInto() - { - if ($this->_parts[self::INTO]['schema'] !== null) { - $output = "{$this->_connection->quoteIdentifier($this->_parts[self::INTO]['schema'])}.{$this->_connection->quoteIdentifier($this->_parts[self::INTO]['table'])}"; - } else { - $output = "{$this->_connection->quoteIdentifier($this->_parts[self::INTO]['table'])}"; - } - - return "UPDATE " . $output; - } - - public function render() - { - return implode("\n", array( - $this->renderInto(), - $this->renderSet(), - $this->renderWhere(), - $this->renderLimit() - )); - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Statement/Pdo/Mysql.php b/src/application/code/core/Wootook/Core/Database/Statement/Pdo/Mysql.php deleted file mode 100644 index 33b243d..0000000 --- a/src/application/code/core/Wootook/Core/Database/Statement/Pdo/Mysql.php +++ /dev/null @@ -1,321 +0,0 @@ -_query = $query; - - if ($this->_query instanceof Wootook_Core_Database_Sql_Dml) { - $this->_query->beforePrepare($this); - } - - try { - $this->_handler = $this->_adapter->getDriverHandler()->prepare($this->_query); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - - if ($this->_query instanceof Wootook_Core_Database_Sql_Dml) { - $this->_query->afterPrepare($this); - } - - return $this; - } - - /** - * - * @param string|int $column - * @param mixed $param - * @param int $type - * @return Wootook_Core_Database_Statement_Statement - */ - public function bindColumn($column, &$param, $type = null) - { - try { - return $this->_handler->bindColumn($column, $param, $type); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - - return false; - } - - /** - * - * @param string|int $parameter - * @param mixed $variable - * @param int $type - * @param int $length - * @param unknown_type $options - * @return Wootook_Core_Database_Statement_Statement - */ - public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null) - { - try { - return $this->_handler->bindParam($parameter, $variable, $type, $length, $options); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * - * @param string|int $parameter - * @param mixed $value - * @param int $type - * @return Wootook_Core_Database_Statement_Statement - */ - public function bindValue($parameter, $value, $type = null) - { - try { - return $this->_handler->bindValue($parameter, $value, $type); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * - * @param array $params - * @return bool - */ - public function execute(Array $params = null) - { - if ($this->_query instanceof Wootook_Core_Database_Sql_Dml) { - $this->_query->beforeExecute($this); - } - - try { - $result = $this->_handler->execute($params); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - - if ($this->_query instanceof Wootook_Core_Database_Sql_Dml) { - $this->_query->afterExecute($this); - } - - return $result; - } - - /** - * - * @param int $style - * @param int $col - * @return mixed - */ - public function fetchAll($style = null, $col = null) - { - try { - if ($style !== null) { - if ($col !== null) { - $result = $this->_handler->fetchAll($style, $col); - } else { - $result = $this->_handler->fetchAll($style); - } - } else { - $result = $this->_handler->fetchAll($style); - } - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return $result; - } - - /** - * - * @param int $col - * @return mixed - */ - public function fetchColumn($col = 0) - { - try { - return $this->_handler->fetchColumn($col); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return null; - } - - /** - * - * @return Wootook_Core_Database_Adapter_Adapter - */ - public function getAdapter() - { - return $this->_adapter; - } - - /** - * - * @param string $key - */ - public function getAttribute($key) - { - try { - return $this->_handler->getAttribute($key); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return null; - } - - /** - * - * @param string $key - * @param mixed $value - * @return Wootook_Core_Database_Statement_Statement - */ - public function setAttribute($key, $value) - { - try { - return $this->_handler->setAttribute($key, $value); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * @param unknown_type $mode - * @return Wootook_Core_Database_Statement_Statement - */ - public function setFetchMode($mode) - { - try { - $params = func_get_args(); - return call_user_func_array($array($this->_handler, 'setFetchMode'), $params); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * @return int - */ - public function columnCount() - { - try { - return $this->_handler->columnCount(); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return 0; - } - - /** - * @return int - */ - public function rowCount() - { - try { - return $this->_handler->rowCount(); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return 0; - } - - /** - * @param int $col - * @return mixed - */ - public function fetch($style = null, $orientation = Wootook_Core_Database_ConnectionManager::FETCH_ORI_NEXT, $cursorOffset = 0) - { - try { - return $this->_handler->fetch($style, $orientation, $cursorOffset); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return null; - } - - /** - * @param string $class - * @param array $config - * @return Wootook_Object - */ - public function fetchObject($class = 'Wootook_Object', Array $constructorArgs = array()) - { - try { - return $this->_handler->fetchObject($class, $constructorArgs); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e); - } - return null; - } - - /** - * @return bool - */ - public function closeCursor() - { - try { - return $this->_handler->closeCursor(); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * @return bool - */ - public function nextRowset() - { - try { - return $this->_handler->nextRowset(); - } catch (PDOException $e) { - throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e); - } - return false; - } - - /** - * @return string - */ - public function errorCode() - { - return $this->_handler->errorCode(); - } - - /** - * @return array - */ - public function errorInfo() - { - return $this->_handler->errorInfo(); - } - - /** - * @return string - */ - public function errorMessage() - { - $info = $this->_handler->errorInfo(); - - return $info[2]; - } - - /** - * @return string - */ - public function errorState() - { - $info = $this->_handler->errorInfo(); - - return $info[0]; - } -} diff --git a/src/application/code/core/Wootook/Core/Database/Statement/Statement.php b/src/application/code/core/Wootook/Core/Database/Statement/Statement.php deleted file mode 100644 index 9e8875f..0000000 --- a/src/application/code/core/Wootook/Core/Database/Statement/Statement.php +++ /dev/null @@ -1,215 +0,0 @@ -_adapter = $adapter; - - $this->_init($sql); - } - - abstract protected function _init($sql); - - /** - * - * @param string|int $column - * @param mixed $param - * @param int $type - * @return Wootook_Core_Database_Statement_Statement - */ - abstract public function bindColumn($column, &$param, $type = null); - - /** - * - * @param string|int $parameter - * @param mixed $variable - * @param int $type - * @param int $length - * @param unknown_type $options - * @return Wootook_Core_Database_Statement_Statement - */ - abstract public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null); - - /** - * - * @param string|int $parameter - * @param mixed $value - * @param int $type - * @return Wootook_Core_Database_Statement_Statement - */ - abstract public function bindValue($parameter, $value, $type = null); - - /** - * - * @param array $params - * @return bool - */ - abstract public function execute(Array $params = null); - - /** - * - * @param int $style - * @param int $col - * @return mixed - */ - abstract public function fetch($style = null, $orientation = Wootook_Core_Database_ConnectionManager::FETCH_ORI_NEXT, $cursorOffset = 0); - - /** - * - * @param int $style - * @param int $col - * @return mixed - */ - abstract public function fetchAll($style = null, $col = null); - - /** - * - * @param int $col - * @return mixed - */ - abstract public function fetchColumn($col = 0); - - /** - * - * @param string $class - * @param array $config - * @return Wootook_Object - */ - abstract public function fetchObject($class = 'Wootook_Object', Array $constructorArgs = array()); - - /** - * - * @param string $class - * @param array $config - * @return Wootook_Object - */ - public function fetchEntity($class = 'Wootook_Core_Mvc_Model_Entity', Array $constructorArgs = array()) - { - $reflection = new ReflectionClass($class); - $object = $reflection->newInstanceArgs($constructorArgs); - - if (!$object instanceof Wootook_Object) { - throw new Wootook_Core_Exception_Database_StatementError($this, 'Destination object should be a Wootook_Core_Mvc_Model_Entity instance.'); - } - - $data = $this->fetch(Wootook_Core_Database_ConnectionManager::FETCH_ASSOC); - if ($data !== false) { - $object->getDataMapper()->decode($object, $data); - } - - return $object; - } - - /** - * - * @return Wootook_Core_Database_Adapter_Adapter - */ - abstract public function getAdapter(); - - /** - * - * @param string $key - */ - abstract public function getAttribute($key); - - /** - * - * @param string $key - * @param mixed $value - * @return Wootook_Core_Database_Statement_Statement - */ - abstract public function setAttribute($key, $value); - - /** - * @param unknown_type $mode - * @return Wootook_Core_Database_Statement_Statement - */ - abstract public function setFetchMode($mode); - - /** - * @return int - */ - abstract public function columnCount(); - - /** - * @return string - */ - abstract public function errorCode(); - - /** - * @return string - */ - abstract public function errorMessage(); - - /** - * @return array - */ - abstract public function errorInfo(); - - /** - * @return string - */ - abstract public function errorState(); - - /** - * @return int - */ - abstract public function rowCount(); - - /** - * @return bool - */ - abstract public function closeCursor(); - - /** - * @return bool - */ - abstract public function nextRowset(); - - public function getParamType($value) - { - if (is_numeric($value)) { - return Wootook_Core_Database_ConnectionManager::PARAM_INT; - } else if (is_bool($value)) { - return Wootook_Core_Database_ConnectionManager::PARAM_BOOL; - } else if (is_string($value)) { - return Wootook_Core_Database_ConnectionManager::PARAM_STR; - } - - return null; - } - - public function current() - { - return $this->_currentRow; - } - - public function next() - { - $this->_currentRow = $this->fetch(); - $this->_currentIndex++; - } - - public function key() - { - return $this->_currentIndex; - } - - public function rewind() - { - return $this->_currentIndex; - } - - public function valid() - { - $rows = $this->rowCount(); - return $rows > 0 && $this->_currentIndex <= $rows; - } -} diff --git a/src/application/code/core/Wootook/Core/DateTime.php b/src/application/code/core/Wootook/Core/DateTime.php deleted file mode 100644 index 06a6d79..0000000 --- a/src/application/code/core/Wootook/Core/DateTime.php +++ /dev/null @@ -1,311 +0,0 @@ - array(self::DAY => '#(0[1-9]|[12][0-9]|3[01])#'), - 'j' => array(self::DAY => '#([1-9]|[12][0-9]|3[01])#'), - 'D' => array(self::WEEKDAY => '#(Mon|Tue|Wed|Thu|Fri|Sat|Sun)#i', self::PARSER => '_parseShortWeekday'), - 'N' => array(self::WEEKDAY => '#([1-7])#', self::PARSER => '_parseWeekday'), - 'w' => array(self::WEEKDAY => '#([0-6])#'), - 'm' => array(self::MONTH => '#(0[1-9]|1[0-2])#'), - 'M' => array(self::MONTH => '#(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)#i', self::PARSER => '_parseShortMonth'), - 'n' => array(self::MONTH => '#([1-9]|1[0-2])#'), - 'o' => array(self::YEAR_ISO => '#([0-9]{4})#'), - 'Y' => array(self::YEAR => '#([0-9]{4})#'), - 'y' => array(self::YEAR => '#([0-9]{2})#', self::PARSER => '_parseShortYear'), - - 'a' => array(self::MERIDIEM => '#(am|pm)#', self::PARSER => '_parseMeridiem'), - 'A' => array(self::MERIDIEM => '#(AM|PM)#', self::PARSER => '_parseMeridiem'), - 'g' => array(self::HOUR => '#([0-9]{1,2})#'), - 'G' => array(self::HOUR => '#([0-9]{1,2})#'), - 'h' => array(self::HOUR => '#([0-9]{2})#'), - 'H' => array(self::HOUR => '#([0-9]{2})#'), - 'i' => array(self::MINUTE => '#([0-9]{2})#'), - 's' => array(self::SECOND => '#([0-9]{2})#'), - 'u' => array(self::MICROSECOND => '#([0-9]{6})#'), - 'I' => array(self::DAYLIGHT => '#(0|1)#'), - - // Unimplemented and ignored modifiers - 'l' => array(null => '#.#'), - 'S' => array(null => '#.#'), - 'z' => array(null => '#.#'), - 'W' => array(null => '#.#'), - 'f' => array(null => '#.#'), - 't' => array(null => '#.#'), - 'L' => array(null => '#.#'), - 'O' => array(null => '#.#'), - 'P' => array(null => '#.#'), - 'T' => array(null => '#.#'), - 'Z' => array(null => '#.#'), - 'c' => array(null => '#.#'), - 'r' => array(null => '#.#'), - 'U' => array(null => '#.#') - ); - - protected $_datetime = null; - - public static function init($timezone = null, $force = false) - { - static $init = false; - - if ($init === false || $force === true) { - if ($timezone === null) { - //$timezone = Wootook::getConfig('system/date/timezone'); - } - if ($timezone === null) { - $timezone = 'GMT'; - } - - date_default_timezone_set($timezone); - $init = true; - } - } - - public function __construct($timestamp = null, $format = null) - { - self::init(); - - if ($timestamp === null) { - $this->_datetime = time(); - } else if ($format === null) { - $this->_datetime = intval($timestamp); - } else { - $this->_datetime = $this->_parse($timestamp, $format); - } - } - - public function getIso($useTimezone = false) - { - return $this->toString(self::ISO_8601, $useTimezone); - } - - public function getTimestamp() - { - return $this->_datetime; - } - - public function now() - { - return $this->calc(time(), self::TIMESTAMP, self::OPERATOR_SET); - } - - public function set($value, $part = self::TIMESTAMP) - { - return $this->calc($value, $part, self::OPERATOR_SET); - } - - public function add($value, $part = self::TIMESTAMP) - { - return $this->calc($value, $part, self::OPERATOR_ADD); - } - - public function sub($value, $part = self::TIMESTAMP) - { - return $this->calc($value, $part, self::OPERATOR_SUB); - } - - public function calc($value, $part = self::TIMESTAMP, $type = self::OPERATOR_ADD) - { - switch ($part) { - case self::YEAR: - case self::MONTH: - case self::WEEK: - case self::DAY: - case self::HOUR: - case self::MINUTE: - case self::SECOND: - $current = getdate($this->_datetime); - if ($type === self::OPERATOR_ADD) { - $current[$part] += $value; - } else if ($type === self::OPERATOR_SUB) { - $current[$part] -= $value; - } else if ($type === self::OPERATOR_SET) { - $current[$part] = $value; - } - - $this->_datetime = $this->_mktime($current); - break; - - case self::TIMESTAMP: - if ($type === self::OPERATOR_ADD) { - $this->_datetime += intval($value); - } else if ($type === self::OPERATOR_SUB) { - $this->_datetime -= intval($value); - } else if ($type === self::OPERATOR_SET) { - $this->_datetime = intval($value); - } - break; - // default: break; // omitted - } - - return $this; - } - - public function diff(self $date) - { - return $this->_datetime - $date->_datetime; - } - - public function isEarlier(self $date = null) - { - if ($date === null) { - $date = new self(); - } - return (bool) ($this->diff($date) > 0); - } - - public function isLater(self $date = null) - { - if ($date === null) { - $date = new self(); - } - return (bool) ($this->diff($date) < 0); - } - - protected function _mktime(Array $parts) - { - return mktime($parts[self::HOUR], $parts[self::MINUTE], $parts[self::SECOND], - $parts[self::MONTH], $parts[self::DAY], $parts[self::YEAR]); - } - - public function toString($format, $useTimezone = true) - { - if ($useTimezone) { - return date($format, $this->_datetime); - } else { - return gmdate($format, $this->_datetime); - } - } - - public function __toString() - { - return $this->toString(self::ISO_8601, false); - } - - protected function _parseShortYear($match) - { - $year = intval($match); - if ($year < 70) { - $year += 2000; - } else if ($year < 100) { - $year += 1900; - } - return $year; - } - - protected function _parseShortMonth($match) - { - if ($key = array_search(strtolower($match), array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'))) { - return $key + 1; - } - return false; - } - - protected function _parseShortWeekday($match) - { - if ($key = array_search(strtolower($match), array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'))) { - return $key; - } - return false; - } - - protected function _parseWeekday($match) - { - return intval($match) % 7; - } - - protected function _parseMeridiem($match) - { - if (in_array(strtolower($match), array(self::MERIDIEM_AM, self::MERIDIEM_PM))) { - return strtolower($match); - } - return false; - } - - protected function _parse($datetime, $format) - { - $parts = array( - self::YEAR => false, - self::YEAR_ISO => false, - self::MONTH => false, - self::DAY => false, - self::WEEKDAY => false, - self::HOUR => false, - self::MINUTE => false, - self::SECOND => false, - self::MICROSECOND => false, - self::DAYLIGHT => false, - self::MERIDIEM => false, - ); - - $offset = 0; - - $length = strlen($format); - for ($i = 0; $i < $length; $i++) { - $modifier = $format[$i]; - if (!isset(self::$_rules[$modifier])) { - $offset = (strpos($datetime, $format[$i], $offset)) + 1; - continue; - } - - $rule = self::$_rules[$modifier]; - $callback = null; - if (isset($rule[self::PARSER])) { - $callback = $rule[self::PARSER]; - unset($rule[self::PARSER]); - } - - foreach ($rule as $part => $regex) { - if (!preg_match($regex, $datetime, $matches, null, $offset)) { - continue; - } - - if ($callback === null) { - $parts[$part] = intval($matches[1]); - } else if (is_callable($callback)) { - $parts[$part] = call_user_func($callback, $matches[1]); - } else { - $parts[$part] = $this->$callback($matches[1]); - } - $offset += strlen($matches[1]); - } - } - - if ($parts[self::MERIDIEM] !== false && $parts[self::MERIDIEM] === self::MERIDIEM_PM) { - $parts[self::HOUR] = ($parts[self::HOUR] + 12) % 24; - } - - if ($parts[self::YEAR] !== false || $parts[self::YEAR_ISO] === false) { - return $this->_mktime($parts); - } else { - return $this->_mktime($parts); - } - } -} diff --git a/src/application/code/core/Wootook/Core/Email.php b/src/application/code/core/Wootook/Core/Email.php deleted file mode 100644 index e94331e..0000000 --- a/src/application/code/core/Wootook/Core/Email.php +++ /dev/null @@ -1,51 +0,0 @@ -setTransport($transport); - } - - public function setTransport(Wootook_Core_Email_Transport_Transport $transport) - { - $this->_transport = $transport; - } - - /** - * @return Wootook_Core_Email_Transport_Transport - */ - public function getTransport() - { - return $this->_transport; - } - - public function send($to, $from, $subject, $body, Array $headers = array()) - { - try { - $this->_transport - ->addRecipient($to) - ->setFrom($from) - ->setSubject($subject) - ->addPart(new Wootook_Core_Email_Part_Part($body)) - ->addHeaders($headers) - ->connect() - ->send() - ; - } catch (Wootook_Core_Exception_RuntimeException $e) { - throw new Wootook_Core_Exception_RuntimeException('Could not send mail.', null, $e); - } - - $this->_transport->disconnect(); - - return $this; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Email/Part/Part.php b/src/application/code/core/Wootook/Core/Email/Part/Part.php deleted file mode 100644 index 563a051..0000000 --- a/src/application/code/core/Wootook/Core/Email/Part/Part.php +++ /dev/null @@ -1,16 +0,0 @@ -_content = $content; - } - - public function render() - { - return $this->_content; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Email/Transport/Sendmail.php b/src/application/code/core/Wootook/Core/Email/Transport/Sendmail.php deleted file mode 100644 index 165247a..0000000 --- a/src/application/code/core/Wootook/Core/Email/Transport/Sendmail.php +++ /dev/null @@ -1,162 +0,0 @@ -_prepareHeaders(); - } - - public function setFrom($from) - { - if (is_array($from)) { - $this->_from = sprintf('"%s" <%s>', $this->_formatUnicode(current($from)), key($from)); - } else { - $this->_from = $from; - } - return $this; - } - - public function clearFrom() - { - $this->_from = null; - - return $this; - } - - public function addRecipient($recipient) - { - if (is_array($recipient)) { - foreach ($recipient as $email => $name) { - $this->_recipients[] = sprintf('"%s" <%s>', $this->_formatUnicode($name), $email); - } - } else { - $this->_recipients[] = $recipient; - } - return $this; - } - - public function clearRecipients() - { - $this->_recipients = array(); - - return $this; - } - - public function setSubject($subject) - { - $this->_subject = $this->_formatUnicode($subject); - - return $this; - } - - public function clearSubject() - { - $this->_subject = null; - - return $this; - } - - public function addHeader($name, $value) - { - $this->_headers[$name] = $value; - - return $this; - } - - public function addHeaders($headers) - { - foreach ($headers as $name => $value) { - $this->_headers[$name] = $value; - } - - return $this; - } - - public function clearHeaders() - { - $this->_headers = array(); - - return $this; - } - - public function addPart(Wootook_Core_Email_Part_Part $part) - { - $this->_parts[] = $part; - - return $this; - } - - public function clearParts() - { - $this->_parts = array(); - - return $this; - } - - protected function _formatUnicode($string) - { - return '=?UTF-8?B?' . base64_encode($string) . '?='; - } - - protected function _prepareHeaders(Array $headers = array()) - { - $this->addHeader('MIME-Version', '1.0'); - - foreach ($headers as $name => $value) { - $this->setHeader($name, $value); - } - - $this->addHeader('X-Mailer', 'PHP/' . PHP_VERSION . ' Wootook/' . VERSION); - $this->addHeader('Content-Transfer-Encoding', '8bit'); - $this->addHeader('Content-Type', 'text/plain; charset=utf-8; format=flowed'); - - return $this; - } - - public function reset() - { - $this->clearHeaders(); - $this->clearParts(); - $this->clearFrom(); - $this->clearRecipients(); - $this->clearSubject(); - - return $this; - } - - public function connect() - { - return $this; - } - - public function disconnect() - { - return $this; - } - - public function send() - { - $content = ''; - foreach ($this->_parts as $part) { - $content .= $part->render(); - } - - $this->addHeader('To', implode(',', $this->_recipients)); - - if (!mail(implode(',', $this->_recipients), $this->_subject, $content, implode("\r\n", $this->_headers))) { - throw new Wootook_Core_Exception_RuntimeException('Could not send mail.'); - } - - return $this; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Email/Transport/Transport.php b/src/application/code/core/Wootook/Core/Email/Transport/Transport.php deleted file mode 100644 index fed059e..0000000 --- a/src/application/code/core/Wootook/Core/Email/Transport/Transport.php +++ /dev/null @@ -1,22 +0,0 @@ - - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ - -/** - * - * Enter description here ... - * @author Greg - * - */ -class Wootook_Core_ErrorProfiler -{ - private static $_singleton = null; - - protected $_errors = array(); - protected $_warnings = array(); - protected $_notices = array(); - protected $_otherErrors = array(); - protected $_exceptions = array(); - - private static $_isTraceRegistered = false; - - private $_listen = true; - - private $_mute = true; - - /** - * - * @return Wootook_Core_ErrorProfiler - */ - public static function getSingleton() - { - if (self::$_singleton === null) { - self::$_singleton = new self; - } - return self::$_singleton; - } - - public function errorManager($errno, $errstr, $errfile = null, $errline = null, Array $errcontext = array()) - { - if (!$this->_listen) { - return; - } - - $trace = debug_backtrace(); - - switch ($errno) { - case E_RECOVERABLE_ERROR: - case E_USER_ERROR: - case E_ERROR: - $this->_errors[] = array( - 'time' => explode(' ', microtime()), - 'code' => $errno, - 'message' => $errstr, - 'file' => $errfile, - 'line' => $errline, - 'context' => $errcontext, - 'trace' => $trace - ); - break; - - case E_USER_WARNING: - case E_WARNING: - $this->_warnings[] = array( - 'time' => explode(' ', microtime()), - 'code' => $errno, - 'message' => $errstr, - 'file' => $errfile, - 'line' => $errline, - 'context' => $errcontext, - 'trace' => $trace - ); - break; - - case E_USER_NOTICE: - case E_NOTICE: - $this->_notices[] = array( - 'time' => explode(' ', microtime()), - 'code' => $errno, - 'message' => $errstr, - 'file' => $errfile, - 'line' => $errline, - 'context' => $errcontext, - 'trace' => $trace - ); - break; - - default: - if (!isset($this->_otherErrors[$errno])) { - $this->_otherErrors[$errno] = array(); - } - - $this->_otherErrors[$errno][] = array( - 'time' => explode(' ', microtime()), - 'code' => $errno, - 'message' => $errstr, - 'file' => $errfile, - 'line' => $errline, - 'context' => $errcontext, - 'trace' => $trace - ); - break; - } - - return true; - } - - public function addException($exception) - { - $this->_exceptions[] = $exception; - } - - public function exceptionManager($exception) - { - if (!$this->_listen) { - return; - } - $this->_exceptions[] = new Wootook_Core_Exception_Exception('Uncaught Exception: ' . $exception->getMessage(), null, $exception); - } - - protected function _renderError($id, $error) - { - $types = array( - 0x0001 => 'E_ERROR', - 0x0002 => 'E_WARNING', - 0x0004 => 'E_PARSE', - 0x0008 => 'E_NOTICE', - 0x0010 => 'E_CORE_ERROR', - 0x0020 => 'E_CORE_WARNING', - 0x0040 => 'E_COMPILE_ERROR', - 0x0080 => 'E_COMPILE_WARNING', - 0x0100 => 'E_USER_ERROR', - 0x0200 => 'E_USER_WARNING', - 0x0400 => 'E_USER_NOTICE', - 0x0800 => 'E_STRICT', - 0x1000 => 'E_RECOVERABLE_ERROR', - 0x2000 => 'E_DEPRECATED', - 0x4000 => 'E_USER_DEPRECATED', - ); - - if (isset($error['code']) && isset($types[$error['code']])) { - $code = $types[$error['code']]; - } else { - $code = "Unknown ({$error['code']})"; - } - - $date = date('Y-m-d H:i:s', (int) $error['time'][1]); - $microsec = (int) ($error['time'][0] * 1000000); - - return <<_renderBacktrace($error['trace'])} - -ERROR_EOF; - } - - protected function _renderBacktrace(Array $traces) - { - $output = '
';
-        foreach (array_slice($traces, 1) as $key => $trace) {
-            if (preg_match('#^(include|require)(_once)?$#', $trace['function'])) {
-                $output .= sprintf("#%d %s(%s) called at [%s:%s]\n",
-                    $key, $trace['function'], $trace['args'][0], $trace['file'], $trace['line']);
-            } else if (!isset($trace['file']) || !isset($trace['line'])) {
-                if (isset($trace['class'])) {
-                    $output .= sprintf("#%d Internal function %s%s%s(%s)\n",
-                        $key, $trace['class'], $trace['type'], $trace['function'], implode(', ', $this->_formatArgs($trace['args'])));
-                } else {
-                    $output .= sprintf("#%d Internal function %s(%s)\n",
-                        $key, $trace['function'], implode(', ', $this->_formatArgs($trace['args'])));
-                }
-            } else {
-                if (isset($trace['class'])) {
-                    $output .= sprintf("#%d %s%s%s(%s) called at [%s:%s]\n",
-                        $key, $trace['class'], $trace['type'], $trace['function'], implode(', ', $this->_formatArgs($trace['args'])), $trace['file'], $trace['line']);
-                } else {
-                    $output .= sprintf("#%d %s(%s) called at [%s:%s]\n",
-                        $key, $trace['function'], implode(', ', $this->_formatArgs($trace['args'])), $trace['file'], $trace['line']);
-                }
-            }
-        }
-        return $output . '
'; - } - - private function _formatArgs($args) - { - $argumentList = array(); - foreach ($args as $argument) { - if (is_object($argument)) { - $argumentList[] = get_class($argument); - } else if (is_array($argument)) { - $keys = array_keys($argument); - $values = $this->_formatArgs($argument); - - $length = count($values); - $output = array(); - for ($index = 0; $index < $length; $index++) { - $output[] = sprintf('[%s] => %s', $keys[$index], $values[$index]); - } - - $argumentList[] = '[' . implode(', ', $output) . ']'; - } else { - $argumentList[] = var_export($argument, true); - } - } - - return $argumentList; - } - - protected function _renderConfig(Wootook_Core_Config_Node $config, $level = 0) - { - $output = '
    '; - foreach ($config as $key => $value) { - $output .= sprintf('
  • ', $level); - $output .= sprintf('%s', $key); - if ($value instanceof Wootook_Core_Config_Node) { - if (count($value) > 0) { - $output .= $this->_renderConfig($value, $level + 1); - } else { - $output .= 'Empty node'; - } - } else { - $output .= '' . htmlspecialchars(var_export($value, true), ENT_QUOTES, 'UTF-8') . ''; - } - $output .= '
  • '; - } - $output .= '
'; - - return $output; - } - - public function shutdownManager() - { - if ($this->_mute === true) { - return; - } - - $index = 0; - echo '
'; - echo '

Debug profiler

'; - echo '
'; - echo '
'; - echo ''; - echo '
'; - foreach ($this->_errors as $error) { - ++$index; - echo '

Message #' . $index . '

'; - echo '
';
-            echo $this->_renderError($index, $error);
-            echo '
'; - } - echo '
'; - echo ''; - echo '
'; - foreach ($this->_warnings as $error) { - ++$index; - echo '

Message #' . $index . '

'; - echo '
';
-            echo $this->_renderError($index, $error);
-            echo '
'; - } - echo '
'; - echo ''; - echo '
'; - foreach ($this->_notices as $error) { - ++$index; - echo '

Message #' . $index . '

'; - echo '
';
-            echo $this->_renderError($index, $error);
-            echo '
'; - } - echo '
'; - foreach ($this->_otherErrors as $errno => $errorList) { - echo ''; - echo '
'; - foreach ($errorList as $error) { - ++$index; - echo '

Message #' . $index . '

'; - echo '
';
-                echo $this->_renderError($index, $error);
-                echo '
'; - } - echo '
'; - } - echo ''; - echo '
'; - foreach ($this->_exceptions as $exception) { - ++$index; - echo '

Message #' . $index . '

'; - echo '
';
-            echo $exception->getMessage() . PHP_EOL;
-            echo $exception->getTraceAsString() . PHP_EOL;
-            echo '
'; - - $child = 0; - $current = $exception; - while (($current = $current->getPrevious()) !== null) { - $child++; - echo '

Message #' . $index . ', child level #' . $child . '

'; - echo '
';
-                echo $current->getMessage() . PHP_EOL;
-                echo $current->getTraceAsString() . PHP_EOL;
-                echo PHP_EOL;
-                echo '
'; - } - echo '
'; - } - echo '
'; - echo << -(function(){ -var sections = jQuery('.error-profiler'); -sections.each(function(){ - var element = jQuery(this); - element.hide(); - }); - -jQuery('.error-profiler-link').click(function(e){ - var rel = jQuery(this).attr('rel'); - sections.each(function(){ - var element = jQuery(this); - if (element.hasClass(rel) && !element.hasClass('opened')) { - element.slideDown(500, function(){element.addClass('opened');}); - } else { - element.slideUp(500, function(){element.removeClass('opened');}); - } - }); - }); -})(); - -JS_EOF; - echo '

Configuration profiler

'; - echo ''; - echo '
'; - $config = clone Wootook::getConfig(); - foreach ($config->getConfig('resource/database') as $node) { - if ($node->params) { - $node->params->reset(); - } - } - echo $this->_renderConfig(Wootook::getConfig(), 0); - echo '
'; - echo ''; - echo '
'; - echo $this->_renderConfig(Wootook::getWebsiteConfig()); - echo '
'; - echo ''; - echo '
'; - echo $this->_renderConfig(Wootook::getGameConfig()); - echo '
'; - echo ''; - echo << -(function(){ -var sections = jQuery('.config-profiler'); -sections.each(function(){ - var element = jQuery(this); - element.hide(); - }); - -jQuery('.config-profiler-link').click(function(e){ - var rel = jQuery(this).attr('rel'); - sections.each(function(){ - var element = jQuery(this); - if (element.hasClass(rel) && !element.hasClass('opened')) { - element.slideDown(500, function(){element.addClass('opened');}); - } else { - element.slideUp(500, function(){element.removeClass('opened');}); - } - }); - }); -})(); - -JS_EOF; - } - - public static function register() - { - set_error_handler(array(self::getSingleton(), 'errorManager')); - set_exception_handler(array(self::getSingleton(), 'exceptionManager')); - - if (defined('DEBUG')) { - self::getSingleton()->_mute = false; - } - - if (self::$_isTraceRegistered === false && defined('DEBUG')) { - self::$_isTraceRegistered = true; - register_shutdown_function(array(self::getSingleton(), 'shutdownManager')); - } - } - - public static function unregister($force = false) - { - restore_error_handler(); - restore_exception_handler(); - - self::getSingleton()->_mute = true; - - if ((self::$_isTraceRegistered === false && defined('DEBUG')) || $force) { - self::$_isTraceRegistered = true; - register_shutdown_function(array(self::getSingleton(), 'shutdownManager')); - } - } - - public function sleep() - { - $this->_listen = false; - } - - public function wakeup() - { - $this->_listen = true; - } -} diff --git a/src/application/code/core/Wootook/Core/Exception.php b/src/application/code/core/Wootook/Core/Exception.php deleted file mode 100644 index 7a9030d..0000000 --- a/src/application/code/core/Wootook/Core/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ - - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ - -/** - * - * Enter description here ... - * @author Greg - * - */ -interface Wootook_Core_Exception extends Wootook_Exception {} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Exception/Database/AdapterError.php b/src/application/code/core/Wootook/Core/Exception/Database/AdapterError.php deleted file mode 100644 index a399398..0000000 --- a/src/application/code/core/Wootook/Core/Exception/Database/AdapterError.php +++ /dev/null @@ -1,20 +0,0 @@ -_adapter = $adapter; - } - - public function getAdapter() - { - return $this->_adapter; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Exception/Database/Error.php b/src/application/code/core/Wootook/Core/Exception/Database/Error.php deleted file mode 100644 index 6d485fa..0000000 --- a/src/application/code/core/Wootook/Core/Exception/Database/Error.php +++ /dev/null @@ -1,5 +0,0 @@ -_statement = $statement; - } - - public function getStatement() - { - return $this->_statement; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Exception/Deprecated.php b/src/application/code/core/Wootook/Core/Exception/Deprecated.php deleted file mode 100644 index 75cbf77..0000000 --- a/src/application/code/core/Wootook/Core/Exception/Deprecated.php +++ /dev/null @@ -1,7 +0,0 @@ -= 50300) { - parent::__construct($message, $code, $previous); - } else { - parent::__construct($message, $code); - $this->_previous = $previous; - } - } - - public function __call($method, $params) - { - if (strtolower($method) == 'getprevious') { - return $this->_previous; - } - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Exception/GameError.php b/src/application/code/core/Wootook/Core/Exception/GameError.php deleted file mode 100644 index ab228a8..0000000 --- a/src/application/code/core/Wootook/Core/Exception/GameError.php +++ /dev/null @@ -1,7 +0,0 @@ -= 50300) { - parent::__construct($message, $code, $previous); - } else { - parent::__construct($message, $code); - $this->_previous = $previous; - } - } - - public function __call($method, $params) - { - if (strtolower($method) == 'getprevious') { - return $this->_previous; - } - } - - public function __toString() - { - return << - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ - -/** - * - * Enter description here ... - * @author Greg - * - */ -class Wootook_Core_Form -{ - protected $_elements = array(); - - protected $_request = null; - - /** - * - * Element class loader - * @var Wootook_Core_Form_ElementLoader - */ - protected $_elementLoader = null; - - /** - * - * Validator class loader - * @var Wootook_Core_Form_ValidatorLoader - */ - protected $_validatorLoader = null; - - /** - * - * Enter description here ... - * @var Wootook_Core_Model_Session - */ - protected $_session = null; - - public function __construct(Wootook_Core_Model_Session $session, Array $elements = array()) - { - $this->_session = $session; - - $this->_elementLoader = new Wootook_Core_Form_ElementLoader($this, array( - 'Wootook_Core_Form_Element_' => 'Wootook/Core/Form/Element' - )); - - $this->_validatorLoader = new Wootook_Core_Form_ValidatorLoader($this, array( - 'Wootook_Core_Form_Validator_' => 'Wootook/Core/Form/Validator' - )); - - $this->addElement('__formkey', 'text', array('form_key' => 'formKey')); - - foreach ($elements as $elementName => $elementConfig) { - if (is_string($elementConfig)) { - $this->addElement($elementName, $elementConfig); - } else if ($elementConfig instanceof Wootook_Core_Form_ElementAbstract) { - $this->addElement($elementName, $elementConfig); - } else { - if (isset($elementConfig['validators'])) { - $this->addElement($elementName, $elementConfig['type'], $elementConfig['validators']); - } else { - $this->addElement($elementName, $elementConfig['type']); - } - } - } - } - - public function validate() - { - foreach ($this->_elements as $element) { - if (!$element->validate()) { - return false; - } - } - return true; - } - - /** - * - * Enter description here ... - * @param string $name - * @param string|Wootook_Core_Form_ElementAbstract $type - * @return Wootook_Core_Form - */ - public function addElement($name, $type = 'text', Array $validators = array()) - { - if ($type instanceof Wootook_Core_Form_ElementAbstract) { - $this->_elements[$name] = $type; - $this->_elements[$name]->setForm($this); - } else { - $element = $this->_elementLoader->load($type); - - if ($element === null) { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException(new Wootook_Core_Exception_RuntimeException(sprintf('Element %1$s (type: %2$s) could not be created.', $name, $type))); - return $this; - } - $element->setForm($this); - $this->_elements[$name] = $element; - } - $this->_elements[$name]->setName($name); - - foreach ($validators as $validatorName => $validatorType) { - if ($validatorType instanceof Wootook_Core_Form_ElementAbstract) { - $this->_elements[$name]->addValidator($validatorType, $validatorName); - } else { - $validator = $this->_validatorLoader->load($validatorType); - - if ($validator === null) { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException(new Wootook_Core_Exception_RuntimeException(sprintf('Validator %1$s (type: %2$s) could not be created.', $validatorName, $validatorType))); - return $this; - } - $this->_elements[$name]->addValidator($validator, $validatorName); - } - } - - return $this; - } - - /** - * - * Enter description here ... - * @param string $name - * @return Wootook_Core_Form_ElementAbstract - */ - public function getElement($name) - { - if (!isset($this->_elements[$name])) { - return null; - } - - return $this->_elements[$name]; - } - - /** - * - * Enter description here ... - * @param string $name - * @return Wootook_Core_Model_Session - */ - public function getSession() - { - return $this->_session; - } - - public function setRequest(Wootook_Core_Mvc_Controller_Request_Http $request) - { - $this->_request = $request; - - return $this; - } - - /** - * - * Enter description here ... - * @return Wootook_Core_Mvc_Controller_Request_Http - */ - public function getRequest() - { - return $this->_request; - } - - public function getData() - { - $request = $this->getRequest(); - if ($request === null) { - return array(); - } - if ($request->isPost()) { - return $request->getAllPostData(); - } - return $request->getAllQueryData(); - } - - public function populate(Array $datas = array()) - { - $request = $this->getRequest(); - - foreach ($this->_elements as $elementName => $element) { - if (isset($datas[$elementName])) { - $element->populate($datas[$elementName]); - } else if ($request->isPost()) { - $element->populate($request->getPost($elementName)); - } else { - $element->populate($request->getQuery($elementName)); - } - } - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Element/Button.php b/src/application/code/core/Wootook/Core/Form/Element/Button.php deleted file mode 100644 index 4e17721..0000000 --- a/src/application/code/core/Wootook/Core/Form/Element/Button.php +++ /dev/null @@ -1,11 +0,0 @@ -setForm($form); - } - - $this->setName($name); - $this->setAllParams($params); - } - - abstract public function getType(); - - public function validate() - { - $data = $this->getData(); - - foreach ($this->_validators as $validator) { - if (!$validator->validate($this, $data)) { - return false; - } - } - return true; - } - - public function setName($name) - { - $this->_name = $name; - - return $this; - } - - public function getName() - { - return $this->_name; - } - - public function setAllParams($params) - { - $this->_params = $params; - - return $this; - } - - public function getAllParams() - { - return $this->_params; - } - - public function setParam($param, $value) - { - $this->_params[$param] = $value; - - return $this; - } - - public function getParam($param) - { - return $this->_params[$param]; - } - - public function hasParam($param) - { - return isset($this->_params[$param]); - } - - public function unsetParam($param) - { - unset($this->_params[$param]); - - return $this; - } - - public function setForm(Wootook_Core_Form $form) - { - $this->_form = $form; - - return $this; - } - - public function getForm() - { - return $this->_form; - } - - public function getData() - { - return $this->_value; - } - - public function populate($value) - { - $this->_value = $value; - - return $this; - } - - public function addValidator(Wootook_Core_Form_ValidatorAbstract $validator, $name = null) - { - if ($name === null) { - $this->_validators = array(); - $name = 'default'; - } - - $this->_validators[$name] = $validator; - - return $this; - } - - public function getValidator($name) - { - if (!isset($this->_validators[$name])) { - return null; - } - - return $this->_validators[$name]; - } - - public function clearValidator($name) - { - if (isset($this->_validators[$name])) { - unset($this->_validators[$name]); - } - - return $this; - } - - public function clearAllValidators() - { - $this->_validators = array(); - - return $this; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/ElementLoader.php b/src/application/code/core/Wootook/Core/Form/ElementLoader.php deleted file mode 100644 index 019f082..0000000 --- a/src/application/code/core/Wootook/Core/Form/ElementLoader.php +++ /dev/null @@ -1,37 +0,0 @@ -_form = $form; - - foreach ($namespaces as $namespace => $path) { - if (is_int($namespace)) { - $this->registerNamespace($path); - } else { - $this->registerNamespace($namespace, $path); - } - } - } - - protected function _load($className, $useSingleton, Array $constructorParams = array()) - { - $reflection = new ReflectionClass($className); - if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) { - $method = $reflection->getMethod('getSingleton'); - return $method->invoke(null); - } - - try { - return $reflection->newInstance($this->_form); - } catch (ReflectionException $e) { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException($e); - return null; - } - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Alnum.php b/src/application/code/core/Wootook/Core/Form/Validator/Alnum.php deleted file mode 100644 index cdacc4f..0000000 --- a/src/application/code/core/Wootook/Core/Form/Validator/Alnum.php +++ /dev/null @@ -1,21 +0,0 @@ -_validate($element, $data)) { - $this->_getSession($element) - ->addError('Field "%s" should only contain alphanumeric characters.', $element->getName()); - - return false; - } - return true; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Alpha.php b/src/application/code/core/Wootook/Core/Form/Validator/Alpha.php deleted file mode 100644 index fb091ce..0000000 --- a/src/application/code/core/Wootook/Core/Form/Validator/Alpha.php +++ /dev/null @@ -1,21 +0,0 @@ -_validate($element, $data)) { - $this->_getSession($element) - ->addError('Field "%s" should only contain alphabetic characters.', $element->getName()); - - return false; - } - return true; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Email.php b/src/application/code/core/Wootook/Core/Form/Validator/Email.php deleted file mode 100644 index 3ec8e21..0000000 --- a/src/application/code/core/Wootook/Core/Form/Validator/Email.php +++ /dev/null @@ -1,21 +0,0 @@ -_validate($element, $data)) { - $this->_getSession($element) - ->addError('Field "%s" should contain an email.', $element->getName()); - - return false; - } - return true; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Validator/FormKey.php b/src/application/code/core/Wootook/Core/Form/Validator/FormKey.php deleted file mode 100644 index 11f49d0..0000000 --- a/src/application/code/core/Wootook/Core/Form/Validator/FormKey.php +++ /dev/null @@ -1,20 +0,0 @@ -getForm(); - $session = $form->getSession(); - - if ($session->getFormKey(false) == $data) { - return true; - } - - $this->_getSession($field) - ->addError('CSRF token failure.', $field->getName()); - - return false; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Hex.php b/src/application/code/core/Wootook/Core/Form/Validator/Hex.php deleted file mode 100644 index cbb2913..0000000 --- a/src/application/code/core/Wootook/Core/Form/Validator/Hex.php +++ /dev/null @@ -1,22 +0,0 @@ -_validate($element, $data)) { - $this->_getSession($element) - ->addError('Field "%s" should only contain numeric characters.', $element->getName()); - - return false; - } - return true; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Host.php b/src/application/code/core/Wootook/Core/Form/Validator/Host.php deleted file mode 100644 index 4d1f7f5..0000000 --- a/src/application/code/core/Wootook/Core/Form/Validator/Host.php +++ /dev/null @@ -1,21 +0,0 @@ -_validate($element, $data)) { - $this->_getSession($element) - ->addError('Field "%s" should contain a host name.', $element->getName()); - - return false; - } - return true; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Numeric.php b/src/application/code/core/Wootook/Core/Form/Validator/Numeric.php deleted file mode 100644 index 35f275d..0000000 --- a/src/application/code/core/Wootook/Core/Form/Validator/Numeric.php +++ /dev/null @@ -1,22 +0,0 @@ -_validate($element, $data)) { - $this->_getSession($element) - ->addError('Field "%s" should only contain numeric characters.', $element->getName()); - - return false; - } - return true; - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Regex.php b/src/application/code/core/Wootook/Core/Form/Validator/Regex.php deleted file mode 100644 index 172a787..0000000 --- a/src/application/code/core/Wootook/Core/Form/Validator/Regex.php +++ /dev/null @@ -1,28 +0,0 @@ -_expression = $expression; - } - - public function validate(Wootook_Core_Form_ElementAbstract $element, $data) - { - if (!$this->_validate($element, $data)) { - $this->_getSession($element) - ->addError('Field "%s" does not match the validation pattern.', $element->getName()); - - return false; - } - return true; - } - - protected function _validate(Wootook_Core_Form_ElementAbstract $element, $data) - { - return preg_match($this->_expression, $data); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/ValidatorAbstract.php b/src/application/code/core/Wootook/Core/Form/ValidatorAbstract.php deleted file mode 100644 index d3f6da2..0000000 --- a/src/application/code/core/Wootook/Core/Form/ValidatorAbstract.php +++ /dev/null @@ -1,15 +0,0 @@ -getForm(); - if (!$form instanceof Wootook_Core_Form) { - return null; - } - return $element->getSession(); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Form/ValidatorLoader.php b/src/application/code/core/Wootook/Core/Form/ValidatorLoader.php deleted file mode 100644 index 123bd64..0000000 --- a/src/application/code/core/Wootook/Core/Form/ValidatorLoader.php +++ /dev/null @@ -1,37 +0,0 @@ -_form = $form; - - foreach ($namespaces as $namespace => $path) { - if (is_int($namespace)) { - $this->registerNamespace($path); - } else { - $this->registerNamespace($namespace, $path); - } - } - } - - protected function _load($className, $useSingleton, Array $constructorParams = array()) - { - $reflection = new ReflectionClass($className); - if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) { - $method = $reflection->getMethod('getSingleton'); - return $method->invoke(null); - } - - try { - return $reflection->newInstance(); - } catch (ReflectionException $e) { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException($e); - return null; - } - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/Model/Config.php b/src/application/code/core/Wootook/Core/Model/Config.php deleted file mode 100644 index 5607ddf..0000000 --- a/src/application/code/core/Wootook/Core/Model/Config.php +++ /dev/null @@ -1,61 +0,0 @@ -_tableName = 'core_config'; - $this->_idFieldNames = array('config_path', 'website_id', 'game_id'); - } - - public function setWebsiteId($websiteId) - { - return $this->setData('website_id', $websiteId); - } - - public function getWebsiteId() - { - return $this->getData('website_id'); - } - - public function setGameId($gameId) - { - return $this->setData('game_id', $gameId); - } - - public function getGameId() - { - return $this->getData('game_id'); - } - - public function setPath($path) - { - return $this->setData('config_path', $path); - } - - public function getPath() - { - return $this->getData('config_path'); - } - - public function setValue($value) - { - return $this->setData('config_value', $value); - } - - public function getValue() - { - return $this->getData('config_value'); - } -} diff --git a/src/application/code/core/Wootook/Core/Model/Game.php b/src/application/code/core/Wootook/Core/Model/Game.php deleted file mode 100644 index bc4c234..0000000 --- a/src/application/code/core/Wootook/Core/Model/Game.php +++ /dev/null @@ -1,23 +0,0 @@ -_tableName = 'core_game'; - $this->_idFieldName = 'game_id'; - } -} diff --git a/src/application/code/core/Wootook/Core/Model/Layout.php b/src/application/code/core/Wootook/Core/Model/Layout.php deleted file mode 100644 index d15057f..0000000 --- a/src/application/code/core/Wootook/Core/Model/Layout.php +++ /dev/null @@ -1,632 +0,0 @@ - - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ - -/** - * Page layout class utility. - * Builds page structures from flexible layout declaration files, written in a - * user-friendly XML format. - * - * @author Greg - * @since 1.5.0 - * @package Wootook - * @subpackage Wootook_Core - * @category layout - */ -class Wootook_Core_Model_Layout - extends Wootook_Core_Mvc_Model_Model -{ - const DEFAULT_PACKAGE = 'base'; - const DEFAULT_THEME = 'default'; - - const DOMAIN_FRONTEND = 'frontend'; - const DOMAIN_BACKEND = 'backend'; - - /** @var array */ - protected $_blocks = array(); - - /** @var Wootook_Core_Mvc_View_View */ - protected $_messageBlock = null; - - /** @var Wootook_Core_Mvc_View_View */ - protected $_rootView = null; - - /** @var string */ - protected $_eventPrefix = 'layout'; - - /** @var string */ - protected $_eventObject = 'layout'; - - /** @var string */ - protected $_domain = self::DOMAIN_FRONTEND; - - /** @var string */ - protected $_package = self::DEFAULT_PACKAGE; - - /** @var string */ - protected $_theme = self::DEFAULT_THEME; - - /** @var array */ - protected $_namespaces = array( - 'core' => array( - 'Wootook_Core_Block_' => 'Wootook/Core/Block' - ) - ); - - /** - * Page layout class utility. - * - * @param string $domain - * @param string $package - * @param string $theme - * @param array $data - */ - public function __construct($domain = null, $package = null, $theme = null, Array $data = array()) - { - if ($domain === null) { - if (Wootook::getDefaultWebsite()->getId() == 0) { - $this->_domain = self::DOMAIN_BACKEND; - } else { - $this->_domain = self::DOMAIN_FRONTEND; - } - } else { - $this->_domain = $domain; - } - if ($package !== null) { - $this->setPackage($package); - } - if ($theme !== null) { - $this->setTheme($theme); - } - - parent::__construct($data); - } - - public function _init() - { - $modules = Wootook_Core_Helper_Config_Modules::getSingleton(); - - foreach ($modules['block'] as $module => $moduleNamespaces) { - foreach ($moduleNamespaces as $namespace => $path) { - $this->registerBlockNamespace($module, $namespace, $path); - } - } - - $fileList = Wootook::getGameConfig('layout'); - if ($fileList instanceof Wootook_Core_Config_Node) { - $fileList = $fileList->toArray(); - } - if (!is_array($fileList) || empty($fileList)) { - $fileList = array(); - } - $this->_data = array(); - - $this->setPackage(Wootook::getWebsiteConfig('package')); - $this->setTheme(Wootook::getGameConfig('theme')); - - $parser = new Wootook_Core_Model_Layout_Parser(); - foreach ($fileList as $layoutFile) { - try { - if (preg_match('#\.php$#', $layoutFile)) { - $layoutData = include $this->_getLayoutPath($layoutFile); - } else { - $layoutData = $parser->parse($this->_getLayoutPath($layoutFile), $this->_getLayoutCachePath($layoutFile), 3600); - } - } catch (Wootook_Core_Exception_LayoutException $e) { - Wootook_Core_ErrorProfiler::getSingleton()->addException($e); - continue; - } - - if (!is_array($layoutData)) { - continue; - } - - foreach ($layoutData as $layoutId => $layoutConfig) { - if ($this->hasData($layoutId)) { - $declared = $this->getData($layoutId); - - if (isset($declared['block']) && !isset($layoutConfig['block'])) { - $layoutConfig['block'] = $declared['block']; - } - - if (isset($declared['reference'])) { - if (isset($layoutConfig['reference'])) { - $layoutConfig['reference'] = array_merge($declared['reference'], $layoutConfig['reference']); - } else { - $layoutConfig['reference'] = $declared['reference']; - } - } - } - - $this->setData($layoutId, $layoutConfig); - } - } - - $this->_messageBlock = $this->createBlock('core/messages', 'messages'); - - return $this; - } - - protected function _getAllParents(&$layoutConfigs, $currentHandle) - { - foreach ($currentHandle as $parent) { - $currentLayout = $this->getData($parent); - $layoutConfigs[] = $currentLayout; - - if (!isset($currentLayout['update'])) { - continue; - } - $this->_getAllParents($layoutConfigs, $currentLayout['update']); - } - } - - protected function _load() - { - $layoutId = func_get_arg(0); - - if (!$this->hasData($layoutId)) { - return $this; - } - - $layoutConfigs = array($this->getData($layoutId)); - if (isset($layoutConfigs[0]['update'])) { - $this->_getAllParents($layoutConfigs, $layoutConfigs[0]['update']); - } - - $layoutUpdates = array(); - $layoutConfig = array(); - foreach (array_reverse($layoutConfigs) as $config) { - if (!is_array($config)) { - continue; - } - $layoutConfig = array_merge($layoutConfig, $config); - - if (isset($layoutConfig['reference'])) { - foreach ($layoutConfig['reference'] as $name => $update) { - if (!isset($layoutUpdates[$name])) { - $layoutUpdates[$name] = array(); - } - $layoutUpdates[$name][] = $update; - } - unset($layoutConfig['reference']); - } - } - unset($layoutConfigs, $layoutConfig['update']); - - if (isset($layoutConfig['type'])) { - $type = $layoutConfig['type']; - $name = isset($layoutConfig['name']) ? $layoutConfig['name'] : 'root'; - - $this->_rootView = $this->_createBlock($type, $name, $layoutConfig); - } else if (!isset($this->_rootView)) { - return $this; - } - - foreach ($layoutUpdates as $block => $updates) { - if (!isset($this->_blocks[$block])) { - continue; - } - - $parent = $this->_blocks[$block]; - foreach ($updates as $update) { - if (isset($update['children'])) { - foreach ($update['children'] as $childName => $childConfig) { - $type = $childConfig['type']; - $alias = isset($childConfig['alias']) ? $childConfig['alias'] : $childName; - - $parent->$alias = $this->_createBlock($type, $childName, $childConfig); - } - } - } - } - - foreach ($layoutUpdates as $block => $updates) { - if (!isset($this->_blocks[$block])) { - continue; - } - - foreach ($updates as $update) { - if (isset($update['actions'])) { - $this->_callActions($this->_blocks[$block], $update['actions']); - } - } - } - - Wootook::dispatchEvent($this->_eventPrefix . '.prepare.before', array( - $this->_eventObject => $this - )); - - foreach ($this->_blocks as $block) { - $block->prepareLayout(); - } - - Wootook::dispatchEvent($this->_eventPrefix . '.prepare.after', array( - $this->_eventObject => $this - )); - } - - protected function _save() - { - throw new Wootook_Core_Exception_LayoutException('Save not permitted for the layout manager.'); - } - - protected function _delete() - { - throw new Wootook_Core_Exception_LayoutException('Delete not permitted for the layout manager.'); - } - - protected function _resolveBlockClassType($type) - { - $offset = strpos($type, '/'); - if ($offset === false) { - return null; - } - - $module = substr($type, 0, $offset); - $block = substr($type, $offset + 1); - - /* - $module = str_replace(' ', '', ucwords(str_replace('-', ' ', $module))); - $module = str_replace(' ', '_', ucwords(str_replace('.', ' ', $module))); - */ - $block = str_replace(' ', '', ucwords(str_replace('-', ' ', $block))); - $block = str_replace(' ', '_', ucwords(str_replace('.', ' ', $block))); - - if (isset($this->_namespaces[$module])) { - foreach ($this->_namespaces[$module] as $namespace => $path) { - $className = $namespace . $block; - $fileName = $path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $block) . '.php'; - - Wootook_Core_ErrorProfiler::getSingleton()->sleep(); - if (!($fp = @fopen($fileName, 'r', true))) { - Wootook_Core_ErrorProfiler::getSingleton()->wakeup(); - continue; - } - Wootook_Core_ErrorProfiler::getSingleton()->wakeup(); - fclose($fp); - - if (!class_exists($className, true)) { - continue; - } - - return $className; - } - } - - Wootook_Core_ErrorProfiler::getSingleton() - ->addException(new Wootook_Core_Exception_LayoutException(sprintf('Class type "%s" could not be resolved.', $type))); - return null; - } - - /** - * Register a new block namespage for use in the layout declaration files - * - * @since 1.5.0 - * @param string $module - * @param string $namespace - * @param string|null $path - * @return Wootook_Core_Model_Layout - */ - public function registerBlockNamespace($module, $namespace, $path = null) - { - if ($path === null) { - $path = str_replace('_', DIRECTORY_SEPARATOR, $namespace); - } - if (!isset($this->_namespaces[$module])) { - $this->_namespaces[$module] = array(); - } - $this->_namespaces[$module][$namespace] = $path; - - return $this; - } - - /** - * Unregister a previously declared block namespace - * - * @since 1.5.0 - * @param string $module - * @param string $namespace - * @return Wootook_Core_Model_Layout - */ - public function unregisterBlockNamespace($module, $namespace) - { - if (isset($this->_namespaces[$module]) && isset($this->_namespaces[$module][$namespace])) { - unset($this->_namespaces[$module][$namespace]); - } - - return $this; - } - - /** - * Create a new block instance - * - * @param string $type - * @param string $name - * @param array $config - * @return Wootook_Core_Mvc_View_View - */ - public function createBlock($type, $name, $config = array()) - { - $instance = $this->_createBlock($type, $name, $config); - - if ($instance === null) { - return null; - } - $instance->prepareLayout(); - - return $instance; - } - - protected function _createBlock($type, $name, $config = array()) - { - $className = $this->_resolveBlockClassType($type); - - if ($className === null) { - return null; - } - - $children = array(); - if (isset($config['children'])) { - $children = $config['children']; - unset($config['children']); - } - $actions = array(); - if (isset($config['actions'])) { - $actions = $config['actions']; - unset($config['actions']); - } - - try { - $reflectionClass = new ReflectionClass($className); - - $instance = $reflectionClass->newInstance($config); - $this->_blocks[$name] = $instance; - $instance->setNameInLayout($name); - - $instance->setLayout($this); - - foreach ($children as $name => $config) { - if (isset($config['alias'])) { - $alias = $config['alias']; - } else { - $alias = $name; - } - - if (!isset($config['type'])) { - $instance->$alias = new Wootook_Core_Mvc_View_View($config); - } else { - $child = $this->_createBlock($config['type'], $name, $config); - if ($child !== null) { - $instance->$alias = $child; - } - } - } - } catch (ReflectionException $e) { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException($e); - return null; - } - - $this->_callActions($instance, $actions); - - return $instance; - } - - protected function _callActions($block, $actions) - { - $reflectionClass = new ReflectionClass($block); - - foreach ($actions as $action) { - if (!isset($action['method'])) { - continue; - } - $method = $action['method']; - - $params = array(); - if (isset($action['params'])) { - $params = $action['params']; - } - - try { - $reflectionMethod = $reflectionClass->getMethod($method); - $requiredParameterCount = $reflectionMethod->getNumberOfRequiredParameters(); - $callParamaters = array(); - foreach ($reflectionMethod->getParameters() as $parameter) { - $paramterName = strtolower(preg_replace('#([A-Z])#', '-\\1', $parameter->getName())); - $paramterPosition = $parameter->getPosition(); - - if (isset($params[$paramterName])) { - $callParamaters[$paramterPosition] = $params[$paramterName]; - } else if ($parameter->isDefaultValueAvailable()) { - $callParamaters[$paramterPosition] = $parameter->getDefaultValue(); - //} else if (!$parameter->isOptionnal()) { - } else if ($paramterPosition <= $requiredParameterCount) { - throw new Wootook_Core_Exception_LayoutException(Wootook::__('Method %s requires parameter %d ($%s) to be defined.', - $reflectionMethod->getName(), $paramterPosition + 1, $paramterName)); - } - } - - $reflectionMethod->invokeArgs($block, $callParamaters); - } catch (ReflectionException $e) { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException($e); - continue; - } catch (RuntimeException $e) { - Wootook_Core_ErrorProfiler::getSingleton() - ->addException($e); - continue; - } - } - } - - /** - * Get the current Layout domain (frontend or backend) - * - * @since 1.5.0 - * @return string - */ - public function getDomain() - { - return $this->_domain; - } - - /** - * Set the current Layout domain (frontend or backend) - * - * @since 1.5.0 - * @param string $domain - * @return Wootook_Core_Model_Layout - */ - public function setDomain($domain) - { - $this->_domain = $domain; - $this->_init(); - - return $this; - } - - public function getPackage() - { - if ($this->_package === null) { - $this->_package = self::DEFAULT_PACKAGE; - } - return $this->_package; - } - - public function setPackage($package) - { - $this->_package = $package; - - return $this; - } - - public function getTheme() - { - if ($this->_theme === null) { - $this->_theme = self::DEFAULT_THEME; - } - return $this->_theme; - } - - public function setTheme($theme) - { - $this->_theme = $theme; - - return $this; - } - - public function getScriptPath() - { - return Wootook::getBasePath('design') . DIRECTORY_SEPARATOR . $this->getDomain(); - } - - public function getAllBlocks() - { - return $this->_blocks; - } - - public function getBlock($code) - { - if (isset($this->_blocks[$code])) { - return $this->_blocks[$code]; - } - return null; - } - - public function render() - { - if (!$this->_rootView instanceof Wootook_Core_Mvc_View_View) { - throw new Wootook_Core_Exception_LayoutException(Wootook::__('No root view declared.')); - } - - $scriptPath = $this->getScriptPath(); - foreach ($this->_blocks as $block) { - if ($block instanceof Wootook_Core_Block_Template) { - $block->setScriptPath($scriptPath); - } - $block->beforeToHtml(); - } - unset($block); - - return $this->_rootView->render(); - } - - protected function _getLayoutCachePath($file) - { - $package = $this->getPackage(); - $theme = $this->getTheme(); - $pattern = APPLICATION_PATH . "cache/" . __CLASS__ . "--{$this->getDomain()}-%s-%s-{$file}.cache"; - - if (empty($package)) { - $package = self::DEFAULT_PACKAGE; - } - if (empty($theme)) { - $theme = self::DEFAULT_THEME; - } - - return sprintf($pattern, $package, $theme); - } - - protected function _getLayoutPath($file) - { - $package = $this->getPackage(); - $theme = $this->getTheme(); - $pattern = "{$this->getScriptPath()}/%s/%s/layouts/{$file}"; - - if ($package !== null && $theme !== null) { - $path = sprintf($pattern, $package, $theme); - if (Wootook::fileExists($path)) { - return $path; - } - } - - if ($package !== null) { - $path = sprintf($pattern, $package, self::DEFAULT_THEME); - if (Wootook::fileExists($path)) { - return $path; - } - } - - $path = sprintf($pattern, self::DEFAULT_PACKAGE, self::DEFAULT_THEME); - if (Wootook::fileExists($path)) { - return $path; - } - - throw new Wootook_Core_Exception_LayoutException(sprintf("Layout file '%s' does not exist.", $file)); - } - - /** - * - * @return Wootook_Core_Block_Messages - */ - public function getMessagesBlock() - { - return $this->_messageBlock; - } -} diff --git a/src/application/code/core/Wootook/Core/Model/Layout/Parser.php b/src/application/code/core/Wootook/Core/Model/Layout/Parser.php deleted file mode 100644 index 1e07ae8..0000000 --- a/src/application/code/core/Wootook/Core/Model/Layout/Parser.php +++ /dev/null @@ -1,165 +0,0 @@ - 0 && (time() - filemtime($cachePath) <= $cacheLifetime)) { - return include $cachePath; - } - - $parsedData = $this->_parse($filename); - - if ($cachePath !== null) { - $parsedData->save($cachePath); - } - - return $parsedData->toArray(); - } - - protected function _parse($filename) - { - $layout = simplexml_load_file($filename); - - if ($layout->getName() !== 'layout') { - return array(); - } - - $result = new Wootook_Core_Config_Adapter_Array(); - foreach ($layout->handle as $handle) { - $name = (string) $handle['name']; - if (empty($name)) { - continue; - } - - $handleNode = new Wootook_Core_Config_Node(array(), $result); - $result->$name = $handleNode; - - if (isset($handle->update)) { - $updateListNode = new Wootook_Core_Config_Node(array(), $handleNode); - $handleNode->update = $updateListNode; - - foreach ($handle->update as $update) { - if (isset($update['name'])) { - $updateListNode->__set(uniqid(), (string) $update['name']); - } - } - } - - if (isset($handle->block)) { - $this->_parseBlock($handle->block[0], $handleNode); - } - - if (isset($handle->reference)) { - $referenceListNode = new Wootook_Core_Config_Node(array(), $handleNode); - $handleNode->reference = $referenceListNode; - - foreach ($handle->reference as $reference) { - $referenceName = (string) $reference['name']; - if (empty($referenceName)) { - continue; - } - - $referenceNode = new Wootook_Core_Config_Node(array(), $referenceListNode); - $referenceListNode->$referenceName = $referenceNode; - - $this->_parseBlockBody($reference, $referenceNode); - } - } - } - - return $result; - } - - protected function _parseBlock(SimpleXMLElement $handle, Wootook_Core_Config_Node $blockNode) - { - foreach ($handle->attributes() as $attributeName => $attributeValue) { - $blockNode->$attributeName = (string) $attributeValue; - } - - $this->_parseBlockBody($handle, $blockNode); - } - - protected function _parseBlockBody(SimpleXMLElement $handle, Wootook_Core_Config_Node $blockNode) - { - if (isset($handle->block)) { - $childrenNode = new Wootook_Core_Config_Node(array(), $blockNode); - $blockNode->children = $childrenNode; - - foreach ($handle->block as $block) { - $blockName = (string) $block['name']; - if (empty($blockName)) { - continue; - } - - $childNode = new Wootook_Core_Config_Node(array(), $childrenNode); - $childrenNode->$blockName = $childNode; - - $this->_parseBlock($block, $childNode); - } - } - - if (isset($handle->action)) { - $actionListNode = new Wootook_Core_Config_Node(array(), $blockNode); - $blockNode->actions = $actionListNode; - - foreach ($handle->action as $action) { - $methodName = (string) $action['method']; - if (empty($methodName)) { - continue; - } - - $actionNode = new Wootook_Core_Config_Node(array( - 'method' => $methodName, - 'params' => array() - ), $actionListNode); - - $actionListNode[] = $actionNode; - - if (isset($action->param)) { - $paramsNode = $actionNode->params; - - foreach ($action->param as $param) { - $paramName = (string) $param['name']; - if (empty($paramName)) { - continue; - } - - if (count($param)) { - if (isset($param->const) && isset($param->const['name']) && defined((string) $param->const['name'])) { - $paramsNode->$paramName = constant((string) $param->const['name']); - } else { - $paramArrayNode = new Wootook_Core_Config_Node(array(), $paramsNode); - $paramsNode->$paramName = $paramArrayNode; - - $this->_parseArrayParam($param, $paramArrayNode); - } - } else { - $paramsNode->$paramName = (string) $param; - } - } - } - } - } - } - - protected function _parseArrayParam(SimpleXMLElement $element, Wootook_Core_Config_Node $parentNode) - { - foreach ($element->children() as $child) { - if (count($child)) { - $childNode = new Wootook_Core_Config_Node(array(), $parentNode); - $parentNode->{$child->getName()} = $childNode; - - $this->_parseArrayParam($child, $childNode); - continue; - } - - $parentNode->{$child->getName()} = (string) $child; - } - } -} diff --git a/src/application/code/core/Wootook/Core/Model/Session.php b/src/application/code/core/Wootook/Core/Model/Session.php deleted file mode 100644 index 2306f03..0000000 --- a/src/application/code/core/Wootook/Core/Model/Session.php +++ /dev/null @@ -1,226 +0,0 @@ - 'CRIT', - self::ERR => 'ERR', - self::WARN => 'WARN', - self::INFO => 'INFO', - self::DEBUG => 'DEBUG', - self::SUCCESS => 'SUCCESS' - ); - - protected $_messages = array(); - - const COOKIE_LIFETIME_CONFIG_KEY = 'web/session/time'; - const COOKIE_DOMAIN_CONFIG_KEY = 'web/session/domain'; - const COOKIE_PATH_CONFIG_KEY = 'web/session/path'; - - const IDENTIFIER_MESSAGES = 'messages'; - const IDENTIFIER_DATA = 'data'; - - public static function factory($namespace) - { - $namespace = (string) $namespace; - if (!isset(self::$_instances[$namespace])) { - self::$_instances[$namespace] = new self($namespace); - } - return self::$_instances[$namespace]; - } - - public static function destroy() - { - session_destroy(); - } - - public function __construct($namespace) - { - if (session_id() == '') { - session_set_cookie_params($this->getCookieLifetime(), $this->getCookiePath(), $this->getCookieDomain(), false, true); - - session_cache_limiter('private_no_expire'); - session_cache_expire(15); - - session_start(); - session_regenerate_id(true); - } - - if (!isset($_SESSION[$namespace])) { - $_SESSION[$namespace] = array( - self::IDENTIFIER_MESSAGES => array(), - self::IDENTIFIER_DATA => array() - ); - } - - if (!isset($_SESSION[$namespace][self::IDENTIFIER_MESSAGES]) || !is_array($_SESSION[$namespace][self::IDENTIFIER_MESSAGES])) { - $_SESSION[$namespace][self::IDENTIFIER_MESSAGES] = array(); - } - - $this->_data = &$_SESSION[$namespace][self::IDENTIFIER_DATA]; - $this->_messages = &$_SESSION[$namespace][self::IDENTIFIER_MESSAGES]; - } - - public function getCookieLifetime() - { - $lifetime = Wootook::getWebsiteConfig(self::COOKIE_LIFETIME_CONFIG_KEY); - if (!is_numeric($lifetime) || $lifetime <= 0) { - return 900; - } - - return $lifetime; - } - - public function getCookieDomain() - { - $domain = Wootook::getWebsiteConfig(self::COOKIE_DOMAIN_CONFIG_KEY); - if ($domain === null) { - return $_SERVER['SERVER_NAME']; - } - return $domain; - } - - public function getCookiePath() - { - $path = Wootook::getWebsiteConfig(self::COOKIE_PATH_CONFIG_KEY); - if ($path === null) { - return '/'; - } - return $path; - } - - public function getMessages($clear = true) - { - $messages = $this->_messages; - if ($clear == true) { - $this->_messages = array(); - } - return $messages; - } - - public function addMessage($message, $type = self::DEBUG) - { - if (!isset(self::$_levels[$type])) { - $type = self::DEBUG; - } - - if (!isset($this->_messages)) { - $this->_messages = array(); - } - if (!isset($this->_messages[self::$_levels[$type]])) { - $this->_messages[self::$_levels[$type]] = array(); - } - $this->_messages[self::$_levels[$type]][] = $message; - - return $this; - } - - public function addCritical($message, $_ = null) - { - $args = func_get_args(); - array_shift($args); - - return $this->addMessage(vsprintf($message, $args), self::CRIT); - } - - public function addError($message, $_ = null) - { - $args = func_get_args(); - array_shift($args); - - return $this->addMessage(vsprintf($message, $args), self::ERR); - } - - public function addWarning($message, $_ = null) - { - $args = func_get_args(); - array_shift($args); - - return $this->addMessage(vsprintf($message, $args), self::WARN); - } - - public function addSuccess($message, $_ = null) - { - $args = func_get_args(); - array_shift($args); - - return $this->addMessage(vsprintf($message, $args), self::SUCCESS); - } - - public function addInfo($message, $_ = null) - { - $args = func_get_args(); - array_shift($args); - - return $this->addMessage(vsprintf($message, $args), self::INFO); - } - - public function addDebug($message, $_ = null) - { - $args = func_get_args(); - array_shift($args); - - return $this->addMessage(vsprintf($message, $args), self::DEBUG); - } - - public function initFormKey() - { - $key = $this->getData('form_key'); - $this->setData('form_key', uniqid()); - - return $key; - } - - public function getFormKey($reset = true) - { - if (!$this->getData('form_key')) { - $this->initFormKey(); - return $this->getData('form_key'); - } - - if ($reset === true) { - $this->initFormKey(); - } - - return $this->getData('form_key'); - } - - public function setFormData(Array $data = array()) - { - if (isset($data['__formkey'])) { - unset($data['__formkey']); - } - - $this->setData('form_data', $data); - - return $this; - } - - public function getFormData($key = null, $default = null) - { - $data = $this->getData('form_data'); - if ($key === null) { - return $data; - } else if (isset($data[$key])) { - return $data[$key]; - } - return $default; - } -} diff --git a/src/application/code/core/Wootook/Core/Model/Website.php b/src/application/code/core/Wootook/Core/Model/Website.php deleted file mode 100644 index 018edac..0000000 --- a/src/application/code/core/Wootook/Core/Model/Website.php +++ /dev/null @@ -1,23 +0,0 @@ -_tableName = 'core_website'; - $this->_idFieldName = 'website_id'; - } -} diff --git a/src/application/code/core/Wootook/Core/Mvc/Controller/Action.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Action.php deleted file mode 100644 index e6230ba..0000000 --- a/src/application/code/core/Wootook/Core/Mvc/Controller/Action.php +++ /dev/null @@ -1,164 +0,0 @@ -setRequest($request); - $this->setResponse($response); - } - - public function init() - { - } - - public function preDispatch() - { - } - - public function postDispatch() - { - } - - public function setRequest(Wootook_Core_Mvc_Controller_Request_Http $request) - { - $this->_request = $request; - - return $this; - } - - public function setResponse(Wootook_Core_Mvc_Controller_Response_Http $response) - { - $this->_response = $response; - - return $this; - } - - /** - * - * @return Wootook_Core_Mvc_Controller_Request_Http - */ - public function getRequest() - { - return $this->_request; - } - - /** - * - * @return Wootook_Core_Mvc_Controller_Response_Http - */ - public function getResponse() - { - return $this->_response; - } - - protected function _forward($action, $controller = null, $module = null) - { - $request = $this->getRequest(); - - $request->setActionName($action); - if ($controller !== null) { - $request->setControllerName($controller); - if ($module != null) { - $request->setModuleName($module); - } - } - $this->getResponse()->setIsDispatched(false); - } - - protected function _redirect($uri, Array $params = array(), $code = Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_FOUND) - { - $parts = explode('/', $uri); - $partsCount = count($parts); - if ($partsCount > 0 && $parts[0] == '*') { - $parts[0] = $this->getRequest()->getModuleName(); - if ($partsCount > 1 && $parts[1] == '*') { - $parts[1] = $this->getRequest()->getControllerName(); - if ($partsCount > 2 && $parts[2] == '*') { - $parts[2] = $this->getRequest()->getActionName(); - } - } - } - $uri = implode('/', array_slice($parts, 0, 3)); - - $this->getResponse() - ->setRedirect(Wootook::getUrl($uri, $params), $code); - - Wootook_Core_ErrorProfiler::unregister(true); - - return $this; - } - - protected function _redirectUrl($url, $code = Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_FOUND) - { - $this->getResponse()->setRedirect($url, $code); - - return $this; - } - - protected function _buildLayoutHandle() - { - $request = $this->getRequest(); - - $module = $request->getModuleName(); - $controller = $request->getControllerName(); - $action = $request->getActionName(); - - return "{$module}.{$controller}.{$action}"; - } - - public function loadLayout($handle = null) - { - if ($this->_layout === null) { - $this->_layout = $this->_initLayout(); - } - - if ($handle === null) { - $handle = $this->_buildLayoutHandle(); - } - $this->_layout->load($handle); - - return $this; - } - - protected function _initLayout() - { - return new Wootook_Core_Model_Layout(Wootook_Core_Model_Layout::DOMAIN_FRONTEND); - } - - /** - * - * @return Wootook_Core_Model_Layout - */ - public function getLayout() - { - return $this->_layout; - } - - public function renderLayout() - { - try { - $content = $this->getLayout()->render(); - } catch (Wootook_Core_Exception_LayoutException $e) { - Wootook_Core_ErrorProfiler::getSingleton()->addException($e); - return $this; - } - $this->getResponse()->setBody($content); - - return $this; - } - - protected function _prepareLayoutMessages($namespace) - { - $this->getLayout() - ->getMessagesBlock() - ->prepareMessages($namespace); - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Mvc/Controller/Front.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Front.php deleted file mode 100644 index 6c6b20f..0000000 --- a/src/application/code/core/Wootook/Core/Mvc/Controller/Front.php +++ /dev/null @@ -1,271 +0,0 @@ - array( - 'modules' => array( - 'core' => array( - 'class' => 'Wootook_Core_Controller_', - 'path' => 'Wootook/Core/Controller' - ) - ), - 'defaults' => array( - 'module' => 'core', - 'controller' => 'error', - 'action' => 'no-route' - ) - ), - self::ROUTE_DEFAULT => array( - 'modules' => array( - ), - 'defaults' => array( - 'module' => 'core', - 'controller' => 'index', - 'action' => 'index' - ) - ) - ); - - protected $_request = null; - protected $_response = null; - - public function __construct(Wootook_Core_Mvc_Controller_Request_Request $request, - Wootook_Core_Mvc_Controller_Response_Response $response) - { - $this->_request = $request; - $this->_response = $response; - } - - protected function _setNoRouteAction(&$route, &$moduleKey, &$controllerKey, &$actionKey) - { - $route = self::ROUTE_ERROR; - $moduleKey = $this->_routes[self::ROUTE_ERROR]['defaults']['module']; - $controllerKey = $this->_routes[self::ROUTE_ERROR]['defaults']['controller']; - $actionKey = $this->_routes[self::ROUTE_ERROR]['defaults']['action']; - - return $this; - } - - protected function _setDefaultRouteAction(&$route, &$moduleKey, &$controllerKey, &$actionKey) - { - $route = self::ROUTE_DEFAULT; - $moduleKey = $this->_routes[self::ROUTE_DEFAULT]['defaults']['module']; - $controllerKey = $this->_routes[self::ROUTE_DEFAULT]['defaults']['controller']; - $actionKey = $this->_routes[self::ROUTE_DEFAULT]['defaults']['action']; - - return $this; - } - - protected function _camelizeClass($string) - { - $string = strtolower($string); - $string = str_replace(' ', '_', ucwords(str_replace('.', ' ', $string))); - return str_replace(' ', '', ucwords(str_replace('-', ' ', $string))); - } - - protected function _camelizePath($string) - { - $string = strtolower($string); - $string = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('.', ' ', $string))); - return str_replace(' ', '', ucwords(str_replace('-', ' ', $string))); - } - - protected function _camelizeMethod($string) - { - return lcfirst(str_replace(' ', '', ucwords(str_replace('-', ' ', $string)))); - } - - protected function _getControllerClass($route, $module, $controllerKey) - { - if (!isset($this->_routes[$route])) { - return null; - } - if (!isset($this->_routes[$route]['modules'][$module])) { - return null; - } - $modulePrefix = $this->_routes[$route]['modules'][$module]['class']; - return $modulePrefix . $this->_camelizeClass($controllerKey) . 'Controller'; - } - - protected function _getControllerFilename($route, $module, $controllerKey) - { - if (!isset($this->_routes[$route])) { - return null; - } - if (!isset($this->_routes[$route]['modules'][$module])) { - return null; - } - $modulePath = $this->_routes[$route]['modules'][$module]['path']; - - return $modulePath . DIRECTORY_SEPARATOR . $this->_camelizePath($controllerKey) . 'Controller.php'; - } - - protected function _getActionMethod($actionKey) - { - return $this->_camelizeMethod($actionKey) . 'Action'; - } - - protected function _forward($action, $controller = null, $module = null) - { - $this->_request->setActionName($action); - if ($controller !== null) { - $this->_request->setControllerName($controller); - if ($module != null) { - $this->_request->setModuleName($module); - } - } - $this->_response->setIsDispatched(false); - } - - public function dispatch($route = null) - { - if ($route == null) { - $route = self::ROUTE_DEFAULT; - } - - if (!isset($this->_routes[$route])) { - $route = self::ROUTE_DEFAULT; - } - - $loop = 0; - while ($loop++ < 100) { - $moduleKey = $this->_request->getModuleName(); - if (empty($moduleKey)) { - $this->_forward( - $this->_routes[$route]['defaults']['action'], - $this->_routes[$route]['defaults']['controller'], - $this->_routes[$route]['defaults']['module'] - ); - continue; - } - - if (!isset($this->_routes[$route]['modules'][$moduleKey])) { - $this->_forward( - $this->_routes[self::ROUTE_ERROR]['defaults']['action'], - $this->_routes[self::ROUTE_ERROR]['defaults']['controller'], - $this->_routes[self::ROUTE_ERROR]['defaults']['module'] - ); - $route = self::ROUTE_ERROR; - continue; - } - - $controllerKey = $this->_request->getControllerName(); - if (empty($controllerKey)) { - $controllerKey = $this->_routes[$route]['defaults']['controller']; - } - - $controllerClass = $this->_getControllerClass($route, $moduleKey, $controllerKey); - $controllerPath = $this->_getControllerFilename($route, $moduleKey, $controllerKey); - - if (!class_exists($controllerClass, false) && Wootook::fileExists($controllerPath)) { - include_once $controllerPath; - } - - if (!class_exists($controllerClass, false)) { - $this->_forward( - $this->_routes[self::ROUTE_ERROR]['defaults']['action'], - $this->_routes[self::ROUTE_ERROR]['defaults']['controller'], - $this->_routes[self::ROUTE_ERROR]['defaults']['module'] - ); - $route = self::ROUTE_ERROR; - continue; - } - - $actionKey = $this->_request->getActionName(); - if (empty($actionKey)) { - $actionKey = $this->_routes[$route]['defaults']['action']; - } - - $actionMethod = $this->_getActionMethod($actionKey); - if (!method_exists($controllerClass, $actionMethod)) { - $this->_forward( - $this->_routes[self::ROUTE_ERROR]['defaults']['action'], - $this->_routes[self::ROUTE_ERROR]['defaults']['controller'], - $this->_routes[self::ROUTE_ERROR]['defaults']['module'] - ); - $route = self::ROUTE_ERROR; - continue; - } - - $controller = new $controllerClass($this->_request, $this->_response); - $controller->init(); - - $this->_response->setIsDispatched(); - - $this->preDispatch(); - $controller->preDispatch(); - if (!$this->_response->isDispatched()) { - continue; - } - if ($this->_response->isRedirect()) { - break; - } - - $controller->$actionMethod(); - - if (!$this->_response->isDispatched()) { - continue; - } - - $controller->postDispatch(); - $this->postDispatch(); - - if ($this->_response->isDispatched() || $this->_response->isRedirect()) { - break; - } - } - - return $this; - } - - public function send() - { - $this->_response->render(); - } - - public function addModule($frontName, $namespace, $path) - { - $this->_routes[self::ROUTE_DEFAULT]['modules'][$frontName] = array( - 'class' => $namespace, - 'path' => $path - ); - - return $this; - } - - public function setDefaults($module, $controller, $action) - { - $this->_routes[self::ROUTE_DEFAULT]['defaults'] = array( - 'module' => $module, - 'controller' => $controller, - 'action' => $action - ); - - return $this; - } - - public function preDispatch() - { - Wootook::dispatchEvent('core.mvc.controller.front.pre-dispatch', array( - 'request' => $this->_request, - 'response' => $this->_response - )); - - return $this; - } - - public function postDispatch() - { - Wootook::dispatchEvent('core.mvc.controller.front.post-dispatch', array( - 'request' => $this->_request, - 'response' => $this->_response - )); - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Http.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Http.php deleted file mode 100644 index 3780a37..0000000 --- a/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Http.php +++ /dev/null @@ -1,374 +0,0 @@ -_baseUrl = Wootook::getBaseUrl('link'); - if ($this->_baseUrl === null) { - $this->_baseUrl = 'http://' . $this->getServer('HTTP_HOST') . $this->getServer('REQUEST_URI'); - } - $offset = strpos($this->_baseUrl, '/', 8); - if ($offset !== false) { - $baseUri = substr($this->_baseUrl, $offset); // Get the path from the DocumentRoot - } else { - $baseUri = '/'; - } - - $params = ''; - if (($offset = strpos($this->getServer('REQUEST_URI'), $baseUri)) !== false) { - $queryParamsOffset = strpos($this->getServer('REQUEST_URI'), '?'); - if ($queryParamsOffset !== false) { - $path = substr($this->getServer('REQUEST_URI'), $offset + strlen($baseUri), $queryParamsOffset - $offset - 1); - } else { - $path = substr($this->getServer('REQUEST_URI'), $offset + strlen($baseUri)); - } - - $moduleOffset = strpos($path, '/'); - if ($moduleOffset !== false) { - $this->setModuleName(substr($path, 0, $moduleOffset)); - - $controllerOffset = strpos($path, '/', $moduleOffset + 1); - if ($controllerOffset !== false) { - $this->setControllerName(substr($path, $moduleOffset + 1, $controllerOffset - $moduleOffset - 1)); - - $actionOffset = strpos($path, '/', $controllerOffset + 1); - if ($actionOffset !== false) { - $this->setActionName(substr($path, $controllerOffset + 1, $actionOffset - $controllerOffset - 1)); - - $params = substr($path, $actionOffset); - } else if ($controllerOffset !== false) { - $this->setActionName(substr($path, $controllerOffset + 1)); - } - } else if ($moduleOffset !== false) { - $this->setControllerName(substr($path, $moduleOffset + 1)); - } - } else { - $this->setModuleName($path); - } - } - - if (!empty($params)) { - $paramOffset = 0; - $valueOffset = 0; - while (true) { - $paramOffset = strpos($params, '/', $valueOffset + 1); - if ($paramOffset === false) { - break; - } - $paramKey = substr($params, $valueOffset + 1, $paramOffset - $valueOffset - 1); - - $valueOffset = strpos($params, '/', $paramOffset + 1); - if ($valueOffset === false) { - $this->setParam($paramKey, substr($params, $paramOffset + 1)); - break; - } - $this->setParam($paramKey, substr($params, $paramOffset + 1, $valueOffset - $paramOffset - 1)); - } - } - } - - public function init() - { - $this->_queryVars = $_GET; - $this->_postVars = $_POST; - $this->_cookieVars = $_COOKIE; - $this->_serverVars = $_SERVER; - $this->_postFiles = $_FILES; - - $this->clearData(); - - $this->addData($this->_serverVars); - $this->addData($this->_cookieVars); - $this->addData($this->_queryVars); - $this->addData($this->_postVars); - } - - public function setParam($key, $value) - { - return $this->setData($key, $value); - } - - public function getParam($key, $default = null) - { - if ($this->hasData($key)) { - return $this->getData($key); - } - if ($this->hasPost($key)) { - return $this->getPost($key); - } - if ($this->hasQuery($key)) { - return $this->getQuery($key); - } - if ($this->hasCookie($key)) { - return $this->getCookie($key); - } - - return $this->getServer($key, $default); - } - - public function getQuery($key, $default = null) - { - if (!isset($this->_queryVars[$key])) { - return $default; - } - return $this->_queryVars[$key]; - } - - public function getAllQueryData() - { - return $this->_queryVars; - } - - public function hasQuery($key) - { - return isset($this->_queryVars[$key]); - } - - public function setQuery($key, $value) - { - $this->_queryVars[$key] = (string) $value; - - return $this; - } - - public function unsetQuery($key) - { - unset($this->_queryVars[$key]); - - return $this; - } - - public function getPost($key, $default = null) - { - if (!isset($this->_postVars[$key])) { - return $default; - } - return $this->_postVars[$key]; - } - - public function getAllPostData() - { - return $this->_postVars; - } - - public function hasPost($key) - { - return isset($this->_postVars[$key]); - } - - public function setPost($key, $value) - { - $this->_postVars[$key] = (string) $value; - - return $this; - } - - public function unsetPost($key) - { - unset($this->_postVars[$key]); - - return $this; - } - - public function getCookie($key, $default = null) - { - if (!isset($this->_cookieVars[$key])) { - return $default; - } - return unserialize(stripslashes($this->_cookieVars[$key])); - } - - public function getRawCookie($key, $default = null) - { - if (!isset($this->_cookieVars[$key])) { - return $default; - } - return $this->_cookieVars[$key]; - } - - public function getAllCookieData() - { - $data = array(); - foreach ($this->_cookieVars as $key => $value) { - $data[$key] = unserialize(stripslashes($value)); - } - return $data; - } - - public function getAllRawCookieData() - { - return $this->_cookieVars; - } - - public function hasCookie($key) - { - return isset($this->_cookieVars[$key]); - } - - public function setCookie($key, $value) - { - $this->_cookieVars[$key] = addslashes(serialize((string) $value)); - - return $this; - } - - public function setRawCookie($key, $value) - { - $this->_cookieVars[$key] = (string) $value; - - return $this; - } - - public function unsetCookie($key) - { - unset($this->_cookieVars[$key]); - - return $this; - } - - public function getServer($key, $default = null) - { - if (!isset($this->_serverVars[$key])) { - return $default; - } - return $this->_serverVars[$key]; - } - - public function getAllServerData() - { - return $this->_serverVars; - } - - public function getFile($key, $default = null) - { - if (!isset($this->_postFiles[$key])) { - return $default; - } - return $this->_postFiles[$key]; - } - - public function getAllFilesData() - { - return $this->_postFiles; - } - - public function isPost() - { - if (strtoupper($this->getServer('REQUEST_METHOD')) == 'POST') { - return true; - } - return false; - } - - public function isPut() - { - if (strtoupper($this->getServer('REQUEST_METHOD')) == 'PUT') { - return true; - } - return false; - } - - public function isHead() - { - if (strtoupper($this->getServer('REQUEST_METHOD')) == 'HEAD') { - return true; - } - return false; - } - - public function isGet() - { - if (strtoupper($this->getServer('REQUEST_METHOD')) == 'GET') { - return true; - } - return false; - } - - public function getModuleKey() - { - return $this->_moduleKey; - } - - public function setModuleKey($key) - { - $this->_moduleKey = $key; - - return $this; - } - - public function getModuleName() - { - return $this->getParam($this->getModuleKey()); - } - - public function setModuleName($name) - { - if ($name === null || is_string($name)) { - return $this->setParam($this->getModuleKey(), $name); - } - } - - public function getControllerKey() - { - return $this->_controllerKey; - } - - public function setControllerKey($key) - { - $this->_controllerKey = $key; - - return $this; - } - - public function getControllerName() - { - return $this->getParam($this->getControllerKey()); - } - - public function setControllerName($name) - { - if ($name === null || is_string($name)) { - return $this->setParam($this->getControllerKey(), $name); - } - } - - public function getActionKey() - { - return $this->_actionKey; - } - - public function setActionKey($key) - { - $this->_actionKey = $key; - - return $this; - } - - public function getActionName() - { - return $this->getParam($this->getActionKey()); - } - - public function setActionName($name) - { - if ($name === null || is_string($name)) { - return $this->setParam($this->getActionKey(), $name); - } - } -} diff --git a/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Request.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Request.php deleted file mode 100644 index 3a77073..0000000 --- a/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Request.php +++ /dev/null @@ -1,35 +0,0 @@ -init(); - - parent::__construct($data); - } - - public function setParam($key, $value) - { - return $this->setData($key, $value); - } - - public function getParam($key, $default = null) - { - if ($this->hasData($key)) { - return $this->getData($key); - } - return $default; - } - - abstract public function init(); - - abstract public function getModuleName(); - abstract public function getControllerName(); - abstract public function getActionName(); - - abstract public function setModuleName($name); - abstract public function setControllerName($name); - abstract public function setActionName($name); -} diff --git a/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Response.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Response.php deleted file mode 100644 index a36048a..0000000 --- a/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Response.php +++ /dev/null @@ -1,21 +0,0 @@ -_isDispatched = $dispatched; - - return $this; - } - - public function isDispatched() - { - return $this->_isDispatched; - } - - abstract public function render($send = true); -} diff --git a/src/application/code/core/Wootook/Core/Mvc/Model/Entity.php b/src/application/code/core/Wootook/Core/Mvc/Model/Entity.php deleted file mode 100644 index 2c19005..0000000 --- a/src/application/code/core/Wootook/Core/Mvc/Model/Entity.php +++ /dev/null @@ -1,142 +0,0 @@ -_idFieldName = $fieldName; - - return $this; - } - - public function getIdFieldName() - { - return $this->_idFieldName; - } - - public function setId($id) - { - $this->setData($this->getIdFieldName(), $id); - - return $this; - } - - public function getId() - { - return $this->getData($this->getIdFieldName()); - } - - protected function _load() - { - $id = func_get_arg(0); - - if (func_num_args() >= 2) { - $idFieldName = func_get_arg(1); - } else { - $idFieldName = $this->getIdFieldName(); - } - - $database = $this->getReadConnection(); - if ($database === null) { - throw new Wootook_Core_Exception_DataAccessException('Could not load data: no read connection configured.'); - } - - $select = $database->select() - ->from(array('main_table' => $database->getTable($this->getTableName()))) - ->where($idFieldName, new Wootook_Core_Database_Sql_Placeholder_Param('id', $id)) - ->limit(1); - - $statement = $select->prepare(); - $statement->execute(array( - 'id' => $id - )); - - $datas = $statement->fetch(PDO::FETCH_ASSOC); - if (!is_array($datas) || empty($datas)) { - throw new Wootook_Core_Exception_DataAccessException('Could not load data: this id could not be found.'); - } - $realId = $datas[$this->getIdFieldName()]; - unset($datas[$this->getIdFieldName()]); - - $this->_data = array(); - $this->getDataMapper()->decode($this, $datas); - $this->setId($realId); - - return $this; - } - - protected function _save() - { - $adapter = $this->getWriteConnection(); - - if ($adapter === null) { - throw new Wootook_Core_Exception_DataAccessException('Could not save data: no write connection configured.'); - } - - if ($this->getId() !== null) { - $update = $adapter->update() - ->into($adapter->getTable($this->getTableName())) - ->where(new Wootook_Core_Database_Sql_Placeholder_Expression("{$adapter->quoteIdentifier($this->getIdFieldName())}=:id", array('id' => $this->getId()))); - - foreach ($this->getDataMapper()->encode($this, $this->getChangedDatas()) as $field => $value) { - $update->set($field, new Wootook_Core_Database_Sql_Placeholder_Param($field, $value)); - } - try { - $statement = $update->prepare(); - $statement->execute(); - } catch (Wootook_Core_Exception_Database_AdapterError $e) { - throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), null, $e); - } catch (Wootook_Core_Exception_Database_StatementError $e) { - throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), null, $e); - } - } else { - $insert = $adapter->insert() - ->into($adapter->getTable($this->getTableName())); - - foreach ($this->getDataMapper()->encode($this, $this->getAllDatas()) as $field => $value) { - $insert->set($field, new Wootook_Core_Database_Sql_Placeholder_Param($field, $value)); - } - try { - $statement = $insert->prepare(); - $statement->execute(); - - $id = $adapter->lastInsertId($adapter->getTable($this->getTableName())); - $this->setId($id); - } catch (Wootook_Core_Exception_Database_AdapterError $e) { - throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), null, $e); - } catch (Wootook_Core_Exception_Database_StatementError $e) { - throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), null, $e); - } - } - - return $this; - } - - protected function _delete() - { - $adapter = $this->getWriteConnection(); - if ($adapter === null) { - throw new Wootook_Core_Exception_DataAccessException('Could not delete data: no write connection configured.'); - } - $delete = $adapter - ->delete() - ->from($adapter->getTable($this->getTableName())) - ->where($this->getIdFieldName(), $this->getId()) - ->limit(1); - - try { - $statement = $adapter->prepare($delete); - $statement->execute(); - } catch (Wootook_Core_Exception_Database_AdapterError $e) { - throw new Wootook_Core_Exception_DataAccessException('Could not delete data: ' . $e->getMessage(), null, $e); - } catch (Wootook_Core_Exception_Database_StatementError $e) { - throw new Wootook_Core_Exception_DataAccessException('Could not delete data: ' . $e->getMessage(), null, $e); - } - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Mvc/Model/EntityInterface.php b/src/application/code/core/Wootook/Core/Mvc/Model/EntityInterface.php deleted file mode 100644 index e512a5d..0000000 --- a/src/application/code/core/Wootook/Core/Mvc/Model/EntityInterface.php +++ /dev/null @@ -1,47 +0,0 @@ - - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ - -/** - * - * Enter description here ... - * @author Greg - * - */ -interface Wootook_Core_Mvc_Model_EntityInterface -{ - public function getId(); - public function setId($id); - - public function getIdFieldName(); - public function setIdFieldName($fieldName); - - public function getTableName(); - public function setTableName($tableName); -} diff --git a/src/application/code/core/Wootook/Core/Resource/EntityCollection.php b/src/application/code/core/Wootook/Core/Resource/EntityCollection.php deleted file mode 100644 index 0f0d29b..0000000 --- a/src/application/code/core/Wootook/Core/Resource/EntityCollection.php +++ /dev/null @@ -1,268 +0,0 @@ -setReadConnection($connection); - - $this->_construct(); - } - - abstract protected function _construct(); - - protected function _init($entityTable, $entityClass) - { - $this->_entityTable = $entityTable; - $this->_entityClass = $entityClass; - } - - public function getSelect() - { - if ($this->_select === null) { - $this->_select = $this->getReadConnection() - ->select() - ->from(array('main_table' => $this->getReadConnection()->getTable($this->_entityTable))); - - $this->_prepareSelect($this->_select); - } - - return $this->_select; - } - - public function _prepareSelect(Wootook_Core_Database_Sql_Select $select) - { - } - - /** - * - * @return Wootook_Core_Database_Orm_DataMapper - */ - public function getDataMapper() - { - if ($this->_dataMapper === null) { - $this->_dataMapper = new Wootook_Core_Database_Orm_DataMapper(); - } - return $this->_dataMapper; - } - - /** - * @return Wootook_Core_Database_Adapter_Adapter - */ - public function getReadConnection() - { - return $this->_connection; - } - - public function setReadConnection($connection) - { - if ($connection instanceof Wootook_Core_Database_Adapter_Pdo_Mysql) { - $this->_connection = $connection; - } else if (is_string($connection)) { - $this->_connection = Wootook_Core_Database_ConnectionManager::getSingleton() - ->getConnection($connection); - } else { - throw new Wootook_Core_Exception_RuntimeException( - 'First parameter should be either a database connection object or a string identifier.'); - } - - return $this; - } - - final public function load() - { - $this->_beforeLoad(); - $this->_load(); - $this->_afterLoad(); - - return $this; - } - - protected function _beforeLoad() - { - Wootook::dispatchEvent('resource.collection.before-load', array('model' => $this)); - - if ($this->_eventPrefix !== null && $this->_eventObject !== null) { - Wootook::dispatchEvent($this->_eventPrefix . '.before-load', array($this->_eventObject => $this)); - } - - return $this; - } - - protected function _afterLoad() - { - Wootook::dispatchEvent('resource.collection.after-load', array('model' => $this)); - - if ($this->_eventPrefix !== null && $this->_eventObject !== null) { - Wootook::dispatchEvent($this->_eventPrefix . '.after-load', array($this->_eventObject => $this)); - } - - return $this; - } - - protected function _load() - { - $select = clone $this->getSelect(); - - if ($this->_pageSize !== null) { - if ($this->_curPage !== null) { - $select->limit($this->_pageSize, ($this->_curPage - 1) * $this->_pageSize); - } else { - $select->limit($this->_pageSize); - } - } - - $statement = $select->prepare(); - - $args = func_get_args(); - $statement->execute(array_shift($args)); - - $this->_items = array(); - if (func_num_args() > 1) { - $reflection = new ReflectionClass(array_shift($args)); - } else { - $reflection = new ReflectionClass($this->_entityClass); - } - - while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { - $item = $reflection->newInstanceArgs(); - $item->getDataMapper()->decode($item, $row); - - $this->_items[] = $item; - } - - return $this; - } - - public function getSize($maintainGrouping = array()) - { - $clone = clone $this->_select; - $clone->reset(Wootook_Core_Database_Sql_Select::COLUMNS); - if (empty($maintainGrouping)) { - $clone->reset(Wootook_Core_Database_Sql_Select::GROUP); - } else { - $groupingFields = $clone->getPart(Wootook_Core_Database_Sql_Select::GROUP); - $clone->reset(Wootook_Core_Database_Sql_Select::GROUP); - foreach ($groupingFields as $field) { - if (in_array($field, $maintainGrouping)) { - $clone->group($field); - } - } - } - $clone->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)')); - - $database = $this->getReadConnection(); - $statement = $database->prepare($clone); - - $statement->execute(); - $count = $statement->fetchColumn(); - $statement->closeCursor(); - - return $count; - } - - public function count() - { - return count($this->_items); - } - - public function current() - { - return current($this->_items); - } - - public function next() - { - next($this->_items); - - return $this; - } - - public function rewind() - { - reset($this->_items); - - return $this; - } - - public function key() - { - return key($this->_items); - } - - public function valid() - { - return current($this->_items) !== false; - } - - public function getFirstItem() - { - if (count($this->_items) > 0) { - return $this->_items[0]; - } - return null; - } - - public function getLastItem() - { - $size = count($this->_items); - if ($size > 0) { - return $this->_items[$size - 1]; - } - return null; - } - - public function addOrderBy($field, $type = 'ASC') - { - $this->getSelect()->order($field, $type); - - return $this; - } - - public function addFieldToFilter($field, $value = null) - { - $this->getSelect()->where($field, $value); - - return $this; - } - - public function setPage($curPage, $pageSize) - { - $this->setCurPage($curPage)->setPageSize($pageSize); - - return $this; - } - - public function setCurPage($curPage) - { - $this->_curPage = $curPage; - - return $this; - } - - public function setPageSize($pageSize) - { - $this->_pageSize = $pageSize; - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Core/Setup/Exception/RuntimeException.php b/src/application/code/core/Wootook/Core/Setup/Exception/RuntimeException.php deleted file mode 100644 index 29a8002..0000000 --- a/src/application/code/core/Wootook/Core/Setup/Exception/RuntimeException.php +++ /dev/null @@ -1,7 +0,0 @@ -_setupConnection = Wootook_Core_Database_ConnectionManager::getSingleton() - ->getConnection($connection); - } else { - $this->_setupConnection = $connection; - } - - return $this; - } - - /** - * - * Enter description here ... - * @return Wootook_Core_Database_Adapter_Pdo_Mysql - */ - public function getSetupConnection() - { - if ($this->_setupConnection === null) { - $this->setSetupConnection('default'); - } - return $this->_setupConnection; - } - - public function getTableName($tableName) - { - return $this->getSetupConnection()->getTable($tableName); - } - - public function query($statement) - { - try { - if (!$this->getSetupConnection()->query($statement)) { - $info = $this->getSetupConnection()->errorInfo(); - throw new Wootook_Core_Setup_Exception_RuntimeException( - Wootook::__('Query failed: SQLSTATE %s: %s.', $info[1], $info[2])); - } - } catch (PDOException $e) { - Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); - throw new Wootook_Core_Setup_Exception_RuntimeException($e->getMessage(), null, $e); - } - } - - public function grant($tableName, $connectionName, $perms = null) - { - $hostname = Wootook::getConfig("database/{$connectionName}/params/hostname"); - $username = Wootook::getConfig("database/{$connectionName}/params/username"); - $database = Wootook::getConfig("database/{$connectionName}/params/database"); - $password = Wootook::getConfig("database/{$connectionName}/params/password"); - - if ($perms === null) { - $perms = 'ALL PRIVILEGES'; - } else if (is_array($perms)) { - $perms = implode(' ', $perms); - } - - $sql =<<getTable($tableName)} -TO '{$username}@{$hostname}' IDENTIFIED BY '$password' -SQL_EOF; - - $this->getSetupConnection()->query($sql); - - return $this; - } - - public function revoke($tableName, $connectionName, $perms = null) - { - $hostname = Wootook::getConfig("database/{$connectionName}/params/hostname"); - $username = Wootook::getConfig("database/{$connectionName}/params/username"); - $database = Wootook::getConfig("database/{$connectionName}/params/database"); - $password = Wootook::getConfig("database/{$connectionName}/params/password"); - - if ($perms === null) { - $perms = 'ALL PRIVILEGES'; - } else if (is_array($perms)) { - $perms = implode(' ', $perms); - } - - $sql =<<getTable($tableName)} -FROM '{$username}@{$hostname}' -SQL_EOF; - - $this->getSetupConnection()->query($sql); - - return $this; - } - - public function run($script) - { - include $script; - } - - public function getConfig($path = null) - { - return Wootook::getConfig($path); - } - - public function getWebsiteConfig($path = null, $websiteId = null) - { - return Wootook::getWebsiteConfig($path, $websiteId); - } - - public function getGameConfig($path = null, $gameId = null) - { - return Wootook::getGameConfig($path, $gameId); - } -} diff --git a/src/application/code/core/Wootook/Core/Singleton.php b/src/application/code/core/Wootook/Core/Singleton.php deleted file mode 100644 index c136e82..0000000 --- a/src/application/code/core/Wootook/Core/Singleton.php +++ /dev/null @@ -1,40 +0,0 @@ - - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ - -/** - * - * Enter description here ... - * @author Greg - * - */ -interface Wootook_Core_Singleton -{ - public static function getSingleton(); -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/configs/module.php b/src/application/code/core/Wootook/Core/configs/module.php deleted file mode 100644 index 9b01f6a..0000000 --- a/src/application/code/core/Wootook/Core/configs/module.php +++ /dev/null @@ -1,33 +0,0 @@ - array( - 'Wootook_Core' => array( - 'version' => '1.5.0' - ) - ), - 'global' => array( - 'models' => array( - 'core' => array( - 'namespace' => 'Warner_Core_Model_', - 'connection' => array( - 'read' => 'core_read', - 'write' => 'core_write', - 'setup' => 'core_setup', - ) - ) - ), - 'blocks' => array( - 'core' => array( - 'namespace' => 'Warner_Core_Block_' - ) - ) - ), - 'frontend' => array( - 'routes' => array( - 'core' => array( - 'modules' => array( - 'core' => 'Wootook_Core' - ) - ) - ) - ) - ); \ No newline at end of file diff --git a/src/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php b/src/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php deleted file mode 100644 index 44fd985..0000000 --- a/src/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php +++ /dev/null @@ -1,208 +0,0 @@ - - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ - -$this->setSetupConnection('core_setup'); - -$sql = <<getTableName('core_website')} ( - `website_id` TINYINT UNSIGNED NOT NULL, - `code` VARCHAR(64) NOT NULL, - `name` VARCHAR(255) NOT NULL, - `sort_order` TINYINT UNSIGNED NOT NULL, - `default_group_id` TINYINT UNSIGNED NOT NULL, - `is_default` BOOL NOT NULL, - `is_staging` BOOL NOT NULL, - `is_active` BOOL NOT NULL, - PRIMARY KEY (`website_id`), - UNIQUE (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_game_group')} ( - `group_id` TINYINT UNSIGNED NOT NULL, - `website_id` TINYINT UNSIGNED NOT NULL, - `code` VARCHAR(64) NOT NULL, - `name` VARCHAR(255) NOT NULL, - `sort_order` TINYINT UNSIGNED NOT NULL, - `is_default` BOOL NOT NULL, - PRIMARY KEY (`group_id`), - INDEX (`website_id`), - UNIQUE (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_game')} ( - `game_id` SMALLINT UNSIGNED NOT NULL, - `group_id` TINYINT UNSIGNED NOT NULL, - `website_id` TINYINT UNSIGNED NOT NULL, - `code` VARCHAR(64) NOT NULL, - `name` VARCHAR(255) NOT NULL, - `sort_order` TINYINT UNSIGNED NOT NULL, - `is_default` BOOL NOT NULL, - `is_staging` BOOL NOT NULL, - `is_active` BOOL NOT NULL, - PRIMARY KEY (`group_id`), - INDEX (`website_id`), - UNIQUE (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_website')} (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`, `is_staging`, `is_active`) -VALUES -(0, "admin", "Administration", 0, 0, 0, 0, 1), -(1, "default", "Default Website", 1, 1, 1, 0, 1); -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_game_group')} (`group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`) -VALUES -(0, 0, "admin", "Administration", 0, 0), -(1, 1, "default", "Default Group", 1, 1); -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_game')} (`game_id`, `group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`, `is_staging`, `is_active`) -VALUES -(0, 0, 0, "admin", "Administration", 0, 0, 0, 1), -(1, 1, 1, "default", "Default Game", 1, 1, 0, 1); -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_config')} ( - `website_id` TINYINT UNSIGNED NOT NULL, - `game_id` TINYINT UNSIGNED NOT NULL, - `config_path` VARCHAR(64) NOT NULL, - `config_value` VARCHAR(255) NOT NULL, - PRIMARY KEY (`website_id`, `game_id`, `config_path`), - INDEX (`website_id`), - INDEX (`game_id`), - INDEX (`config_path`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_config')} (`website_id`, `game_id`, `config_path`, `config_value`) VALUES - (1, 1, 'resources/base-income/metal', '20'), - (1, 1, 'resources/base-income/cristal', '10'), - (1, 1, 'resources/base-income/deuterium', '0'), - (1, 1, 'resources/base-income/energy', '0'), - - (1, 1, 'planet/initial/fields', '163'), - - (1, 1, 'resources/initial/metal', '500'), - (1, 1, 'resources/initial/cristal', '500'), - (1, 1, 'resources/initial/deuterium', '0'), - (1, 1, 'resources/initial/energy', '0'), - - (1, 1, 'game/general/name', 'Wootook'), - (1, 1, 'game/general/boards-url', 'http://wootook.org/board/'), - (1, 1, 'game/general/extra-url-title', 'Wootook!'), - (1, 1, 'game/general/extra-url', 'http://wootook.org/'), - (1, 1, 'game/general/active', '1'), - (1, 1, 'game/general/closing-message', 'Le jeu est clos pour le moment.'), - (1, 1, 'game/general/locale', 'fr_FR'), - - (1, 1, 'game/resource/multiplier', '1000'), - (1, 1, 'game/speed/general', '2500'), - (1, 1, 'game/speed/fleet', '2500'), - - (1, 1, 'game/debris/metal-percent', '30'), - (1, 1, 'game/debris/cristal-percent', '30'), - (1, 1, 'game/debris/deuterium-percent', '0'), - (1, 1, 'game/debris/energy-percent', '0'), - - (1, 1, 'game/debris/fleet', '1'), - (1, 1, 'game/debris/defense', '0'), - - (1, 1, 'game/noob-protection/active', '0'), - (1, 1, 'game/noob-protection/points-cap', '5000'), - (1, 1, 'game/noob-protection/multiplier', '5'), - --- (0, 0, 'web/cookie/name', '__wtk'), --- (0, 0, 'web/cookie/time', '2592000'), --- (0, 0, 'web/cookie/domain', ''), --- (0, 0, 'web/cookie/path', ''), - - (1, 1, 'web/cookie/name', '__wtk_1_1'), - --- (0, 0, 'web/session/time', '900'), --- (0, 0, 'web/session/domain', '.wootook.org'), --- (0, 0, 'web/session/path', '/'), - - (0, 0, 'engine/options/bbcode', '1'), - (0, 0, 'engine/options/ga', '1'), - (0, 0, 'engine/options/announces', '0'), - (0, 0, 'engine/options/retailer', '0'), - (0, 0, 'engine/options/notes', '0'), - (0, 0, 'engine/options/chat', '0'), - (0, 0, 'engine/options/banner', '0'), - (0, 0, 'engine/options/vacation-min-time', '172800'), - - (0, 0, 'game/news/active', '0'), - (0, 0, 'game/news/content', 'Bienvenue sur le nouveau serveur de jeu Wootook!'), - - (0, 0, 'engine/ban/duration', '86400'), - - (0, 0, 'engine/bot/active', '0'), - (0, 0, 'engine/bot/name', 'Woot'), - (0, 0, 'engine/bot/email', 'contact@wootook.org'); -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('errors')} ( - `error_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, - `error_sender` VARCHAR(32) NOT NULL, - `error_time` TIMESTAMP NOT NULL, - `error_type` VARCHAR(32) NOT NULL DEFAULT 'unknown', - `error_text` TEXT, - PRIMARY KEY (`error_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -SQL_EOF; - -$this->query($sql); diff --git a/src/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php b/src/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php deleted file mode 100644 index 2b0aad2..0000000 --- a/src/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php +++ /dev/null @@ -1,73 +0,0 @@ - - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * - Neither the name of Grégory PLANCHAT nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * --> 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 One.Platform. - * - */ - -$this->setSetupConnection('core_setup'); - -$sql = <<getTableName('core_website')}; -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_game_group')}; -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_game')}; -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('core_config')}; -SQL_EOF; - -$this->query($sql); - -$sql = <<getTableName('errors')}; -SQL_EOF; - -$this->query($sql); diff --git a/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List.php b/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List.php deleted file mode 100644 index 770fcbb..0000000 --- a/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List.php +++ /dev/null @@ -1,77 +0,0 @@ -_fleetCollection === null) { - $player = Wootook_Player_Model_Session::getSingleton()->getPlayer(); - $this->_fleetCollection = $player->getVisibleFleets(); - } - return $this->_fleetCollection; - } - - public function setItemTemplate($template) - { - $this->_itemTemplate = $template; - - return $this; - } - - public function getItemTemplate() - { - return $this->_itemTemplate; - } - - public function setItemBlockType($blockType) - { - $this->_itemBlockType = $blockType; - - return $this; - } - - public function getItemBlockType() - { - return $this->_itemBlockType; - } - - public function getItemBlock($fleet) - { - $blockName = $this->getNameInLayout() . ".item({$fleet->getId()})"; - - return $this->getLayout() - ->createBlock($this->getItemBlockType(), $blockName) - ->setTemplate($this->getItemTemplate()) - ->setFleetItem($fleet); - } - - public function prepareLayout() - { - parent::prepareLayout(); - - $this->_initChildBlocks(); - - return $this; - } - - public function _initChildBlocks() - { - $parentBlock = $this->getLayout() - ->createBlock('core/concat', $this->getNameInLayout() . '.item-list') - ; - $this->setPartial('item-list', $parentBlock); - - foreach ($this->getFleetCollection()->load() as $fleet) { - $block = $this->getItemBlock($fleet); - $parentBlock->setPartial($block->getNameInLayout(), $block); - } - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List/Item.php b/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List/Item.php deleted file mode 100644 index cd1cffc..0000000 --- a/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List/Item.php +++ /dev/null @@ -1,153 +0,0 @@ -_currentPlayer == null) { - $this->_currentPlayer = Wootook_Player_Model_Session::getSingleton()->getPlayer(); - } - return $this->_currentPlayer; - } - - /** - * @return Wootook_Player_Resource_Entity_Collection - */ - public function getFleetOwnerCollection() - { - if ($this->_ownerCollection == null) { - $this->_ownerCollection = $this->getFleetItem()->getOwnerCollection(); - } - return $this->_ownerCollection; - } - - /** - * @return Wootook_Player_Resource_Entity_Collection - */ - public function getFleetOwnerUsernames() - { - $usernameList = array(); - foreach ($this->getFleetOwnerCollection()->load() as $owner) { - $usernameList[] = $owner->getUsername(); - } - return $usernameList; - } - - public function setFleetItem(Wootook_Empire_Model_Fleet $fleetItem) - { - $this->_fleet = $fleetItem; - - return $this; - } - - /** - * @return Wootook_Empire_Model_Fleet - */ - public function getFleetItem() - { - return $this->_fleet; - } - - public function getStartTime() - { - return $this->getFleetItem()->getStartTime(); - } - - public function getActionTime() - { - return $this->getFleetItem()->getActionTime(); - } - - public function getArrivalTime() - { - return $this->getFleetItem()->getArrivalTime(); - } - - public function isOwner() - { - return $this->getFleetItem()->isOwnedBy($this->getPlayer()); - } - - public function getRowClass() - { - return $this->getFleetItem()->getRowClass($this->getPlayer()); - } - - public function getOriginPlanet() - { - return $this->getFleetItem()->getOriginPlanet(); - } - - public function getOriginPlayer() - { - return $this->getOriginPlanet()->getPlayer(); - } - - public function getOriginPlayerName() - { - $player = $this->getOriginPlanet()->getPlayer(); - - if ($player !== null) { - return $player->getUsername(); - } - return null; - } - - public function getOriginPlanetName() - { - return $this->getOriginPlanetName(); - } - - public function getOriginPlanetCoords() - { - return $this->getOriginPlanetCoords(); - } - - public function getDestinationPlanet() - { - return $this->getFleetItem()->getDestinationPlanet(); - } - - public function getDestinationPlayer() - { - return $this->getDestinationPlanet()->getPlayer(); - } - - public function getDestinationPlayerName() - { - $player = $this->getDestinationPlanet()->getPlayer(); - - if ($player !== null) { - return $player->getUsername(); - } - return null; - } - - public function getDestinationPlanetName() - { - return $this->getDestinationPlanetName(); - } - - public function getDestinationPlanetCoords() - { - return $this->getDestinationPlanetCoords(); - } - - public function getMissionLabel() - { - return $this->getFleetItem()->getMissionLabel(); - } - - public function isMission($type) - { - return $this->getFleetItem()->isMission($type); - } -} diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Overview.php b/src/application/code/core/Wootook/Empire/Block/Planet/Overview.php deleted file mode 100644 index f24f5dc..0000000 --- a/src/application/code/core/Wootook/Empire/Block/Planet/Overview.php +++ /dev/null @@ -1,40 +0,0 @@ -getPlayer(); - } - - /** - * - * @return Wootook_Empire_Model_Planet - */ - public function getPlanet() - { - if ($this->_planet === null) { - $this->_planet = $this->getPlayer()->getCurrentPlanet(); - } - return $this->_planet; - } - - public function getPlanetName() - { - return $this->getPlanet()->getName(); - } - - public function getPlanetCoords() - { - return $this->getPlanet()->getCoords(); - } - - public function getPlanetImage() - { - return $this->getPlanet()->getImage(); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Block/Topnav.php b/src/application/code/core/Wootook/Empire/Block/Topnav.php deleted file mode 100644 index 72a6d5b..0000000 --- a/src/application/code/core/Wootook/Empire/Block/Topnav.php +++ /dev/null @@ -1,34 +0,0 @@ -getPlayer(); - } - - /** - * - * @return Wootook_Empire_Model_Planet - */ - public function getCurrentPlanet() - { - return $this->getCurrentPlayer()->getCurrentPlanet(); - } - - /** - * - * @return Wootook_Empire_Resource_Planet_Collection - */ - public function getPlanetCollection() - { - return $this->getCurrentPlayer() - ->getPlanetCollection(array(Wootook_Empire_Model_Planet::TYPE_PLANET)) - ->load(); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Controller/BuildingsController.php b/src/application/code/core/Wootook/Empire/Controller/BuildingsController.php deleted file mode 100644 index 6a5234b..0000000 --- a/src/application/code/core/Wootook/Empire/Controller/BuildingsController.php +++ /dev/null @@ -1,43 +0,0 @@ -loadLayout('planet.buildings'); - $this->renderLayout(); - } - - public function buildAction() - { - if (!is_numeric($buildingId = $this->getRequest()->getParam('id'))) { - $this->_redirect('*/*/view'); - return; - } - - $this->getCurrentPlanet()->appendBuildingQueue($buildingId); - $this->getCurrentPlanet()->save(); - - $this->_redirect('*/*/'); - } - - public function cancelAction() - { - if (!is_numeric($buildingId = $this->getRequest()->getParam('id'))) { - $this->_redirect('*/*/view'); - return; - } - - $this->getCurrentPlanet()->dequeueBuilding($buildingId); - $this->getCurrentPlanet()->save(); - - $this->_redirect('*/*/'); - } -} diff --git a/src/application/code/core/Wootook/Empire/Exception.php b/src/application/code/core/Wootook/Empire/Exception.php deleted file mode 100644 index e2bd909..0000000 --- a/src/application/code/core/Wootook/Empire/Exception.php +++ /dev/null @@ -1,3 +0,0 @@ -= 50300) { - parent::__construct($message, $code, $previous); - } else { - parent::__construct($message, $code); - $this->_previous = $previous; - } - } - - public function __call($method, $params) - { - if (strtolower($method) == 'getprevious') { - return $this->_previous; - } - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Exception/Planet.php b/src/application/code/core/Wootook/Empire/Exception/Planet.php deleted file mode 100644 index 36c2cf2..0000000 --- a/src/application/code/core/Wootook/Empire/Exception/Planet.php +++ /dev/null @@ -1,7 +0,0 @@ -= 50300) { - parent::__construct($message, $code, $previous); - } else { - parent::__construct($message, $code); - $this->_previous = $previous; - } - } - - public function __call($method, $params) - { - if (strtolower($method) == 'getprevious') { - return $this->_previous; - } - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php b/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php deleted file mode 100644 index 94297a2..0000000 --- a/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php +++ /dev/null @@ -1,51 +0,0 @@ -_initData("locale/{$locale}/labels"); - return $this; - } - - protected function _load() - { - // NOP - return $this; - } - - protected function _save() - { - // NOP - return $this; - } - - protected function _delete() - { - // NOP - return $this; - } -} diff --git a/src/application/code/core/Wootook/Empire/Model/Galaxy/Position.php b/src/application/code/core/Wootook/Empire/Model/Galaxy/Position.php deleted file mode 100644 index 2ce4b24..0000000 --- a/src/application/code/core/Wootook/Empire/Model/Galaxy/Position.php +++ /dev/null @@ -1,11 +0,0 @@ -_tableName = 'galaxy'; - $this->_idFieldNames = array('id_planet'); - } -} diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/PluginLoader.php b/src/application/code/core/Wootook/Empire/Model/Planet/PluginLoader.php deleted file mode 100644 index d3cc37b..0000000 --- a/src/application/code/core/Wootook/Empire/Model/Planet/PluginLoader.php +++ /dev/null @@ -1,31 +0,0 @@ -_currentPlayer = $currentPlayer; - $this->_currentPlanet = $currentPlanet; - - $this->registerNamespace('Legacies_Empire_Model_Planet_Building_'); - } - - protected function _load($className, $useSingleton, Array $constructorParams = array()) - { - $reflection = new ReflectionClass($className); - if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) { - $method = $reflection->getMethod('getSingleton'); - $method->invoke(); - } - - try { - return $reflection->newInstance($this->_currentPlanet, $this->_currentPlayer); - } catch (ReflectionException $e) { - return null; - } - } -} diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/QueueInterface.php b/src/application/code/core/Wootook/Empire/Model/Planet/QueueInterface.php deleted file mode 100644 index 7bd2c42..0000000 --- a/src/application/code/core/Wootook/Empire/Model/Planet/QueueInterface.php +++ /dev/null @@ -1,9 +0,0 @@ -getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE)); - } - - public function getActualSpeed(Wootook_Player_Model_Entity $player) - { - return $this->getBaseSpeed($player) * $this->getSpeedMultiplier($player); - } - - public function getActualConsumption(Wootook_Player_Model_Entity $player, $speed) - { - return $this->getBaseConsumption($player) * ($speed / 100) * $this->getSpeedMultiplier($player); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php b/src/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php deleted file mode 100644 index dc9863a..0000000 --- a/src/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php +++ /dev/null @@ -1,11 +0,0 @@ -_init('fleets', 'Wootook_Empire_Model_Fleet'); - } - - public function addPlanetToFilter(Wootook_Empire_Model_Planet $planet, $time = null) - { - if ($time === null) { - $time = new Wootook_Core_DateTime(); - } - $this->addFieldToFilter(null, array( - array('and' => array( - array('eq' => array('field' => 'fleet_start_galaxy', 'value' => $planet->getGalaxy())), - array('eq' => array('field' => 'fleet_start_system', 'value' => $planet->getSystem())), - array('eq' => array('field' => 'fleet_start_planet', 'value' => $planet->getPosition())), - array('eq' => array('field' => 'fleet_start_type', 'value' => $planet->getType())), - //array('date' => array('field' => 'fleet_start_time', 'value' => array('to' => $time))), - )), - array('and' => array( - array('eq' => array('field' => 'fleet_end_galaxy', 'value' => $planet->getGalaxy())), - array('eq' => array('field' => 'fleet_end_system', 'value' => $planet->getSystem())), - array('eq' => array('field' => 'fleet_end_planet', 'value' => $planet->getPosition())), - array('eq' => array('field' => 'fleet_end_type', 'value' => $planet->getType())), - //array('date' => array('field' => 'fleet_end_time', 'value' => array('to' => $time))), - )) - )); - - return $this; - } - - public function addIsVisibleToFilter(Wootook_Player_Model_Entity $player, $time = null) - { - if ($time === null) { - $time = new Wootook_Core_DateTime(); - } - $this->addFieldToFilter(null, array( - array('and' => array( - array('eq' => array('field' => 'fleet_owner', 'value' => $player->getId())), - array('date' => array('field' => 'fleet_start_time', 'value' => array('to' => $time))), - )), - array('and' => array( - array('eq' => array('field' => 'fleet_owner', 'value' => $player->getId())), - array('date' => array('field' => 'fleet_end_time', 'value' => array('to' => $time))), - )) - )); - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Empire/Resource/Planet/Collection.php b/src/application/code/core/Wootook/Empire/Resource/Planet/Collection.php deleted file mode 100644 index fc3e8ee..0000000 --- a/src/application/code/core/Wootook/Empire/Resource/Planet/Collection.php +++ /dev/null @@ -1,64 +0,0 @@ -_init('planets', 'Wootook_Empire_Model_Planet'); - } - - public function addPlayerToFilter(Wootook_Player_Model_Entity $player) - { - $this->addFieldToFilter('id_owner', $player->getId()); - - return $this; - } - - public function addGalaxyToFilter($galaxy) - { - $this->addFieldToFilter('galaxy', $galaxy); - - return $this; - } - - public function addSystemToFilter($system) - { - $this->addFieldToFilter('system', $system); - - return $this; - } - - public function addPositionToFilter($position) - { - $this->addFieldToFilter('planet', $position); - - return $this; - } - - public function addTypeToFilter($type) - { - $this->addFieldToFilter('planet_type', $type); - - return $this; - } - - public function addCoordsToFilter($galaxy, $system = null, $position = null, $type = null) - { - $this->addGalaxyToFilter($galaxy); - - if ($system !== null) { - $this->addSystemToFilter($system); - - if ($position !== null) { - $this->addPositionToFilter($position); - - if ($type !== null) { - $this->addTypeToFilter($type); - } - } - } - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Player/Block/TopBar.php b/src/application/code/core/Wootook/Player/Block/TopBar.php deleted file mode 100644 index 9b7adaf..0000000 --- a/src/application/code/core/Wootook/Player/Block/TopBar.php +++ /dev/null @@ -1,37 +0,0 @@ -getSession()->isLoggedIn(); - } - - public function getPlayer() - { - return $this->getSession()->getPlayer(); - } - - public function getPlayerCount() - { - $collection = new Wootook_Player_Resource_Entity_Collection($this->getPlayer()->getReadConnection()); - $collection->addAuthlevelToFilter(array(LEVEL_ADMIN), true); - - return $collection->getSize(); - } - - public function getOnlinePlayerCount() - { - $collection = new Wootook_Player_Resource_Entity_Collection($this->getPlayer()->getReadConnection()); - $collection->addAuthlevelToFilter(array(LEVEL_ADMIN), true); - $collection->addIsOnlineToFilter(); - - return $collection->getSize(); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Player/Controller/AccountController.php b/src/application/code/core/Wootook/Player/Controller/AccountController.php deleted file mode 100644 index 824a20d..0000000 --- a/src/application/code/core/Wootook/Player/Controller/AccountController.php +++ /dev/null @@ -1,235 +0,0 @@ - - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero 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 Wootook. - * - */ - -/** - * - * Enter description here ... - * @author Greg - * - */ -class Wootook_Player_Controller_AccountController - extends Wootook_Core_Mvc_Controller_Action -{ - public function loginAction() - { - $session = new Wootook_Player_Model_Session(); - if ($session->isLoggedIn()) { - $this->_redirect('*/overview'); - return; - } - - $this->loadLayout('player.login'); - $this->_prepareLayoutMessages(Wootook_Player_Model_Entity::SESSION_KEY); - $this->renderLayout(); - } - - public function loginPostAction() - { - $request = $this->getRequest(); - - if (!$request->isPost()) { - $this->_redirect('*/*/login'); - return; - } - - if ($request->getPost('username') === null || $request->getPost('password') === null) { - $this->_redirect('*/*/login'); - return; - } - - $session = new Wootook_Player_Model_Session(); - if ($session->isLoggedIn()) { - $this->_redirect('*/overview'); - return; - } - - $session->login($request->getPost('username'), $request->getPost('password'), (bool) $request->getPost('rememberme')); - - if ($session->isLoggedIn()) { - $this->_redirect('*/overview'); - return; - } else { - $this->_redirect('*/*/login'); - return; - } - } - - public function logoutAction() - { - $session = Wootook_Player_Model_Session::getSingleton(); - if ($session->isLoggedIn()) { - $session->logout(); - } else { - $this->_redirect('*/*/login'); - return; - } - - $this->_redirect(''); - } - - public function newAction() - { - $session = new Wootook_Player_Model_Session(); - if ($session->isLoggedIn()) { - $this->_redirect('*/overview'); - return; - } - - $this->loadLayout('player.registration'); - $this->_prepareLayoutMessages(Wootook_Player_Model_Entity::SESSION_KEY); - $this->renderLayout(); - } - - public function newPostAction() - { - $session = Wootook_Player_Model_Session::getSingleton(); - if ($session->isLoggedIn()) { - $this->_redirect('*/overview'); - return; - } - - $request = $this->getRequest(); - - if ($request->getPost('password') != $request->getPost('password_confirm')) { - $session->addError(Wootook::__('Passwords does not match. Please check your input.')); - $this->_redirect('*/*/new'); - return; - } - - if ($request->getPost('email') != $request->getPost('email_confirm')) { - $session->addError(Wootook::__('Both emails does not match. Please check your input.')); - $this->_redirect('*/*/new'); - return; - } - - try { - $user = Wootook_Player_Model_Entity::register($request->getPost('username'), $request->getPost('email'), $request->getPost('password')); - } catch (Wootook_Empire_Exception_RuntimeException $e) { - $session->addError(Wootook::__('Could not create user: %s', $e->getMessage())); - $this->_redirect('*/*/new'); - return; - } - - if (!$user || !$user->getId()) { - $session->addError(Wootook::__('Could not create user. Please contact the game administrator for more information.')); - $this->_redirect('*/*/new'); - return; - } - - $session->setLoggedIn($user); - if ($request->getPost('planet_name') != '') { - $user->getHomePlanet()->setName($request->getPost('planet_name'))->save(); - } else { - $user->getHomePlanet()->setName(Wootook::__('Planet'))->save(); - } - - $this->_redirect('*/overview'); - } - - public function lostPasswordAction() - { - $session = new Wootook_Player_Model_Session(); - if ($session->isLoggedIn()) { - $this->_redirect('*/overview'); - return; - } - - $this->loadLayout('player.lost-password'); - $this->_prepareLayoutMessages(Wootook_Player_Model_Entity::SESSION_KEY); - $this->renderLayout(); - } - - /** - * Send new password by mail - */ - public function lostPasswordPostAction() - { - $session = new Wootook_Player_Model_Session(); - if ($session->isLoggedIn()) { - $this->_redirect('*/overview'); - return; - } - - if (!$this->getRequest()->isPost()) { - $this->_redirect('*/*/lost-password'); - return; - } - - $email = $this->getRequest()->getPost('email'); - $username = $this->getRequest()->getPost('username'); - - $player = new Wootook_Player_Model_Entity(); - $player->loadByEmail($email); - - if (!$player->getId() || strtolower($player->getUsername()) != strtolower(trim($username))) { - $session->addError(Wootook::__('The information you entered could not be found.')); - $this->_redirect('*/*/lost-password'); - return; - } - - $chars = array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', - 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', - 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', - 'w', 'x', 'y', 'z', '2', '3', '4', '5', '6', '7', '8', '9' - ); - - shuffle($chars); - $passwordChars = array_slice($chars, 0, 10); - $newPassword = implode($passwordChars); - - $player->setPassword($newPassword)->save(); - - try { - $mailer = new Wootook_Core_Email(); - $mailer->send( - array($player->getEmail() => $player->getUsername()), - array('contact@wootook.org' => 'Wootook'), - Wootook::__('Your new password'), - Wootook::__('Your new password is %s', $newPassword)); - } catch (Wootook_Core_Exception_RuntimeException $e) { - Wootook_Player_Model_Session::getSingleton() - ->addError($e->getMessage()); - - $this->_redirect('*/*/lost-password'); - return; - } - - $this->_redirect('*/*/login'); - } - - public function editAction() - { - } - - public function optionsAction() - { - } -} diff --git a/src/application/code/core/Wootook/Player/Controller/OverviewController.php b/src/application/code/core/Wootook/Player/Controller/OverviewController.php deleted file mode 100644 index 97db0cf..0000000 --- a/src/application/code/core/Wootook/Player/Controller/OverviewController.php +++ /dev/null @@ -1,12 +0,0 @@ -loadLayout('player.overview'); - $this->_prepareLayoutMessages(Wootook_Player_Model_Entity::SESSION_KEY); - $this->renderLayout(); - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Player/Exception.php b/src/application/code/core/Wootook/Player/Exception.php deleted file mode 100644 index 6a51351..0000000 --- a/src/application/code/core/Wootook/Player/Exception.php +++ /dev/null @@ -1,3 +0,0 @@ -= 50300) { - parent::__construct($message, $code, $previous); - } else { - parent::__construct($message, $code); - $this->_previous = $previous; - } - } - - public function __call($method, $params) - { - if (strtolower($method) == 'getprevious') { - return $this->_previous; - } - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Player/Exception/RuntimeException.php b/src/application/code/core/Wootook/Player/Exception/RuntimeException.php deleted file mode 100644 index e270f3f..0000000 --- a/src/application/code/core/Wootook/Player/Exception/RuntimeException.php +++ /dev/null @@ -1,25 +0,0 @@ -= 50300) { - parent::__construct($message, $code, $previous); - } else { - parent::__construct($message, $code); - $this->_previous = $previous; - } - } - - public function __call($method, $params) - { - if (strtolower($method) == 'getprevious') { - return $this->_previous; - } - } -} \ No newline at end of file diff --git a/src/application/code/core/Wootook/Player/Exception/Session.php b/src/application/code/core/Wootook/Player/Exception/Session.php deleted file mode 100644 index b546e5d..0000000 --- a/src/application/code/core/Wootook/Player/Exception/Session.php +++ /dev/null @@ -1,7 +0,0 @@ -getData('username'); - } - - public function getEmail() - { - return $this->getData('email'); - } - - public function loadByEmail($email) - { - return $this->load($email, 'email'); - } - - public function setPassword($newPassword) - { - return $this->setData('password', $this->hash($newPassword)); - } - - public static function hash($password, $salt = null) - { - if ($salt === null) { - return call_user_func(self::$hashCallback, ($password)); - } - - return call_user_func(self::$hashCallback, ($password . $salt)); - } - - protected function _init() - { - $this->setIdFieldName('id'); - $this->setTableName('users'); - - $this->getDataMapper() - ->addRule('onlinetime', 'date-time') - ->addRule('urlaubs_until', 'date-time') - ->addRule('register_time', 'date-time') - ; - } - - public function updateActivity() - { - $this - ->setData('current_page', $_SERVER['REQUEST_URI']) - ->setData('user_lastip', $_SERVER['REMOTE_ADDR']) - ->setData('user_agent', $_SERVER['HTTP_USER_AGENT']) - ->setData('onlinetime', new Wootook_Core_DateTime()) - ->save() - ; - return $this; - } - - public static function register($username, $email, $password) - { - try { - $request = Wootook::getRequest(); - $player = new self(array( - 'username' => $username, - 'password' => md5($password), - 'email' => $email, - 'email_2' => $email, - - 'register_time' => new Wootook_Core_DateTime(), - 'onlinetime' => new Wootook_Core_DateTime(), - 'ip_at_reg' => $request->getServer('REMOTE_ADDR'), - 'user_lastip' => $request->getServer('REMOTE_ADDR'), - 'user_agent' => $request->getServer('HTTP_USER_AGENT') - )); - - //$player->getWriteConnection()->beginTransaction(); - - $player->save(); - - $select = Wootook_Empire_Model_Planet::searchMostFreeSystems(); - $select->limit(1); - - try { - $statement = $select->prepare(); - if (!$statement->execute()) { - throw new Wootook_Empire_Exception_RuntimeException('No more planet to colonize!'); // Oops, no more free place - } - } catch (Wootook_Core_Exception_Database_Error $e) { - Wootook_Core_ErrorProfiler::getSingleton()->addException($e); - //$this->getWriteConnection()->rollback(); - return null; - } - - $systemInfo = $statement->fetch(); - if ($systemInfo['count'] >= Wootook::getGameConfig('engine/universe/positions')) { - throw new Wootook_Empire_Exception_RuntimeException('No more planet to colonize!'); // Oops, no more free place - } - - $collection = new Wootook_Empire_Resource_Planet_Collection($player->getReadConnection()); - $collection->addTypeToFilter(Wootook_Empire_Model_Planet::TYPE_PLANET) - ->addFieldToFilter('galaxy', $systemInfo['galaxy']) - ->addFieldToFilter('system', $systemInfo['system']) - ; - - $positions = range(1, Wootook::getGameConfig('engine/universe/positions')); - foreach ($collection as $planet) { - $key = array_search($planet->getData('position'), $positions); - if ($key !== false) { - unset($positions[$key]); - } - } - $key = array_rand($positions, 1); - $finalPosition = $positions[$key]; - - $planet = $player->createNewPlanet( - $systemInfo['galaxy'], - $systemInfo['system'], - $finalPosition, - Wootook_Empire_Model_Planet::TYPE_PLANET, - Wootook::__('Planet'), - Wootook::getGameConfig('resource/initial/fields') - ); - - $player - ->setData('id_planet', $planet->getId()) - ->setData('current_planet', $planet->getId()) - ->setData('galaxy', $planet->getGalaxy()) - ->setData('system', $planet->getSystem()) - ->setData('planet', $planet->getPosition()) - ; - - Wootook::dispatchEvent('player.init', array( - 'player' => $player - )); - - $player->save(); - } catch (Wootook_Core_Exception_DataAccessException $e) { - //$player->getWriteConnection()->rollback(); - $session = Wootook_Core_Model_Session::factory(Wootook_Player_Model_Entity::SESSION_KEY); - - Wootook_Core_ErrorProfiler::getSingleton()->addException($e); - $session->addError($e->getMessage()); - return null; - } catch (Wootook_Empire_Exception_RuntimeException $e) { - //$player->getWriteConnection()->rollback(); - $session = Wootook_Core_Model_Session::factory(Wootook_Player_Model_Entity::SESSION_KEY); - - Wootook_Core_ErrorProfiler::getSingleton()->addException($e); - $session->addError($e->getMessage()); - return null; - } - //$player->getWriteConnection()->commit(); - - return $player; - } - - public function createNewPlanet($galaxy, $system, $position, $type, $name, $size = null) - { - if ($size === null) { - $size = Wootook::getGameConfig('planet/initial/fields'); - } - if ($size === null) { - $size = 200; - } - - $now = new Wootook_Core_DateTime(); - $planet = new Wootook_Empire_Model_Planet(array(), $this); - $planet - ->setData('name', $name) - ->setData('galaxy', $galaxy) - ->setData('system', $system) - ->setData('planet', $position) - ->setData('planet_type', $type) - ->setData('field_max', $size) - ->setData('diameter', pow($size, 2) + mt_rand(0, $size * $position)) - ->setData('field_current', 0) - ->setData('last_update', $now) - ->setData('b_tech', $now) - ->setData('b_hangar', $now) - ->setData('b_building', $now) - ; - - $resourceList = Wootook_Empire_Helper_Config_Resources::getSingleton(); - $resourceConfig = Wootook::getGameConfig('resources/initial'); - foreach ($resourceList as $resource => $resourceData) { - if ($resourceData['field'] === null || !isset($resourceConfig[$resource])) { - continue; - } - $planet->setData($resourceData['field'], $resourceConfig[$resource]); - } - - $resourceConfig = Wootook::getGameConfig('resources/base-income'); - foreach ($resourceList as $resource => $resourceData) { - if ($resourceData['production_field'] === null || !isset($resourceConfig[$resource])) { - continue; - } - $planet->setData($resourceData['production_field'], $resourceConfig[$resource]); - } - - $planet->updateStorages($now); - $planet->updateBuildingQueue($now); - $planet->updateResourceProduction($now); - $planet->updateResources($now); - - $planet->save(); - - if ($planet->isPlanet()) { - $galaxy = new Wootook_Empire_Model_Galaxy_Position(); - $galaxy - ->setData('galaxy', $planet->getGalaxy()) - ->setData('system', $planet->getSystem()) - ->setData('planet', $planet->getPosition()) - ->setData('id_planet', $planet->getId()) - ->save() - ; - } - - Wootook::dispatchEvent('planet.init', array( - 'planet' => $planet, - 'player' => $this - )); - - $planet->save(); - - return $planet; - } - - /** - * - * Enter description here ... - * @param int|Wootook_Empire_Model_Planet $planet - */ - public function updateCurrentPlanet($planet) - { - if (!$planet instanceof Wootook_Empire_Model_Planet) { - $planetCollection = $this->_preparePlanetCollection()->where('id=:id'); - - $planetCollection->load(array( - 'id' => $planet, - 'user' => $this->getId() - )); - - if ($planetCollection->count() !== 1) { - return $this; - } - - $planet = $planetCollection->current(); - } - - if ($planet->getPlayerId() != $this->getId() || $planet->isDestroyed()) { - return $this; - } - - $this->setData('current_planet', $planet->getId())->save(); - - return $this; - } - - /** - * - * Enter description here ... - * @param Wootook_Empire_Model_Planet $planet - */ - public function setHomePlanet(Wootook_Empire_Model_Planet $planet) - { - if ($planet->getPlayerId() != $this->getId() || $planet->isDestroyed()) { - return $this; - } - - $this->setData('id_planet', $planet->getId()); - $this->_homePlanet = $planet; - - return $this; - } - - /** - * - * Enter description here ... - * @param Wootook_Empire_Model_Planet $planet - */ - public function setCurrentPlanet(Wootook_Empire_Model_Planet $planet) - { - if ($planet->getPlayerId() != $this->getId() || $planet->isDestroyed()) { - return $this; - } - - $this->setData('current_planet', $planet->getId()); - $this->_currentPlanet = $planet; - - return $this; - } - - /** - * - * Enter description here ... - * @return Wootook_Empire_Model_Planet - */ - public function getHomePlanet() - { - if ($this->_homePlanet === null) { - $planetId = $this->getData('id_planet'); - if (!$planetId) { - return null; - } - - $planet = Wootook_Empire_Model_Planet::factory($planetId); - - if ($planet->getPlayerId() != $this->getId() || $planet->isDestroyed()) { - return null; - } - - $this->_homePlanet = $planet; - } - - return $planet; - } - - /** - * - * Enter description here ... - * @return Wootook_Empire_Model_Planet - */ - public function getCurrentPlanet() - { - if ($this->_currentPlanet === null) { - $planetId = $this->getData('current_planet'); - - if (!$planetId) { - $this->_currentPlanet = $this->getHomePlanet(); - if ($this->_currentPlanet === null) { - return null; - } - $this->setData('current_planet', $this->_currentPlanet->getId())->save(); - - return $this->_currentPlanet; - } - - $planet = Wootook_Empire_Model_Planet::factory($planetId); - - if ($planet->getPlayerId() != $this->getId() || $planet->isDestroyed()) { - $this->_currentPlanet = $this->getHomePlanet(); - $this->setData('current_planet', $this->_currentPlanet->getId())->save(); - - return $this->_currentPlanet; - } - - $this->_currentPlanet = $planet; - } - - return $this->_currentPlanet; - } - - protected function _preparePlanetCollection() - { - $planetCollection = new Wootook_Empire_Resource_Planet_Collection($this->getReadConnection()); - $planetCollection->addPlayerToFilter($this); - - $order = ($this->getData('planet_sort_order') == 1) ? 'DESC' : 'ASC'; - - switch ($this->getData('planet_sort')) { - case self::PLANET_SORT_POSITION: - $planetCollection - ->addOrderBy('galaxy', $order) - ->addOrderBy('system', $order) - ->addOrderBy('planet', $order) - ->addOrderBy('planet_type', $order) - ; - break; - - case self::PLANET_SORT_NAME: - $planetCollection->addOrderBy('name', $order); - break; - - case self::PLANET_SORT_DATE: - default: - $planetCollection->addOrderBy('id', $order); - break; - } - return $planetCollection; - } - - public function getPlanetCollection(Array $typeFilter = array()) - { - $planetCollection = $this->_preparePlanetCollection(); - - if (!empty($typeFilter)) { - $planetCollection->addFieldToFilter('planet_type', array(array('in' => $typeFilter))); - } - - return $planetCollection; - } - - protected function _prepareFleetCollection($collection) - { - $collection->addFieldToFilter('fleet_owner', $this->getId()); - - return $this; - } - - /** - * Returns all the flying fleets owned by the player - * - * @return Wootook_Empire_Resource_Fleet_Collection - */ - public function getFleets() - { - $collection = new Wootook_Empire_Resource_Fleet_Collection($this->getReadConnection()); - - $this->_prepareFleetCollection($collection); - - return $collection; - } - - /** - * Counts all the flying fleets owned by the player - * - * @return mixed - */ - public function getFleetCount() - { - return $this->getFleets()->getSize(); - } - - /** - * Returns all the visible fleets - * - * @param null $time - * @return Wootook_Empire_Resource_Fleet_Collection - */ - public function getVisibleFleets($time = null) - { - $collection = new Wootook_Empire_Resource_Fleet_Collection($this->getReadConnection()); - - if ($time === null) { - $time = new Wootook_Core_DateTime(); - } - $collection->addIsVisibleToFilter($this, $time); - - return $collection; - } - - /** - * Returns all the visible fleets - * - * @param null $time - * @return Wootook_Empire_Resource_Fleet_Collection - * @deprecated - * @alias getVisibleFleets - */ - public function getFleetCollection($time = null) - { - return $this->getVisibleFleets($time); - } - - public function getElement($elementId) - { - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); - - return $this->getData($fields[$elementId]); - } - - public function setElement($elementId, $level) - { - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); - - return $this->setData($fields[$elementId], $level); - } - - public function hasElement($elementId, $levelRequired = 0) - { - $fields = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); - - return $this->hasData($fields[$elementId]) && Math::comp($this->getElement($elementId), $levelRequired) > 0; - } - - public function getSkinPath($default = null) - { - if ($path = $this->getData('dpath')) { - return $path; - } - return $default; - } - - public function setSkinPath($path) - { - $this->setData('dpath', $path); - - return $this; - } - - public function checkPassword($password) - { - if (self::hash($password) == $this->getData('password')) { - return true; - } - return false; - } - - public function getNewMessagesCount() - { - $messageCollection = new Wootook_Player_Resource_Message_Collection($this->getReadConnection()); - $messageCollection->addPlayerToFilter($this)->addUnreadToFilter(); - - $newMessages = null; - if (($count = $messageCollection->getSize()) > 0) { - return $count; - } - return null; - } - - public static function layoutPrepareAfterListener($eventData) - { - $player = Wootook_Player_Model_Session::getSingleton()->getPlayer(); - if ($player === null || !$player->getId() || !in_array($player->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { - return; - } - - if (!isset($eventData['layout']) || !$eventData['layout'] instanceof Wootook_Core_Model_Layout) { - return; - } - $layout = $eventData['layout']; - $navigation = $layout->getBlock('navigation'); - - if ($navigation === null) { - return; - } - - if (!defined('IN_ADMIN')) { - $navigation->addLink('tools/admin', 'Admin Panel', 'Admin Panel', 'admin/overview.php', array(), array('admin')); - } else { - $navigation->addLink('tools/back', 'Go back to the game', 'Go back to the game', 'overview.php', array(), array('admin')); - } - } - - public function isBanned() - { - return $this->getData('bana') ? true : false; - } - - public function isVacation() - { - return $this->getData('urlaubs_modus') ? true : false; - } - - public function getVacationEndDate() - { - return $this->getData('urlaubs_until'); - } - - public function getLastLoginDate() - { - return $this->getData('onlinetime'); - } - - public function setVacation($active = true) - { - $this->setData('urlaubs_modus', $active); - - foreach ($this->getPlanetCollection() as $planet) { - $planet->updateResources(); - $planet->updateResourceProduction(); - $planet->save(); - } - - if ($active) { - $this->setData('urlaubs_until', time() + Wootook::getConfig('engine/options/vacation-min-time')); - } else { - $this->setData('urlaubs_until', null); - } - $this->save(); - - return $this; - } - - public function isAuthorized($levels = array(LEVEL_ADMIN)) - { - if (!is_array($levels)) { - $levels = array($levels); - } - - if (in_array($this->getData('authlevel'), $levels)) { - return true; - } - return false; - } -} diff --git a/src/application/code/core/Wootook/Player/Model/Session.php b/src/application/code/core/Wootook/Player/Model/Session.php deleted file mode 100644 index 9ae226c..0000000 --- a/src/application/code/core/Wootook/Player/Model/Session.php +++ /dev/null @@ -1,205 +0,0 @@ -getData('player_id'); - } - - public function setPlayer(Wootook_Player_Model_Entity $player) - { - $this->_player = $player; - $this->setData('player_id', $player->getId()); - - return $this; - } - - /** - * - * Enter description here ... - * @return Wootook_Player_Model_Entity - */ - public function getPlayer() - { - if ($this->_player === null) { - $this->_player = new Wootook_Player_Model_Entity(); - - try { - if ($this->hasData('player_id')) { - $id = intval($this->getData('player_id')); - } else if (Wootook::getRequest() !== null && - ($cookieData = Wootook::getRequest()->getCookie($this->_player->getCookieName())) !== null && - is_array($cookieData)) { - - $adapter = $this->_player->getReadConnection(); - $select = $adapter->select(array('user' => $adapter->getTable('users'))); - - $select - ->column('id') - ->where('id', isset($cookieData['id']) ? intval($cookieData['id']) : 0) - ->where(new Wootook_Core_Database_Sql_Placeholder_Expression( - ':key=CONCAT((@salt:=MID(:key, 0, 4)), SHA1(CONCAT(user.username, user.password, @salt)))', - array('key' => isset($cookieData['key']) ? $adapter->quote($cookieData['key']) : null))) - ; - try { - $statement = $adapter->prepare($select); - if (!$statement->execute($cookieData) || $statement->rowCount() <= 0) { - throw new Wootook_Player_Exception_Session('Your session has expired, please login.'); - } - - $id = $statement->fetchColumn(); - } catch (Wootook_Core_Exception_Database_AdapterError $e) { - throw new Wootook_Core_Exception_DataAccessException('Session error.', null, $e); - } catch (Wootook_Core_Exception_Database_StatementError $e) { - throw new Wootook_Core_Exception_DataAccessException('Session error.', null, $e); - } - } else { - //throw new Wootook_Player_Exception_Session('Your session has expired, please login.'); - return $this->_player; - } - } catch (Wootook_Player_Exception_Session $e) { - $this->addError($e->getMessage()); - return $this->_player; - } - - try { - $this->_player->load($id); - } catch (Wootook_Core_Exception_DataAccessException $e) { - $this->addError('Session error.'); - return $this->_player; - } - $this->_player->updateActivity(); - } - return $this->_player; - } - - public function isLoggedIn() - { - if ($this->getPlayerId()) { - return true; - } - return false; - } - - public function logout() - { - $this->clearData(); - - return $this; - } - - public function login($username, $password, $remember = false) - { - try { - if ($this->_player === null) { - $this->_player = new Wootook_Player_Model_Entity(); - } - - if ($this->_player->getId()) { - return $this->_player; - } - $adapter = $this->_player->getReadConnection(); - $select = $adapter->select(array('user' => $adapter->getTable($this->_player->getTableName()))); - - $passwordHash = $this->_player->hash($password); - $select - ->column(array( - 'id' => 'user.id', - 'username' => 'user.username', - 'password_hash' => 'user.password', - 'is_banned' => 'user.banaday', - 'login_rememberme' => new Wootook_Core_Database_Sql_Placeholder_Expression('CONCAT((@salt:=MID(MD5(RAND()), 0, 4)), SHA1(CONCAT(user.username, user.password, @salt)))'), - 'login_success' => new Wootook_Core_Database_Sql_Placeholder_Expression("(CASE WHEN user.password={$adapter->quote($passwordHash)} THEN 1 ELSE 0 END)") - )) - ->where(new Wootook_Core_Database_Sql_Placeholder_Expression('user.username=:username', array('username' => $username))); - - $statement = $adapter->prepare($select); - if (!$statement->execute()) { - $this->addError(Wootook::__('No such user.')); - return $this->_player; - } - } catch (Wootook_Core_Exception_Database_StatementError $e) { - Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); - $this->addError(Wootook::__('No such user.')); - return $this->_player; - } catch (Wootook_Core_Exception_DataAccessException $e) { - Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); - $this->addError(Wootook::__('No such user.')); - return $this->_player; - } - - $login = $statement->fetch(); - - if (intval($login['login_success']) == 1) { - $this->_player->load($login['id']); - - if ($login['is_banned'] != 0) { - if ($login['is_banned'] <= time()) { - $this->_player->setData('banaday', 0) - ->setData('bana', 0) - ->setData('urlaubs_modus', 0) - ->setData('urlaubs_until', null) - ->save() - ; - } else { - $this->addError(Wootook::__('You were banned, please contact admin for more information.')); - return $this->_player; - } - } - - if (isset($_POST["rememberme"]) && Wootook::getResponse() !== null) { - Wootook::getResponse()->setCookie( - $this->_player->getCookieName(), - array('id' => $this->_player->getId(), 'key' => $login['login_rememberme']), - $this->_player->getCookieLifetime(), - $this->_player->getCookiePath(), - $this->_player->getCookieDomain() - ); - } - - $this->setLoggedIn($this->_player); - return $this->_player; - } - - $this->addError(Wootook::__('Your username or credential is invalid, please check your input.')); - return $this->_player; - } - - public function setLoggedIn(Wootook_Player_Model_Entity $player) - { - $player->updateActivity(); - - $this->setData('player_id', intval($player->getId())); - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Player/Mvc/Controller/Registered.php b/src/application/code/core/Wootook/Player/Mvc/Controller/Registered.php deleted file mode 100644 index 3374acf..0000000 --- a/src/application/code/core/Wootook/Player/Mvc/Controller/Registered.php +++ /dev/null @@ -1,32 +0,0 @@ -getSession()->getPlayer(); - } - - public function getCurrentPlanet() - { - return $this->getPlayer()->getCurrentPlanet(); - } - - public function preDispatch() - { - if (!$this->getSession()->isLoggedIn()) { - $this->_redirectLogin(); - } - } - - protected function _redirectLogin() - { - return $this->_redirect('player/account/login'); - } -} diff --git a/src/application/code/core/Wootook/Player/Resource/Entity/Collection.php b/src/application/code/core/Wootook/Player/Resource/Entity/Collection.php deleted file mode 100644 index 3e2c1bc..0000000 --- a/src/application/code/core/Wootook/Player/Resource/Entity/Collection.php +++ /dev/null @@ -1,37 +0,0 @@ -_init('users', 'Wootook_Player_Model_Entity'); - } - - public function addAuthlevelToFilter(Array $levels, $exclude = false) - { - if ($exclude === true) { - $this->addFieldToFilter('authlevel', array(array('nin' => $levels))); - } else { - $this->addFieldToFilter('authlevel', array(array('in' => $levels))); - } - - return $this; - } - - public function addIsOnlineToFilter($onlineTime = 900) - { - $onlineTime = (int) $onlineTime; - - $date = new Wootook_Core_DateTime(); - $date->sub($onlineTime, Wootook_Core_DateTime::TIMESTAMP); - - if ($onlineTime > 0) { - $this->addFieldToFilter('onlinetime', array(array( - Wootook_Core_Database_Sql_Select::OPERATOR_DATE => array('from' => $date) - ))); - } - - return $this; - } -} diff --git a/src/application/code/core/Wootook/Player/Resource/Message/Collection.php b/src/application/code/core/Wootook/Player/Resource/Message/Collection.php deleted file mode 100644 index e6d9198..0000000 --- a/src/application/code/core/Wootook/Player/Resource/Message/Collection.php +++ /dev/null @@ -1,24 +0,0 @@ -_init('messages', 'Wootook_Player_Model_Message'); - } - - public function addPlayerToFilter(Wootook_Player_Model_Entity $player) - { - $this->addFieldToFilter('message_owner', $player->getId()); - - return $this; - } - - public function addUnreadToFilter() - { - $this->addFieldToFilter('message_read_at', array(array('lteq' => 0))); - - return $this; - } -} diff --git a/src/application/code/libraries/Wildfire/Stream.php b/src/application/code/libraries/Wildfire/Stream.php deleted file mode 100644 index 9966a44..0000000 --- a/src/application/code/libraries/Wildfire/Stream.php +++ /dev/null @@ -1,1753 +0,0 @@ - - * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHPCore - */ - - -/** - * Sends the given data to the FirePHP Firefox Extension. - * The data can be displayed in the Firebug Console or in the - * "Server" request tab. - * - * For more information see: http://www.firephp.org/ - * - * @copyright Copyright (C) 2007-2009 Christoph Dorn - * @author Christoph Dorn - * @license http://www.opensource.org/licenses/bsd-license.php - * @package FirePHPCore - */ -class Wildfire_Stream { - - /** - * FirePHP version - * - * @var string - */ - const VERSION = '0.3'; // @pinf replace '0.3' with '%%package.version%%' - - /** - * Firebug LOG level - * - * Logs a message to firebug console. - * - * @var string - */ - const LOG = 'LOG'; - - /** - * Firebug INFO level - * - * Logs a message to firebug console and displays an info icon before the message. - * - * @var string - */ - const INFO = 'INFO'; - - /** - * Firebug WARN level - * - * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise. - * - * @var string - */ - const WARN = 'WARN'; - - /** - * Firebug ERROR level - * - * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count. - * - * @var string - */ - const ERROR = 'ERROR'; - - /** - * Dumps a variable to firebug's server panel - * - * @var string - */ - const DUMP = 'DUMP'; - - /** - * Displays a stack trace in firebug console - * - * @var string - */ - const TRACE = 'TRACE'; - - /** - * Displays an exception in firebug console - * - * Increments the firebug error count. - * - * @var string - */ - const EXCEPTION = 'EXCEPTION'; - - /** - * Displays an table in firebug console - * - * @var string - */ - const TABLE = 'TABLE'; - - /** - * Starts a group in firebug console - * - * @var string - */ - const GROUP_START = 'GROUP_START'; - - /** - * Ends a group in firebug console - * - * @var string - */ - const GROUP_END = 'GROUP_END'; - - /** - * Singleton instance of FirePHP - * - * @var FirePHP - */ - protected static $instance = null; - - /** - * Flag whether we are logging from within the exception handler - * - * @var boolean - */ - protected $inExceptionHandler = false; - - /** - * Flag whether to throw PHP errors that have been converted to ErrorExceptions - * - * @var boolean - */ - protected $throwErrorExceptions = true; - - /** - * Flag whether to convert PHP assertion errors to Exceptions - * - * @var boolean - */ - protected $convertAssertionErrorsToExceptions = true; - - /** - * Flag whether to throw PHP assertion errors that have been converted to Exceptions - * - * @var boolean - */ - protected $throwAssertionExceptions = false; - - /** - * Wildfire protocol message index - * - * @var int - */ - protected $messageIndex = 1; - - /** - * Options for the library - * - * @var array - */ - protected $options = array('maxDepth' => 10, - 'maxObjectDepth' => 5, - 'maxArrayDepth' => 5, - 'useNativeJsonEncode' => true, - 'includeLineNumbers' => true); - - /** - * Filters used to exclude object members when encoding - * - * @var array - */ - protected $objectFilters = array( - 'firephp' => array('objectStack', 'instance', 'json_objectStack'), - 'firephp_test_class' => array('objectStack', 'instance', 'json_objectStack') - ); - - /** - * A stack of objects used to detect recursion during object encoding - * - * @var object - */ - protected $objectStack = array(); - - /** - * Flag to enable/disable logging - * - * @var boolean - */ - protected $enabled = true; - - /** - * The insight console to log to if applicable - * - * @var object - */ - protected $logToInsightConsole = null; - - /** - * When the object gets serialized only include specific object members. - * - * @return array - */ - public function __sleep() - { - return array('options','objectFilters','enabled'); - } - - /** - * Gets singleton instance of FirePHP - * - * @param boolean $AutoCreate - * @return FirePHP - */ - public static function getInstance($AutoCreate = false) - { - if ($AutoCreate===true && !self::$instance) { - self::init(); - } - return self::$instance; - } - - /** - * Creates FirePHP object and stores it for singleton access - * - * @return FirePHP - */ - public static function init() - { - return self::setInstance(new self()); - } - - /** - * Set the instance of the FirePHP singleton - * - * @param FirePHP $instance The FirePHP object instance - * @return FirePHP - */ - public static function setInstance($instance) - { - return self::$instance = $instance; - } - - /** - * Set an Insight console to direct all logging calls to - * - * @param object $console The console object to log to - * @return void - */ - public function setLogToInsightConsole($console) - { - if(is_string($console)) { - if(get_class($this)!='FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) { - throw new Exception('FirePHP instance not an instance or subclass of FirePHP_Insight!'); - } - $this->logToInsightConsole = $this->to('request')->console($console); - } else { - $this->logToInsightConsole = $console; - } - } - - /** - * Enable and disable logging to Firebug - * - * @param boolean $Enabled TRUE to enable, FALSE to disable - * @return void - */ - public function setEnabled($Enabled) - { - $this->enabled = $Enabled; - } - - /** - * Check if logging is enabled - * - * @return boolean TRUE if enabled - */ - public function getEnabled() - { - return $this->enabled; - } - - /** - * Specify a filter to be used when encoding an object - * - * Filters are used to exclude object members. - * - * @param string $Class The class name of the object - * @param array $Filter An array of members to exclude - * @return void - */ - public function setObjectFilter($Class, $Filter) - { - $this->objectFilters[strtolower($Class)] = $Filter; - } - - /** - * Set some options for the library - * - * Options: - * - maxDepth: The maximum depth to traverse (default: 10) - * - maxObjectDepth: The maximum depth to traverse objects (default: 5) - * - maxArrayDepth: The maximum depth to traverse arrays (default: 5) - * - useNativeJsonEncode: If true will use json_encode() (default: true) - * - includeLineNumbers: If true will include line numbers and filenames (default: true) - * - * @param array $Options The options to be set - * @return void - */ - public function setOptions($Options) - { - $this->options = array_merge($this->options,$Options); - } - - /** - * Get options from the library - * - * @return array The currently set options - */ - public function getOptions() - { - return $this->options; - } - - /** - * Set an option for the library - * - * @param string $Name - * @param mixed $Value - * @throws Exception - * @return void - */ - public function setOption($Name, $Value) - { - if (!isset($this->options[$Name])) { - throw $this->newException('Unknown option: ' . $Name); - } - $this->options[$Name] = $Value; - } - - /** - * Get an option from the library - * - * @param string $Name - * @throws Exception - * @return mixed - */ - public function getOption($Name) - { - if (!isset($this->options[$Name])) { - throw $this->newException('Unknown option: ' . $Name); - } - return $this->options[$Name]; - } - - /** - * Register FirePHP as your error handler - * - * Will throw exceptions for each php error. - * - * @return mixed Returns a string containing the previously defined error handler (if any) - */ - public function registerErrorHandler($throwErrorExceptions = false) - { - //NOTE: The following errors will not be caught by this error handler: - // E_ERROR, E_PARSE, E_CORE_ERROR, - // E_CORE_WARNING, E_COMPILE_ERROR, - // E_COMPILE_WARNING, E_STRICT - - $this->throwErrorExceptions = $throwErrorExceptions; - - return set_error_handler(array($this,'errorHandler')); - } - - /** - * FirePHP's error handler - * - * Throws exception for each php error that will occur. - * - * @param int $errno - * @param string $errstr - * @param string $errfile - * @param int $errline - * @param array $errcontext - */ - public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) - { - // Don't throw exception if error reporting is switched off - if (error_reporting() == 0) { - return; - } - // Only throw exceptions for errors we are asking for - if (error_reporting() & $errno) { - - $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline); - if ($this->throwErrorExceptions) { - throw $exception; - } else { - $this->fb($exception); - } - } - } - - /** - * Register FirePHP as your exception handler - * - * @return mixed Returns the name of the previously defined exception handler, - * or NULL on error. - * If no previous handler was defined, NULL is also returned. - */ - public function registerExceptionHandler() - { - return set_exception_handler(array($this,'exceptionHandler')); - } - - /** - * FirePHP's exception handler - * - * Logs all exceptions to your firebug console and then stops the script. - * - * @param Exception $Exception - * @throws Exception - */ - function exceptionHandler($Exception) - { - - $this->inExceptionHandler = true; - - header('HTTP/1.1 500 Internal Server Error'); - - try { - $this->fb($Exception); - } catch (Exception $e) { - echo 'We had an exception: ' . $e; - } - $this->inExceptionHandler = false; - } - - /** - * Register FirePHP driver as your assert callback - * - * @param boolean $convertAssertionErrorsToExceptions - * @param boolean $throwAssertionExceptions - * @return mixed Returns the original setting or FALSE on errors - */ - public function registerAssertionHandler($convertAssertionErrorsToExceptions = true, $throwAssertionExceptions = false) - { - $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions; - $this->throwAssertionExceptions = $throwAssertionExceptions; - - if ($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) { - throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!'); - } - - return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler')); - } - - /** - * FirePHP's assertion handler - * - * Logs all assertions to your firebug console and then stops the script. - * - * @param string $file File source of assertion - * @param int $line Line source of assertion - * @param mixed $code Assertion code - */ - public function assertionHandler($file, $line, $code) - { - if ($this->convertAssertionErrorsToExceptions) { - - $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line); - - if ($this->throwAssertionExceptions) { - throw $exception; - } else { - $this->fb($exception); - } - - } else { - $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line)); - } - } - - /** - * Start a group for following messages. - * - * Options: - * Collapsed: [true|false] - * Color: [#RRGGBB|ColorName] - * - * @param string $Name - * @param array $Options OPTIONAL Instructions on how to log the group - * @return true - * @throws Exception - */ - public function group($Name, $Options = null) - { - - if (!$Name) { - throw $this->newException('You must specify a label for the group!'); - } - - if ($Options) { - if (!is_array($Options)) { - throw $this->newException('Options must be defined as an array!'); - } - if (array_key_exists('Collapsed', $Options)) { - $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false'; - } - } - - return $this->fb(null, $Name, FirePHP::GROUP_START, $Options); - } - - /** - * Ends a group you have started before - * - * @return true - * @throws Exception - */ - public function groupEnd() - { - return $this->fb(null, null, FirePHP::GROUP_END); - } - - /** - * Log object with label to firebug console - * - * @see FirePHP::LOG - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public function log($Object, $Label = null, $Options = array()) - { - return $this->fb($Object, $Label, FirePHP::LOG, $Options); - } - - /** - * Log object with label to firebug console - * - * @see FirePHP::INFO - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public function info($Object, $Label = null, $Options = array()) - { - return $this->fb($Object, $Label, FirePHP::INFO, $Options); - } - - /** - * Log object with label to firebug console - * - * @see FirePHP::WARN - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public function warn($Object, $Label = null, $Options = array()) - { - return $this->fb($Object, $Label, FirePHP::WARN, $Options); - } - - /** - * Log object with label to firebug console - * - * @see FirePHP::ERROR - * @param mixes $Object - * @param string $Label - * @return true - * @throws Exception - */ - public function error($Object, $Label = null, $Options = array()) - { - return $this->fb($Object, $Label, FirePHP::ERROR, $Options); - } - - /** - * Dumps key and variable to firebug server panel - * - * @see FirePHP::DUMP - * @param string $Key - * @param mixed $Variable - * @return true - * @throws Exception - */ - public function dump($Key, $Variable, $Options = array()) - { - if (!is_string($Key)) { - throw $this->newException('Key passed to dump() is not a string'); - } - if (strlen($Key)>100) { - throw $this->newException('Key passed to dump() is longer than 100 characters'); - } - if (!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) { - throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]'); - } - return $this->fb($Variable, $Key, FirePHP::DUMP, $Options); - } - - /** - * Log a trace in the firebug console - * - * @see FirePHP::TRACE - * @param string $Label - * @return true - * @throws Exception - */ - public function trace($Label) - { - return $this->fb($Label, FirePHP::TRACE); - } - - /** - * Log a table in the firebug console - * - * @see FirePHP::TABLE - * @param string $Label - * @param string $Table - * @return true - * @throws Exception - */ - public function table($Label, $Table, $Options = array()) - { - return $this->fb($Table, $Label, FirePHP::TABLE, $Options); - } - - /** - * Insight API wrapper - * - * @see Insight_Helper::to() - */ - public static function to() - { - $instance = self::getInstance(); - if (!method_exists($instance, "_to")) { - throw new Exception("FirePHP::to() implementation not loaded"); - } - $args = func_get_args(); - return call_user_func_array(array($instance, '_to'), $args); - } - - /** - * Insight API wrapper - * - * @see Insight_Helper::plugin() - */ - public static function plugin() - { - $instance = self::getInstance(); - if (!method_exists($instance, "_plugin")) { - throw new Exception("FirePHP::plugin() implementation not loaded"); - } - $args = func_get_args(); - return call_user_func_array(array($instance, '_plugin'), $args); - } - - /** - * Check if FirePHP is installed on client - * - * @return boolean - */ - public function detectClientExtension() - { - // Check if FirePHP is installed on client via User-Agent header - if (@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) && - version_compare($m[1][0],'0.0.6','>=')) { - return true; - } else - // Check if FirePHP is installed on client via X-FirePHP-Version header - if (@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) && - version_compare($m[1][0],'0.0.6','>=')) { - return true; - } - return false; - } - - /** - * Log varible to Firebug - * - * @see http://www.firephp.org/Wiki/Reference/Fb - * @param mixed $Object The variable to be logged - * @return true Return TRUE if message was added to headers, FALSE otherwise - * @throws Exception - */ - public function fb($Object) - { - if($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) { - if(!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message - $this->_logUpgradeClientMessage(); - } - } - - static $insightGroupStack = array(); - - if (!$this->getEnabled()) { - return false; - } - - if ($this->headersSent($filename, $linenum)) { - // If we are logging from within the exception handler we cannot throw another exception - if ($this->inExceptionHandler) { - // Simply echo the error out to the page - echo '
FirePHP ERROR: Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.
'; - } else { - throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.'); - } - } - - $Type = null; - $Label = null; - $Options = array(); - - if (func_num_args()==1) { - } else - if (func_num_args()==2) { - switch(func_get_arg(1)) { - case self::LOG: - case self::INFO: - case self::WARN: - case self::ERROR: - case self::DUMP: - case self::TRACE: - case self::EXCEPTION: - case self::TABLE: - case self::GROUP_START: - case self::GROUP_END: - $Type = func_get_arg(1); - break; - default: - $Label = func_get_arg(1); - break; - } - } else - if (func_num_args()==3) { - $Type = func_get_arg(2); - $Label = func_get_arg(1); - } else - if (func_num_args()==4) { - $Type = func_get_arg(2); - $Label = func_get_arg(1); - $Options = func_get_arg(3); - } else { - throw $this->newException('Wrong number of arguments to fb() function!'); - } - - if($this->logToInsightConsole!==null && (get_class($this)=='FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) { - $msg = $this->logToInsightConsole; - if ($Object instanceof Exception) { - $Type = self::EXCEPTION; - } - if($Label && $Type!=self::TABLE && $Type!=self::GROUP_START) { - $msg = $msg->label($Label); - } - switch($Type) { - case self::DUMP: - case self::LOG: - return $msg->log($Object); - case self::INFO: - return $msg->info($Object); - case self::WARN: - return $msg->warn($Object); - case self::ERROR: - return $msg->error($Object); - case self::TRACE: - return $msg->trace($Object); - case self::EXCEPTION: - return $this->plugin('engine')->handleException($Object, $msg); - case self::TABLE: - if (isset($Object[0]) && !is_string($Object[0]) && $Label) { - $Object = array($Label, $Object); - } - return $msg->table($Object[0], array_slice($Object[1],1), $Object[1][0]); - case self::GROUP_START: - $insightGroupStack[] = $msg->group(md5($Label))->open(); - return $msg->log($Label); - case self::GROUP_END: - if(count($insightGroupStack)==0) { - throw new Error('Too many groupEnd() as opposed to group() calls!'); - } - $group = array_pop($insightGroupStack); - return $group->close(); - default: - return $msg->log($Object); - } - } - - if (!$this->detectClientExtension()) { - return false; - } - - $meta = array(); - $skipFinalObjectEncode = false; - - if ($Object instanceof Exception) { - - $meta['file'] = $this->_escapeTraceFile($Object->getFile()); - $meta['line'] = $Object->getLine(); - - $trace = $Object->getTrace(); - if ($Object instanceof ErrorException - && isset($trace[0]['function']) - && $trace[0]['function']=='errorHandler' - && isset($trace[0]['class']) - && $trace[0]['class']=='FirePHP') { - - $severity = false; - switch($Object->getSeverity()) { - case E_WARNING: $severity = 'E_WARNING'; break; - case E_NOTICE: $severity = 'E_NOTICE'; break; - case E_USER_ERROR: $severity = 'E_USER_ERROR'; break; - case E_USER_WARNING: $severity = 'E_USER_WARNING'; break; - case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break; - case E_STRICT: $severity = 'E_STRICT'; break; - case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break; - case E_DEPRECATED: $severity = 'E_DEPRECATED'; break; - case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break; - } - - $Object = array('Class'=>get_class($Object), - 'Message'=>$severity.': '.$Object->getMessage(), - 'File'=>$this->_escapeTraceFile($Object->getFile()), - 'Line'=>$Object->getLine(), - 'Type'=>'trigger', - 'Trace'=>$this->_escapeTrace(array_splice($trace,2))); - $skipFinalObjectEncode = true; - } else { - $Object = array('Class'=>get_class($Object), - 'Message'=>$Object->getMessage(), - 'File'=>$this->_escapeTraceFile($Object->getFile()), - 'Line'=>$Object->getLine(), - 'Type'=>'throw', - 'Trace'=>$this->_escapeTrace($trace)); - $skipFinalObjectEncode = true; - } - $Type = self::EXCEPTION; - - } else - if ($Type==self::TRACE) { - - $trace = debug_backtrace(); - if (!$trace) return false; - for( $i=0 ; $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' - || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { - /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ - } else - if (isset($trace[$i]['class']) - && isset($trace[$i+1]['file']) - && $trace[$i]['class']=='FirePHP' - && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { - /* Skip fb() */ - } else - if ($trace[$i]['function']=='fb' - || $trace[$i]['function']=='trace' - || $trace[$i]['function']=='send') { - - $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'', - 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'', - 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'', - 'Message'=>$trace[$i]['args'][0], - 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'', - 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'', - 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'', - 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1))); - - $skipFinalObjectEncode = true; - $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; - $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; - break; - } - } - - } else - if ($Type==self::TABLE) { - - if (isset($Object[0]) && is_string($Object[0])) { - $Object[1] = $this->encodeTable($Object[1]); - } else { - $Object = $this->encodeTable($Object); - } - - $skipFinalObjectEncode = true; - - } else - if ($Type==self::GROUP_START) { - - if (!$Label) { - throw $this->newException('You must specify a label for the group!'); - } - - } else { - if ($Type===null) { - $Type = self::LOG; - } - } - - if ($this->options['includeLineNumbers']) { - if (!isset($meta['file']) || !isset($meta['line'])) { - - $trace = debug_backtrace(); - for( $i=0 ; $trace && $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php' - || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) { - /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */ - } else - if (isset($trace[$i]['class']) - && isset($trace[$i+1]['file']) - && $trace[$i]['class']=='FirePHP' - && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') { - /* Skip fb() */ - } else - if (isset($trace[$i]['file']) - && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') { - /* Skip FB::fb() */ - } else { - $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):''; - $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:''; - break; - } - } - } - } else { - unset($meta['file']); - unset($meta['line']); - } - - $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); - $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION); - - $structure_index = 1; - if ($Type==self::DUMP) { - $structure_index = 2; - $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1'); - } else { - $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); - } - - if ($Type==self::DUMP) { - $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}'; - } else { - $msg_meta = $Options; - $msg_meta['Type'] = $Type; - if ($Label!==null) { - $msg_meta['Label'] = $Label; - } - if (isset($meta['file']) && !isset($msg_meta['File'])) { - $msg_meta['File'] = $meta['file']; - } - if (isset($meta['line']) && !isset($msg_meta['Line'])) { - $msg_meta['Line'] = $meta['line']; - } - $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']'; - } - - $parts = explode("\n",chunk_split($msg, 5000, "\n")); - - for( $i=0 ; $i2) { - // Message needs to be split into multiple parts - $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, - (($i==0)?strlen($msg):'') - . '|' . $part . '|' - . (($isetHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex, - strlen($part) . '|' . $part . '|'); - } - - $this->messageIndex++; - - if ($this->messageIndex > 99999) { - throw $this->newException('Maximum number (99,999) of messages reached!'); - } - } - } - - $this->setHeader('X-Wf-1-Index',$this->messageIndex-1); - - return true; - } - - /** - * Standardizes path for windows systems. - * - * @param string $Path - * @return string - */ - protected function _standardizePath($Path) - { - return preg_replace('/\\\\+/','/',$Path); - } - - /** - * Escape trace path for windows systems - * - * @param array $Trace - * @return array - */ - protected function _escapeTrace($Trace) - { - if (!$Trace) return $Trace; - for( $i=0 ; $i_escapeTraceFile($Trace[$i]['file']); - } - if (isset($Trace[$i]['args'])) { - $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']); - } - } - return $Trace; - } - - /** - * Escape file information of trace for windows systems - * - * @param string $File - * @return string - */ - protected function _escapeTraceFile($File) - { - /* Check if we have a windows filepath */ - if (strpos($File,'\\')) { - /* First strip down to single \ */ - - $file = preg_replace('/\\\\+/','\\',$File); - - return $file; - } - return $File; - } - - /** - * Check if headers have already been sent - * - * @param string $Filename - * @param integer $Linenum - */ - protected function headersSent(&$Filename, &$Linenum) - { - return headers_sent($Filename, $Linenum); - } - - /** - * Send header - * - * @param string $Name - * @param string $Value - */ - protected function setHeader($Name, $Value) - { - return header($Name.': '.$Value); - } - - /** - * Get user agent - * - * @return string|false - */ - protected function getUserAgent() - { - if (!isset($_SERVER['HTTP_USER_AGENT'])) return false; - return $_SERVER['HTTP_USER_AGENT']; - } - - /** - * Get all request headers - * - * @return array - */ - public static function getAllRequestHeaders() { - static $_cached_headers = false; - if($_cached_headers!==false) { - return $_cached_headers; - } - $headers = array(); - if(function_exists('getallheaders')) { - foreach( getallheaders() as $name => $value ) { - $headers[strtolower($name)] = $value; - } - } else { - foreach($_SERVER as $name => $value) { - if(substr($name, 0, 5) == 'HTTP_') { - $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value; - } - } - } - return $_cached_headers = $headers; - } - - /** - * Get a request header - * - * @return string|false - */ - protected function getRequestHeader($Name) - { - $headers = self::getAllRequestHeaders(); - if (isset($headers[strtolower($Name)])) { - return $headers[strtolower($Name)]; - } - return false; - } - - /** - * Returns a new exception - * - * @param string $Message - * @return Exception - */ - protected function newException($Message) - { - return new Exception($Message); - } - - /** - * Encode an object into a JSON string - * - * Uses PHP's jeson_encode() if available - * - * @param object $Object The object to be encoded - * @return string The JSON string - */ - public function jsonEncode($Object, $skipObjectEncode = false) - { - if (!$skipObjectEncode) { - $Object = $this->encodeObject($Object); - } - - if (function_exists('json_encode') - && $this->options['useNativeJsonEncode']!=false) { - - return json_encode($Object); - } else { - return $this->json_encode($Object); - } - } - - /** - * Encodes a table by encoding each row and column with encodeObject() - * - * @param array $Table The table to be encoded - * @return array - */ - protected function encodeTable($Table) - { - - if (!$Table) return $Table; - - $new_table = array(); - foreach($Table as $row) { - - if (is_array($row)) { - $new_row = array(); - - foreach($row as $item) { - $new_row[] = $this->encodeObject($item); - } - - $new_table[] = $new_row; - } - } - - return $new_table; - } - - /** - * Encodes an object including members with - * protected and private visibility - * - * @param Object $Object The object to be encoded - * @param int $Depth The current traversal depth - * @return array All members of the object - */ - protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $MaxDepth = 1) - { - if ($MaxDepth > $this->options['maxDepth']) { - return '** Max Depth ('.$this->options['maxDepth'].') **'; - } - - $return = array(); - - if (is_resource($Object)) { - - return '** '.(string)$Object.' **'; - - } else - if (is_object($Object)) { - - if ($ObjectDepth > $this->options['maxObjectDepth']) { - return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **'; - } - - foreach ($this->objectStack as $refVal) { - if ($refVal === $Object) { - return '** Recursion ('.get_class($Object).') **'; - } - } - array_push($this->objectStack, $Object); - - $return['__className'] = $class = get_class($Object); - $class_lower = strtolower($class); - - $reflectionClass = new ReflectionClass($class); - $properties = array(); - foreach( $reflectionClass->getProperties() as $property) { - $properties[$property->getName()] = $property; - } - - $members = (array)$Object; - - foreach( $properties as $plain_name => $property ) { - - $name = $raw_name = $plain_name; - if ($property->isStatic()) { - $name = 'static:'.$name; - } - if ($property->isPublic()) { - $name = 'public:'.$name; - } else - if ($property->isPrivate()) { - $name = 'private:'.$name; - $raw_name = "\0".$class."\0".$raw_name; - } else - if ($property->isProtected()) { - $name = 'protected:'.$name; - $raw_name = "\0".'*'."\0".$raw_name; - } - - if (!(isset($this->objectFilters[$class_lower]) - && is_array($this->objectFilters[$class_lower]) - && in_array($plain_name,$this->objectFilters[$class_lower]))) { - - if (array_key_exists($raw_name,$members) - && !$property->isStatic()) { - - $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1, $MaxDepth + 1); - - } else { - if (method_exists($property,'setAccessible')) { - $property->setAccessible(true); - $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1); - } else - if ($property->isPublic()) { - $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1); - } else { - $return[$name] = '** Need PHP 5.3 to get value **'; - } - } - } else { - $return[$name] = '** Excluded by Filter **'; - } - } - - // Include all members that are not defined in the class - // but exist in the object - foreach( $members as $raw_name => $value ) { - - $name = $raw_name; - - if ($name{0} == "\0") { - $parts = explode("\0", $name); - $name = $parts[2]; - } - - $plain_name = $name; - - if (!isset($properties[$name])) { - $name = 'undeclared:'.$name; - - if (!(isset($this->objectFilters[$class_lower]) - && is_array($this->objectFilters[$class_lower]) - && in_array($plain_name,$this->objectFilters[$class_lower]))) { - - $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1, $MaxDepth + 1); - } else { - $return[$name] = '** Excluded by Filter **'; - } - } - } - - array_pop($this->objectStack); - - } elseif (is_array($Object)) { - - if ($ArrayDepth > $this->options['maxArrayDepth']) { - return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **'; - } - - foreach ($Object as $key => $val) { - - // Encoding the $GLOBALS PHP array causes an infinite loop - // if the recursion is not reset here as it contains - // a reference to itself. This is the only way I have come up - // with to stop infinite recursion in this case. - if ($key=='GLOBALS' - && is_array($val) - && array_key_exists('GLOBALS',$val)) { - $val['GLOBALS'] = '** Recursion (GLOBALS) **'; - } - - $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1, $MaxDepth + 1); - } - } else { - if (self::is_utf8($Object)) { - return $Object; - } else { - return utf8_encode($Object); - } - } - return $return; - } - - /** - * Returns true if $string is valid UTF-8 and false otherwise. - * - * @param mixed $str String to be tested - * @return boolean - */ - protected static function is_utf8($str) - { - if(function_exists('mb_detect_encoding')) { - return (mb_detect_encoding($str) == 'UTF-8'); - } - $c=0; $b=0; - $bits=0; - $len=strlen($str); - for($i=0; $i<$len; $i++){ - $c=ord($str[$i]); - if ($c > 128){ - if (($c >= 254)) return false; - elseif ($c >= 252) $bits=6; - elseif ($c >= 248) $bits=5; - elseif ($c >= 240) $bits=4; - elseif ($c >= 224) $bits=3; - elseif ($c >= 192) $bits=2; - else return false; - if (($i+$bits) > $len) return false; - while($bits > 1){ - $i++; - $b=ord($str[$i]); - if ($b < 128 || $b > 191) return false; - $bits--; - } - } - } - return true; - } - - /** - * Converts to and from JSON format. - * - * JSON (JavaScript Object Notation) is a lightweight data-interchange - * format. It is easy for humans to read and write. It is easy for machines - * to parse and generate. It is based on a subset of the JavaScript - * Programming Language, Standard ECMA-262 3rd Edition - December 1999. - * This feature can also be found in Python. JSON is a text format that is - * completely language independent but uses conventions that are familiar - * to programmers of the C-family of languages, including C, C++, C#, Java, - * JavaScript, Perl, TCL, and many others. These properties make JSON an - * ideal data-interchange language. - * - * This package provides a simple encoder and decoder for JSON notation. It - * is intended for use with client-side Javascript applications that make - * use of HTTPRequest to perform server communication functions - data can - * be encoded into JSON notation for use in a client-side javascript, or - * decoded from incoming Javascript requests. JSON format is native to - * Javascript, and can be directly eval()'ed with no further parsing - * overhead - * - * All strings should be in ASCII or UTF-8 format! - * - * LICENSE: Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: Redistributions of source code must retain the - * above copyright notice, this list of conditions and the following - * disclaimer. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN - * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * @category - * @package Services_JSON - * @author Michal Migurski - * @author Matt Knapp - * @author Brett Stimmerman - * @author Christoph Dorn - * @copyright 2005 Michal Migurski - * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ - * @license http://www.opensource.org/licenses/bsd-license.php - * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 - */ - - - /** - * Keep a list of objects as we descend into the array so we can detect recursion. - */ - private $json_objectStack = array(); - - - /** - * convert a string from one UTF-8 char to one UTF-16 char - * - * Normally should be handled by mb_convert_encoding, but - * provides a slower PHP-only method for installations - * that lack the multibye string extension. - * - * @param string $utf8 UTF-8 character - * @return string UTF-16 character - * @access private - */ - private function json_utf82utf16($utf8) - { - // oh please oh please oh please oh please oh please - if (function_exists('mb_convert_encoding')) { - return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); - } - - switch(strlen($utf8)) { - case 1: - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return $utf8; - - case 2: - // return a UTF-16 character from a 2-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x07 & (ord($utf8{0}) >> 2)) - . chr((0xC0 & (ord($utf8{0}) << 6)) - | (0x3F & ord($utf8{1}))); - - case 3: - // return a UTF-16 character from a 3-byte UTF-8 char - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr((0xF0 & (ord($utf8{0}) << 4)) - | (0x0F & (ord($utf8{1}) >> 2))) - . chr((0xC0 & (ord($utf8{1}) << 6)) - | (0x7F & ord($utf8{2}))); - } - - // ignoring UTF-32 for now, sorry - return ''; - } - - /** - * encodes an arbitrary variable into JSON format - * - * @param mixed $var any number, boolean, string, array, or object to be encoded. - * see argument 1 to Services_JSON() above for array-parsing behavior. - * if var is a strng, note that encode() always expects it - * to be in ASCII or UTF-8 format! - * - * @return mixed JSON string representation of input var or an error if a problem occurs - * @access public - */ - private function json_encode($var) - { - - if (is_object($var)) { - if (in_array($var,$this->json_objectStack)) { - return '"** Recursion **"'; - } - } - - switch (gettype($var)) { - case 'boolean': - return $var ? 'true' : 'false'; - - case 'NULL': - return 'null'; - - case 'integer': - return (int) $var; - - case 'double': - case 'float': - return (float) $var; - - case 'string': - // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT - $ascii = ''; - $strlen_var = strlen($var); - - /* - * Iterate over every character in the string, - * escaping with a slash or encoding to UTF-8 where necessary - */ - for ($c = 0; $c < $strlen_var; ++$c) { - - $ord_var_c = ord($var{$c}); - - switch (true) { - case $ord_var_c == 0x08: - $ascii .= '\b'; - break; - case $ord_var_c == 0x09: - $ascii .= '\t'; - break; - case $ord_var_c == 0x0A: - $ascii .= '\n'; - break; - case $ord_var_c == 0x0C: - $ascii .= '\f'; - break; - case $ord_var_c == 0x0D: - $ascii .= '\r'; - break; - - case $ord_var_c == 0x22: - case $ord_var_c == 0x2F: - case $ord_var_c == 0x5C: - // double quote, slash, slosh - $ascii .= '\\'.$var{$c}; - break; - - case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): - // characters U-00000000 - U-0000007F (same as ASCII) - $ascii .= $var{$c}; - break; - - case (($ord_var_c & 0xE0) == 0xC0): - // characters U-00000080 - U-000007FF, mask 110XXXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, ord($var{$c + 1})); - $c += 1; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF0) == 0xE0): - // characters U-00000800 - U-0000FFFF, mask 1110XXXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2})); - $c += 2; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xF8) == 0xF0): - // characters U-00010000 - U-001FFFFF, mask 11110XXX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3})); - $c += 3; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFC) == 0xF8): - // characters U-00200000 - U-03FFFFFF, mask 111110XX - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4})); - $c += 4; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - - case (($ord_var_c & 0xFE) == 0xFC): - // characters U-04000000 - U-7FFFFFFF, mask 1111110X - // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - $char = pack('C*', $ord_var_c, - ord($var{$c + 1}), - ord($var{$c + 2}), - ord($var{$c + 3}), - ord($var{$c + 4}), - ord($var{$c + 5})); - $c += 5; - $utf16 = $this->json_utf82utf16($char); - $ascii .= sprintf('\u%04s', bin2hex($utf16)); - break; - } - } - - return '"'.$ascii.'"'; - - case 'array': - /* - * As per JSON spec if any array key is not an integer - * we must treat the the whole array as an object. We - * also try to catch a sparsely populated associative - * array with numeric keys here because some JS engines - * will create an array with empty indexes up to - * max_index which can cause memory issues and because - * the keys, which may be relevant, will be remapped - * otherwise. - * - * As per the ECMA and JSON specification an object may - * have any string as a property. Unfortunately due to - * a hole in the ECMA specification if the key is a - * ECMA reserved word or starts with a digit the - * parameter is only accessible using ECMAScript's - * bracket notation. - */ - - // treat as a JSON object - if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { - - $this->json_objectStack[] = $var; - - $properties = array_map(array($this, 'json_name_value'), - array_keys($var), - array_values($var)); - - array_pop($this->json_objectStack); - - foreach($properties as $property) { - if ($property instanceof Exception) { - return $property; - } - } - - return '{' . join(',', $properties) . '}'; - } - - $this->json_objectStack[] = $var; - - // treat it like a regular array - $elements = array_map(array($this, 'json_encode'), $var); - - array_pop($this->json_objectStack); - - foreach($elements as $element) { - if ($element instanceof Exception) { - return $element; - } - } - - return '[' . join(',', $elements) . ']'; - - case 'object': - $vars = self::encodeObject($var); - - $this->json_objectStack[] = $var; - - $properties = array_map(array($this, 'json_name_value'), - array_keys($vars), - array_values($vars)); - - array_pop($this->json_objectStack); - - foreach($properties as $property) { - if ($property instanceof Exception) { - return $property; - } - } - - return '{' . join(',', $properties) . '}'; - - default: - return null; - } - } - - /** - * array-walking function for use in generating JSON-formatted name-value pairs - * - * @param string $name name of key to use - * @param mixed $value reference to an array element to be encoded - * - * @return string JSON-formatted name-value pair, like '"name":value' - * @access private - */ - private function json_name_value($name, $value) - { - // Encoding the $GLOBALS PHP array causes an infinite loop - // if the recursion is not reset here as it contains - // a reference to itself. This is the only way I have come up - // with to stop infinite recursion in this case. - if ($name=='GLOBALS' - && is_array($value) - && array_key_exists('GLOBALS',$value)) { - $value['GLOBALS'] = '** Recursion **'; - } - - $encoded_value = $this->json_encode($value); - - if ($encoded_value instanceof Exception) { - return $encoded_value; - } - - return $this->json_encode(strval($name)) . ':' . $encoded_value; - } -} diff --git a/src/application/code/local/.placeholder b/src/application/code/local/.placeholder deleted file mode 100644 index e69de29..0000000 diff --git a/src/application/configs/local.php.sample b/src/application/configs/local.php.sample deleted file mode 100644 index 94fa83f..0000000 --- a/src/application/configs/local.php.sample +++ /dev/null @@ -1,85 +0,0 @@ - array( - 'resource' => array( - 'database' => array( - 'default' => array( - 'engine' => 'mysql', - 'options' => array( - ), - 'params' => array( - 'hostname' => 'localhost', - 'username' => 'root', - 'password' => '', - 'database' => 'db_wootook' - ), - 'table_prefix' => 'wtk_', - ), - ), - ), - ), - 'backend' => array( - 'web' => array( - 'url' => array( - 'base' => 'http://testing.wootook.org/', - 'skin' => 'http://testing.wootook.org/skin/', - 'js' => 'http://testing.wootook.org/js/', - 'css' => 'http://testing.wootook.org/css/', - ), - 'session' => array( - 'time' => 900, - 'domain' => 'testing.wootook.org', - 'path' => '/' - ) - ), - 'system' => array( - 'path' => array( - 'base' => ROOT_PATH, - 'skin' => ROOT_PATH . 'skin' . DIRECTORY_SEPARATOR, - ), - 'date' => array( - 'timezone' => 'Europe/Paris' - ), - ), - ), - 'frontend' => array( - 'web' => array( - 'url' => array( - 'base' => 'http://testing.wootook.org/', - 'skin' => 'http://testing.wootook.org/skin/', - 'js' => 'http://testing.wootook.org/js/', - 'css' => 'http://testing.wootook.org/css/', - ), - 'session' => array( - 'time' => 900, - 'domain' => 'testing.wootook.org', - 'path' => '/' - ) - ), - 'system' => array( - 'path' => array( - 'base' => ROOT_PATH, - 'skin' => ROOT_PATH . 'skin' . DIRECTORY_SEPARATOR, - ), - 'date' => array( - 'timezone' => 'Europe/Paris' - ), - ), - 'engine' => array( - 'storyline' => array( - 'universe' => 'legacies', - 'episode' => 'default', - ), - 'core' => array( - 'use_large_numbers' => true - ), - 'universe' => array( - 'galaxies' => 3, - 'systems' => 100, - 'positions' => 15 - ), - 'combat' => array( - 'allow_spy_drone_attacks' => true - ) - ), - ) - ); \ No newline at end of file diff --git a/src/application/configs/system.php b/src/application/configs/system.php deleted file mode 100644 index 8246cb4..0000000 --- a/src/application/configs/system.php +++ /dev/null @@ -1,72 +0,0 @@ - array( - 'resource' => array( - 'database' => array( - 'default' => array( - 'engine' => 'pdo_mysql', - 'options' => array( - ), - 'params' => array( - 'hostname' => 'localhost', - 'username' => 'root', - 'password' => '', - 'database' => 'db_wootook' - ), - 'table_prefix' => 'wtk_', - ), - 'core_setup' => array( - 'use' => 'default' - ), - 'core_read' => array( - 'use' => 'default' - ), - 'core_write' => array( - 'use' => 'default' - ), - ) - ) - ), - 'default' => array( - 'engine' => array( - 'core' => array( - 'use_large_numbers' => true, - ), - 'universe' => array( - 'galaxies' => 3, - 'systems' => 100, - 'positions' => 15, - ), - 'combat' => array( - 'allow_spy_drone_attacks' => true, - ) - ), - 'system' => array( - 'date' => array( - 'timezone' => 'Europe/Paris' - ), - ), - 'game' => array( - 'speed' => array( - 'general' => 1000, - 'ships' => 1000 - ), - 'home' => array( - 'title' => 'Welcome on Wootook!', - 'formated-welcome-text' => '

Wootook make you an emperor.

Conquer outer space and master other players on Wootook.

' - ) - ) - ), - 'frontend' => array( - 'layout' => array( - 'page' => 'page.xml', - 'player' => 'player.xml', - 'empire' => 'empire.xml' - ), - ), - 'backend' => array( - 'layout' => array( - 'page' => 'page.xml', - 'admin' => 'admin.php' - ), - ) - ); diff --git a/src/application/design/backend/base/default/layouts/admin.php b/src/application/design/backend/base/default/layouts/admin.php deleted file mode 100644 index ddac4e8..0000000 --- a/src/application/design/backend/base/default/layouts/admin.php +++ /dev/null @@ -1,283 +0,0 @@ - array( - 'update' => array('1column'), - 'reference' => array( - 'header' => array( - 'children' => array( - 'navigation' => array( - 'type' => 'core/html.navigation', - 'template' => 'page/html/navigation.phtml', - 'actions' => array( - array( - 'method' => 'setNodeTitle', - 'params' => array( - 'path' => 'system', - 'title' => 'System' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'system/overview', - 'label' => 'Overview', - 'title' => 'Overview', - 'uri' => 'admin/overview.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'system/settings', - 'label' => 'Settings', - 'title' => 'Settings', - 'uri' => 'admin/settings.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'system/reset-universe', - 'label' => 'Reset Universe', - 'title' => 'Reset Universe', - 'uri' => 'admin/XNovaResetUnivers.php' - ) - ), - array( - 'method' => 'setNodeTitle', - 'params' => array( - 'path' => 'players', - 'title' => 'Player Accounts' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/list', - 'label' => 'List', - 'title' => 'List', - 'uri' => 'admin/userlist.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/password-recovery', - 'label' => 'Change a password', - 'title' => 'Change a password', - 'uri' => 'admin/md5changepass.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/search', - 'label' => 'Search', - 'title' => 'Search', - 'uri' => 'admin/paneladmina.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/multi-account-alerts', - 'label' => 'Multi account alerts', - 'title' => 'Multi account alerts', - 'uri' => 'admin/multi.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/declared-multi-account', - 'label' => 'Declared multi accounts', - 'title' => 'Declared multi accounts', - 'uri' => 'admin/declare_list.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/add-resources', - 'label' => 'Add Resources', - 'title' => 'Add Resources', - 'uri' => 'admin/add_money.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/messages', - 'label' => 'Private messages management', - 'title' => 'Private messages management', - 'uri' => 'admin/messagelist.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/chat', - 'label' => 'Manage Chat', - 'title' => 'Manage Chat', - 'uri' => 'chat.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/ban', - 'label' => 'Ban Player', - 'title' => 'Ban Player', - 'uri' => 'admin/banned.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'players/unban', - 'label' => 'Unban Player', - 'title' => 'Unban Player', - 'uri' => 'admin/unbanned.php' - ) - ), - array( - 'method' => 'setNodeTitle', - 'params' => array( - 'path' => 'empire', - 'title' => 'Empires' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'empire/planet-list', - 'label' => 'Planet List', - 'title' => 'Planet List', - 'uri' => 'admin/planetlist.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'empire/moon-list', - 'label' => 'Moon List', - 'title' => 'Moon List', - 'uri' => 'admin/moonlist.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'empire/add-moon', - 'label' => 'Add a moon', - 'title' => 'Add a moon', - 'uri' => 'admin/add_moon.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'empire/planet-activity', - 'label' => 'Planet Activity', - 'title' => 'Planet Activity', - 'uri' => 'admin/activeplanet.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'empire/fleet-list', - 'label' => 'Fleet list', - 'title' => 'Fleet list', - 'uri' => 'admin/ShowFlyingFleets.php' - ) - ), - array( - 'method' => 'setNodeTitle', - 'params' => array( - 'path' => 'tools', - 'title' => 'Tools' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'tools/phpinfo', - 'label' => 'PHP Info', - 'title' => 'PHP Info', - 'uri' => 'variables.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'tools/stats', - 'label' => 'Stats updater', - 'title' => 'Stats updater', - 'uri' => 'statbuilder.php' - ) - ), - array( - 'method' => 'addLink', - 'params' => array( - 'name' => 'tools/errors', - 'label' => 'Error reporting', - 'title' => 'Error reporting', - 'uri' => 'errors.php' - ) - ), - array( - 'method' => 'addExternalLink', - 'params' => array( - 'name' => 'tools/help', - 'label' => 'Need help?', - 'title' => 'Need help?', - 'url' => 'http://wootook.org/board/' - ) - ) - ) - ) - ) - ) - ) - ), - 'admin.grid' => array( - 'update' => array('admin'), - 'reference' => array( - 'content' => array( - 'children' => array( - 'grid.container' => array( - 'type' => 'admin/grid.container', - 'template' => 'grid/container.phtml', - 'children' => array( - 'mass-actions' => array( - 'type' => 'admin/grid.mass-actions', - 'template' => 'grid/view.phtml', - ), - 'grid' => array( - 'type' => 'admin/grid.view', - 'template' => 'grid/view.phtml', - ) - ) - ) - ) - ) - ) - ), - 'admin.user.grid' => array( - 'update' => array('admin.grid'), - 'reference' => array( - 'grid' => array( - 'actions' => array( - array( - 'method' => 'addColumn', - 'params' => array( - 'name' => 'index', - 'type' => 'indexer', - 'config' => array() - ) - ) - ) - ) - ) - ) - ); diff --git a/src/application/design/backend/base/default/layouts/admin.xml b/src/application/design/backend/base/default/layouts/admin.xml deleted file mode 100644 index 18fde20..0000000 --- a/src/application/design/backend/base/default/layouts/admin.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - system - System - - - players - Player Accounts - - - - - diff --git a/src/application/design/backend/base/default/layouts/page.xml b/src/application/design/backend/base/default/layouts/page.xml deleted file mode 100644 index 6becaf2..0000000 --- a/src/application/design/backend/base/default/layouts/page.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - page/2columns-left.phtml - - - - - - - - - - page/2columns-right.phtml - - - - - - - - - - page/3columns.phtml - - - - - - - - - - css/base.css - - - css/deprecated/default.css - - - css/deprecated/formate.css - - - scripts/jquery/jquery-1.6.4.js - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/application/design/backend/base/default/scripts/deprecated/admin/overview_body.tpl b/src/application/design/backend/base/default/scripts/deprecated/admin/overview_body.tpl deleted file mode 100644 index f9220f0..0000000 --- a/src/application/design/backend/base/default/scripts/deprecated/admin/overview_body.tpl +++ /dev/null @@ -1,35 +0,0 @@ -

__('Overview')?>

- - - - - - - - -
__('General information')?>
__('Your version:')?>getData('version')?>__('Latest version avalaiable at Wootook.org')?>
- - - - - - - - - - - - - - - - - - - - - getData('adm_ov_data_table')?> - - - -
__('Online players')?>
getData('adm_ul_id')?>getData('adm_ul_name')?>getData('adm_ul_adip')?>getData('adm_ov_ally')?>getData('adm_ov_point')?>getData('adm_ov_activ')?>getData('usr_email')?>getData('xp_raid')?>getData('xp_min')?>getData('lang_vacancy')?>getData('banned_lang')?>getData('usr_current_planet')?>getData('usr_current_page')?>
getData('adm_ov_count')?>: getData('adm_ov_data_count')?>
diff --git a/src/application/design/backend/base/default/scripts/grid/container.phtml b/src/application/design/backend/base/default/scripts/grid/container.phtml deleted file mode 100644 index 7898192..0000000 --- a/src/application/design/backend/base/default/scripts/grid/container.phtml +++ /dev/null @@ -1 +0,0 @@ -a diff --git a/src/application/design/backend/base/default/scripts/page/1column.phtml b/src/application/design/backend/base/default/scripts/page/1column.phtml deleted file mode 100644 index ffaa1c8..0000000 --- a/src/application/design/backend/base/default/scripts/page/1column.phtml +++ /dev/null @@ -1,15 +0,0 @@ - - - head->render()?> - - getBodyClasses()):?> class="escape($classes)?>"> -
-
- header->render()?> -
-
- content->render()?> -
-
- - diff --git a/src/application/design/backend/base/default/scripts/page/2columns-left.phtml b/src/application/design/backend/base/default/scripts/page/2columns-left.phtml deleted file mode 100644 index 2a5d895..0000000 --- a/src/application/design/backend/base/default/scripts/page/2columns-left.phtml +++ /dev/null @@ -1,18 +0,0 @@ - - - head->render()?> - - getBodyClasses()):?> class="escape($classes)?>"> -
-
- header->render()?> -
-
- left->render()?> -
-
- content->render()?> -
-
- - diff --git a/src/application/design/backend/base/default/scripts/page/2columns-right.phtml b/src/application/design/backend/base/default/scripts/page/2columns-right.phtml deleted file mode 100644 index 95fd758..0000000 --- a/src/application/design/backend/base/default/scripts/page/2columns-right.phtml +++ /dev/null @@ -1,18 +0,0 @@ - - - head->render()?> - - getBodyClasses()):?> class="escape($classes)?>"> -
-
- header->render()?> -
-
- content->render()?> -
-
- left->render()?> -
-
- - diff --git a/src/application/design/backend/base/default/scripts/page/3columns.phtml b/src/application/design/backend/base/default/scripts/page/3columns.phtml deleted file mode 100644 index 0611279..0000000 --- a/src/application/design/backend/base/default/scripts/page/3columns.phtml +++ /dev/null @@ -1,21 +0,0 @@ - - - head->render()?> - - getBodyClasses()):?> class="escape($classes)?>"> -
-
- header->render()?> -
-
- left->render()?> -
-
- content->render()?> -
-
- left->render()?> -
-
- - diff --git a/src/application/design/backend/base/default/scripts/page/html/navigation.phtml b/src/application/design/backend/base/default/scripts/page/html/navigation.phtml deleted file mode 100644 index 612ee09..0000000 --- a/src/application/design/backend/base/default/scripts/page/html/navigation.phtml +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/src/application/design/backend/base/default/scripts/page/html/navigation/link.phtml b/src/application/design/backend/base/default/scripts/page/html/navigation/link.phtml deleted file mode 100644 index 4fa6fc8..0000000 --- a/src/application/design/backend/base/default/scripts/page/html/navigation/link.phtml +++ /dev/null @@ -1,3 +0,0 @@ - - getAttributes() as $attributeName => $attributeValue):?> ="">escape($this->getLabel())?> - diff --git a/src/application/design/backend/base/default/scripts/page/html/navigation/node.phtml b/src/application/design/backend/base/default/scripts/page/html/navigation/node.phtml deleted file mode 100644 index 266fae4..0000000 --- a/src/application/design/backend/base/default/scripts/page/html/navigation/node.phtml +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/src/application/design/frontend/base/default/layouts/empire.xml b/src/application/design/frontend/base/default/layouts/empire.xml deleted file mode 100644 index f18da5b..0000000 --- a/src/application/design/frontend/base/default/layouts/empire.xml +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - planet - Planet - - - universe - Universe - - - account - My Account - - - tools - Tools - - - community - Community - - - planet/overview - Overview - Overview - player/overview - - - planet/buildings - Buildings - Buildings - empire/buildings - - - planet/research-lab - Research Lab - Research Lab - legacies-empire/research-lab - - - planet/shipyard - Shipyard - Shipyard - legacies-empire/shipyard - - - planet/defenses - Defenses - Defenses - legacies-empire/defense - - - universe/galaxy - Check out the Galaxy - Check out the Galaxy - galaxy.php - - - universe/fleet - Send a Fleet - Send a Fleet - fleet.php - - - universe/retailer - Retailer - Retailer - marchand.php - - - universe/records - All Records - All Records - records.php - - - universe/statistics - My Stats - My Stats - stat.php - - - universe/search-player - Search a Player - Search a Player - search.php - - - universe/empire - Empire - Empire - imperium.php - - - account/alliance - My Alliance - My Alliance - alliance.php - - - account/messages - My Messages - My Messages - messages.php - - - account/resources - My Resources Production - My Resources Production - resources.php - - - account/tech-tree - Technology Tree - Technology Tree - techtree.php - - - tools/notes - Note Pad - Note Pad - notes.php - - - tools/options - Account Options - Account Options - options.php - - - tools/logout - Log Out - Log Out - player/account/logout - - - community/board - Forum board - Forum board - http://wootook.org/board/ - - - community/chat - Chat - Chat - chat.php - - - community/announcement - Announcements - Announcements - annonce.php - - - community/multi - Declare Multi-account - Declare Multi-account - delclare_multi.php - - - community/rules - Rules - Rules - rules.php - - - community/contact - Contact Admin - Contact Admin - contact.php - - - community/banned - Banned Players - Banned Players - banned.php - - - - - - - - - - - - - - - - - - - - - - - overview - - - - - - - - - - player/overview/fleet/item.phtml - - - empire/overview.fleet.list.item - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - empire/planet/buildings/queue/item.phtml - - - empire/planet.buildings.queue.item - - - - - - empire/planet/buildings/item.phtml - - - empire/planet.buildings.item - - - - - - - - - - - - - empire/planet/shipyard/queue/item.phtml - - - legacies-empire/planet.shipyard.queue.item - - - - - - empire/planet/shipyard/item.phtml - - - legacies-empire/planet.shipyard.item - - - - - - - - - - - - - - - - - - - - - - - empire/planet/research-lab/queue/item.phtml - - - legacies-empire/planet.research-lab.queue.item - - - - - - empire/planet/research-lab/item.phtml - - - legacies-empire/planet.research-lab.item - - - - - diff --git a/src/application/design/frontend/base/default/layouts/page.xml b/src/application/design/frontend/base/default/layouts/page.xml deleted file mode 100644 index b2975e7..0000000 --- a/src/application/design/frontend/base/default/layouts/page.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - page/2columns-left.phtml - - - - - - - - - - page/2columns-right.phtml - - - - - - - - - - page/3columns.phtml - - - - - - - - - - css/deprecated/default.css - - - css/deprecated/formate.css - - - css/base.css - - - scripts/jquery/jquery-1.6.4.js - - - Wootook! - - - - - - - - - - - public - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Not Found - - - - - - - - - - home - - - public-form - - - - - - Welcome - - - - - - - - diff --git a/src/application/design/frontend/base/default/layouts/player.xml b/src/application/design/frontend/base/default/layouts/player.xml deleted file mode 100644 index 16bd812..0000000 --- a/src/application/design/frontend/base/default/layouts/player.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - login - - - public-form - - - - - - Log in - - - - - - - - - - - - - - - registration - - - public-form - - - - - - Register - - - - - - - - - - - - - - - lost-password - - - public-form - - - - - - Lost your password? - - - - - - - - diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws.tpl b/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws.tpl deleted file mode 100644 index b557fbf..0000000 --- a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws.tpl +++ /dev/null @@ -1,71 +0,0 @@ -
- - -getData('list')?> - - -
getData('Configure_laws')?>
- -
- -
- - - - - - - - - - - -
getData('Range_make')?>
getData('Range_name')?>
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getData('Law_leyends')?>
getData('Alliance_dissolve')?>
getData('Expel_users')?>
getData('See_the_requests')?>
getData('See_the_list_members')?>
getData('Check_the_requests')?>
getData('Alliance_admin')?>
getData('See_the_online_list_member')?>
getData('Make_a_circular_message')?>
getData('Left_hand_text')?>
getData('Return_to_overview')?>
-
diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws_head.tpl b/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws_head.tpl deleted file mode 100644 index 9afc37c..0000000 --- a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws_head.tpl +++ /dev/null @@ -1,15 +0,0 @@ -
-
- - - getData('Range_name')?> - - - - - - - - - - diff --git a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws_row.tpl b/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws_row.tpl deleted file mode 100644 index e1c8f57..0000000 --- a/src/application/design/frontend/base/default/scripts/deprecated/alliance_admin_laws_row.tpl +++ /dev/null @@ -1,21 +0,0 @@ - - - getData('a') > 0):?> - - <?php echo $this->__('Remove rank')?> - - - - - getData('r0')?> - getData('r1')?> - getData('r2')?> - getData('r3')?> - getData('r4')?> - getData('r5')?> - getData('r6')?> - getData('r7')?> - getData('r8')?> - getData('r9')?> - - \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/buildings.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/buildings.phtml deleted file mode 100644 index e2e2580..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/buildings.phtml +++ /dev/null @@ -1,28 +0,0 @@ -
-

__('Buildings')?>

- getPartial('item-list.items')->render()?> -
-
- \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/buildings/item.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/buildings/item.phtml deleted file mode 100644 index 1d3fb40..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/buildings/item.phtml +++ /dev/null @@ -1,36 +0,0 @@ - -
-
-

escape($this->getName())?>

-

__('Level %d', $this->renderNumber($this->getLevel()))?>

-
-
- - isBuildable()):?> -
-

__('Resources Needed')?>

-
- - - -
-

getDescription()?>

-
    - getResourcesConfigForNextLevel() as $resourceId => $resourceConfig):?> -
  • - getResourceName($resourceId)?> - renderNumber($resourceConfig->getData('value'))?> - hasData('requirement')):?> - (renderNumber($resourceConfig->getData('requirement'))?>) - - (renderNumber($resourceConfig->getData('overflow'))?>) - -
  • - -
-

__('Building time: %s', $this->renderTime($this->getBuildingTimeForNextLevel(), true))?> -

-
-
diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/buildings/queue.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/buildings/queue.phtml deleted file mode 100644 index 0549d6c..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/buildings/queue.phtml +++ /dev/null @@ -1,6 +0,0 @@ -isEmpty()):?> -
-

__('Work in progress')?>

-renderPartial('item-list') ?> -
- diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/buildings/queue/item.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/buildings/queue/item.phtml deleted file mode 100644 index 827f75f..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/buildings/queue/item.phtml +++ /dev/null @@ -1,11 +0,0 @@ - -
-

- - escape($this->getName())?> (renderNumber($this->getItemQueuedLevel())?>) -

-

__('Lasts %s', $this->renderTime($this->getBuildingRemainingTime()))?>

- -
diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/research-lab.phtml deleted file mode 100644 index d5a743a..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab.phtml +++ /dev/null @@ -1,19 +0,0 @@ -
-

__('Research Laboratory')?>

- getPartial('item-list.items')->render()?> -
-
- \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/item.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/item.phtml deleted file mode 100644 index 552f840..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/item.phtml +++ /dev/null @@ -1,30 +0,0 @@ - -
-
-

escape($this->getName())?>

-

__('Level %d', $this->renderNumber($this->getLevel()))?>

-
-
- - -
-

getDescription()?>

-
    - getResourcesConfigForNextLevel() as $resourceId => $resourceConfig):?> -
  • - getResourceName($resourceId)?> - renderNumber($resourceConfig->getData('value'))?> - hasData('requirement')):?> - (renderNumber($resourceConfig->getData('requirement'))?>) - - (renderNumber($resourceConfig->getData('overflow'))?>) - -
  • - -
-

__('Building time: %s', $this->renderTime($this->getBuildingTimeForNextLevel(), false))?> -

-
-
diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue/item.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue/item.phtml deleted file mode 100644 index ac60627..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue/item.phtml +++ /dev/null @@ -1,11 +0,0 @@ - -
-

- - escape($this->getName())?> (renderNumber($this->getItemQueuedLevel())?>) -

-

__('Lasts %s', $this->renderTime($this->getBuildingRemainingTime()))?>

- -
diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/shipyard.phtml deleted file mode 100644 index 6b75a1a..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard.phtml +++ /dev/null @@ -1,31 +0,0 @@ -
-

__('Shipyard')?>

- - getPartial('item-list.items')->render()?> - - -
- -
diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/item.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/item.phtml deleted file mode 100644 index ec6e2b0..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/item.phtml +++ /dev/null @@ -1,35 +0,0 @@ - -
-
-

escape($this->getName())?>

-

__('Class %s', $this->escape($this->getClass()))?>

-

__('Current count: %s', $this->renderNumber($this->getQty()))?>

-
-
- -
-

- -
- -
-

getDescription()?>

-
    - getResourcesConfigForQty(1) as $resourceId => $resourceConfig):?> -
  • - getResourceName($resourceId)?> - renderNumber($resourceConfig->getData('value'))?> - hasData('requirement')):?> - (renderNumber($resourceConfig->getData('requirement'))?>) - - (renderNumber($resourceConfig->getData('overflow'))?>) - -
  • - -
-

__('Building time: %s', $this->renderTime($this->getBuildingTime(1), false))?> -

-
-
diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/queue/item.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/queue/item.phtml deleted file mode 100644 index 5592945..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/queue/item.phtml +++ /dev/null @@ -1,8 +0,0 @@ - -
-

- - escape($this->getName())?> (renderNumber($this->getItemQueuedQty())?>) -

-

__('Lasts %s', $this->renderTime($this->getBuildingRemainingTime()))?>

-
diff --git a/src/application/design/frontend/base/default/scripts/empire/topnav.phtml b/src/application/design/frontend/base/default/scripts/empire/topnav.phtml deleted file mode 100644 index cd3877b..0000000 --- a/src/application/design/frontend/base/default/scripts/empire/topnav.phtml +++ /dev/null @@ -1,95 +0,0 @@ -getCurrentPlanet();?> -
-
-getPlanetCollection() as $planet):?> - getId() != $currentPlanet->getId()):?> - - -
-

escape($planet->getName())?>

-
- getMoon()) !== null): ?> - - - - - - - -
-

[escape($planet->getCoords())?>]

-
- - -
-
-
-
-
-
- <?php echo $this->__('Metal')?> -

- getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_METAL)):?> - renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?> - - renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?> - -

-
-
- <?php echo $this->__('Cristal')?> -

- getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_CRISTAL)):?> - renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?> - - renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?> - -

-
-
- <?php echo $this->__('Deuterium')?> -

- getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_DEUTERIUM)):?> - renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?> - - renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?> - -

-
-
- <?php echo $this->__('Energy')?> -

- getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_ENERGY)):?> - renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?> - - renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?> - -

-
-
- <?php echo $this->__('Messages')?> -

- getCurrentPlayer()->getNewMessagesCount()) > 1):?> - __('%1$d messages.', $count)?> - - __('1 message.')?> - - __('No message.')?> - -

-
-
-
diff --git a/src/application/design/frontend/base/default/scripts/page/1column.phtml b/src/application/design/frontend/base/default/scripts/page/1column.phtml deleted file mode 100644 index ffaa1c8..0000000 --- a/src/application/design/frontend/base/default/scripts/page/1column.phtml +++ /dev/null @@ -1,15 +0,0 @@ - - - head->render()?> - - getBodyClasses()):?> class="escape($classes)?>"> -
-
- header->render()?> -
-
- content->render()?> -
-
- - diff --git a/src/application/design/frontend/base/default/scripts/page/2columns-left.phtml b/src/application/design/frontend/base/default/scripts/page/2columns-left.phtml deleted file mode 100644 index c2a4134..0000000 --- a/src/application/design/frontend/base/default/scripts/page/2columns-left.phtml +++ /dev/null @@ -1,21 +0,0 @@ - - - head->render()?> - - getBodyClasses()):?> class="escape($classes)?>"> -
-
- header->render()?> -
-
-
- left->render()?> -
-
- content->render()?> -
-
-
-
- - diff --git a/src/application/design/frontend/base/default/scripts/page/2columns-right.phtml b/src/application/design/frontend/base/default/scripts/page/2columns-right.phtml deleted file mode 100644 index 946e2c1..0000000 --- a/src/application/design/frontend/base/default/scripts/page/2columns-right.phtml +++ /dev/null @@ -1,21 +0,0 @@ - - - head->render()?> - - getBodyClasses()):?> class="escape($classes)?>"> -
-
- header->render()?> -
-
-
- content->render()?> -
-
- left->render()?> -
-
-
-
- - diff --git a/src/application/design/frontend/base/default/scripts/page/3columns.phtml b/src/application/design/frontend/base/default/scripts/page/3columns.phtml deleted file mode 100644 index 1b1248a..0000000 --- a/src/application/design/frontend/base/default/scripts/page/3columns.phtml +++ /dev/null @@ -1,24 +0,0 @@ - - - head->render()?> - - getBodyClasses()):?> class="escape($classes)?>"> -
-
- header->render()?> -
-
-
- left->render()?> -
-
- content->render()?> -
-
- left->render()?> -
-
-
-
- - diff --git a/src/application/design/frontend/base/default/scripts/page/html/head.phtml b/src/application/design/frontend/base/default/scripts/page/html/head.phtml deleted file mode 100644 index cb74234..0000000 --- a/src/application/design/frontend/base/default/scripts/page/html/head.phtml +++ /dev/null @@ -1,34 +0,0 @@ -<?php echo $this->escape($this->getTitle())?> - -getCss() as $css):?> - - -getInlineCss() as $css):?> - - - -getJs() as $js):?> - - -getSkinJs() as $js):?> - - -getInlineJs() as $js):?> - - - \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/page/html/home.phtml b/src/application/design/frontend/base/default/scripts/page/html/home.phtml deleted file mode 100644 index 2970804..0000000 --- a/src/application/design/frontend/base/default/scripts/page/html/home.phtml +++ /dev/null @@ -1,7 +0,0 @@ - -getLayout()->getMessagesBlock()->renderGroupedHtml()?> -
-

getTitle()?>

-

getFormatedWelcomeText()?>

- -
diff --git a/src/application/design/frontend/base/default/scripts/page/html/message.phtml b/src/application/design/frontend/base/default/scripts/page/html/message.phtml deleted file mode 100644 index 1f3c4c9..0000000 --- a/src/application/design/frontend/base/default/scripts/page/html/message.phtml +++ /dev/null @@ -1,4 +0,0 @@ -
-

escape($this->getData('title'))?>

-

escape($this->getData('message'))?>

-
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/page/html/navigation.phtml b/src/application/design/frontend/base/default/scripts/page/html/navigation.phtml deleted file mode 100644 index 612ee09..0000000 --- a/src/application/design/frontend/base/default/scripts/page/html/navigation.phtml +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/src/application/design/frontend/base/default/scripts/page/html/navigation/link.phtml b/src/application/design/frontend/base/default/scripts/page/html/navigation/link.phtml deleted file mode 100644 index 4fa6fc8..0000000 --- a/src/application/design/frontend/base/default/scripts/page/html/navigation/link.phtml +++ /dev/null @@ -1,3 +0,0 @@ - - getAttributes() as $attributeName => $attributeValue):?> ="">escape($this->getLabel())?> - diff --git a/src/application/design/frontend/base/default/scripts/page/html/navigation/node.phtml b/src/application/design/frontend/base/default/scripts/page/html/navigation/node.phtml deleted file mode 100644 index 266fae4..0000000 --- a/src/application/design/frontend/base/default/scripts/page/html/navigation/node.phtml +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/page/html/no-route.phtml b/src/application/design/frontend/base/default/scripts/page/html/no-route.phtml deleted file mode 100644 index 9a65c8b..0000000 --- a/src/application/design/frontend/base/default/scripts/page/html/no-route.phtml +++ /dev/null @@ -1,5 +0,0 @@ -
-

__('Not found')?>

-

__('The page you requested could not be found, please check your input.')?>

-

__('Back to the home page.')?>

-
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/page/html/top-bar.phtml b/src/application/design/frontend/base/default/scripts/page/html/top-bar.phtml deleted file mode 100644 index 8fffea9..0000000 --- a/src/application/design/frontend/base/default/scripts/page/html/top-bar.phtml +++ /dev/null @@ -1,14 +0,0 @@ -
-
- isLoggedIn()):?> - - __('Register')?> - __('There are %d registered players', $this->getPlayerCount())?> - - __('Logged in as %s', $this->escape($this->getPlayer()->getUsername()))?> - __('Logout')?> - __('Back to the game')?> - - __('There are %d online players', $this->getOnlinePlayerCount())?> -
-
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/player/login.phtml b/src/application/design/frontend/base/default/scripts/player/login.phtml deleted file mode 100644 index c4222de..0000000 --- a/src/application/design/frontend/base/default/scripts/player/login.phtml +++ /dev/null @@ -1,24 +0,0 @@ -getLayout()->getMessagesBlock()->renderGroupedHtml()?> -
-
- __('Login')?> -

- - -

-

- - -

-

- - -

-

- __('I have lost my password.')?> -

-
-

- -

-
diff --git a/src/application/design/frontend/base/default/scripts/player/lost-password.phtml b/src/application/design/frontend/base/default/scripts/player/lost-password.phtml deleted file mode 100644 index f44b287..0000000 --- a/src/application/design/frontend/base/default/scripts/player/lost-password.phtml +++ /dev/null @@ -1,17 +0,0 @@ -getLayout()->getMessagesBlock()->renderGroupedHtml()?> -
-
- __('Lost your password?')?> -

- - -

- -
-

- -

-
diff --git a/src/application/design/frontend/base/default/scripts/player/overview.phtml b/src/application/design/frontend/base/default/scripts/player/overview.phtml deleted file mode 100644 index 67eb785..0000000 --- a/src/application/design/frontend/base/default/scripts/player/overview.phtml +++ /dev/null @@ -1,11 +0,0 @@ -getLayout()->getMessagesBlock()->renderGroupedHtml()?> -
-

__('Overview')?>

-
- renderPartial('overview.left')?> -
-
- renderPartial('overview.center')?> -
-
-
diff --git a/src/application/design/frontend/base/default/scripts/player/overview/fleet/item.phtml b/src/application/design/frontend/base/default/scripts/player/overview/fleet/item.phtml deleted file mode 100644 index f66e128..0000000 --- a/src/application/design/frontend/base/default/scripts/player/overview/fleet/item.phtml +++ /dev/null @@ -1,39 +0,0 @@ -
- renderDateTime($this->getStartTime())?> - renderDateTime($this->getActionTime())?> - renderDateTime($this->getArrivalTime())?> -
- getPlayer() ?> - isOwner() && ($this->isMission(Legacies_Empire::ID_MISSION_TRANSPORT) || $this->isMission(Legacies_Empire::ID_MISSION_STATION) || $this->isMission(Legacies_Empire::ID_MISSION_STATION_ALLY))):?> - - __('An hostile fleet sent by %1$s, coming from %2$s[%3$s], reaches your planet %4$s[%5$s]. It has been sent with the mission: %6$s', - implode(', ', $this->getFleetOwnerUsernames()), - $this->getOriginPlanetName(), $this->getOriginPlanetCoords(), - $this->getDestinationPlanetName(), $this->getDestinationPlanetCoords(), - $this->getMissionLabel())?> - - isOwner() && ($this->isMission(Legacies_Empire::ID_MISSION_ATTACK) || $this->isMission(Legacies_Empire::ID_MISSION_GROUP_ATTACK) || $this->isMission(Legacies_Empire::ID_MISSION_DESTROY) || $this->isMission(Legacies_Empire::ID_MISSION_MISSILES) || $this->isMission(Legacies_Empire::ID_MISSION_SPY))):?> - - __('Your hostile fleet sent from %1$s[%2$s], reaches %3$s\'s planet %4$s[%5$s]. It has been sent with the mission: %6$s', - $this->getOriginPlanetName(), $this->getOriginPlanetCoords(), - implode(', ', $this->getFleetOwnerUsernames()), - $this->getDestinationPlanetName(), $this->getDestinationPlanetCoords(), - $this->getMissionLabel())?> - - isOwner()):?> - - __('Your peaceful fleet sent from %1$s[%2$s], reaches the planet %3$s[%4$s]. It has been sent with the mission: %5$s', - $this->getOriginPlanetName(), $this->getOriginPlanetCoords(), - $this->getDestinationPlanetName(), $this->getDestinationPlanetCoords(), - $this->getMissionLabel())?> - - - - __('A peaceful fleet sent by %1$s, coming from %2$s[%3$s], reaches the planet %4$s[%5$s]. It has been sent with the mission: %6$s', - implode(', ', $this->getFleetOwnerUsernames()), - $this->getOriginPlanetName(), $this->getOriginPlanetCoords(), - $this->getDestinationPlanetName(), $this->getDestinationPlanetCoords(), - $this->getMissionLabel())?> - -
-
diff --git a/src/application/design/frontend/base/default/scripts/player/overview/fleet/list.phtml b/src/application/design/frontend/base/default/scripts/player/overview/fleet/list.phtml deleted file mode 100644 index d5d0e4e..0000000 --- a/src/application/design/frontend/base/default/scripts/player/overview/fleet/list.phtml +++ /dev/null @@ -1,9 +0,0 @@ -
-

__('Fleets') ?>

- getFleetCollection()?> - getSize() > 0): ?> - renderPartial('item-list')?> - -

__('There are currently no fleets.')?>

- -
diff --git a/src/application/design/frontend/base/default/scripts/player/overview/form/rename-planet.phtml b/src/application/design/frontend/base/default/scripts/player/overview/form/rename-planet.phtml deleted file mode 100644 index 94f0148..0000000 --- a/src/application/design/frontend/base/default/scripts/player/overview/form/rename-planet.phtml +++ /dev/null @@ -1,16 +0,0 @@ -
-
- -

- - -

-

- - -

-

- -

-
-
\ No newline at end of file diff --git a/src/application/design/frontend/base/default/scripts/player/overview/planet/list/item.phtml b/src/application/design/frontend/base/default/scripts/player/overview/planet/list/item.phtml deleted file mode 100644 index 44b2fd5..0000000 --- a/src/application/design/frontend/base/default/scripts/player/overview/planet/list/item.phtml +++ /dev/null @@ -1,14 +0,0 @@ - -

escape($this['planet']->getData('name'))?>

-

- -

- count() > 0):?> -

escape($this['queue_item']->getData('building_id'))?>

- -

__('Idle.')?>

- - - - - diff --git a/src/application/design/frontend/base/default/scripts/player/overview/planet/mini.phtml b/src/application/design/frontend/base/default/scripts/player/overview/planet/mini.phtml deleted file mode 100644 index c30fdda..0000000 --- a/src/application/design/frontend/base/default/scripts/player/overview/planet/mini.phtml +++ /dev/null @@ -1,7 +0,0 @@ -
-

escape($this->getPlanetName())?>

-

escape($this->getPlanetCoords())?>

-

- -

-
diff --git a/src/application/design/frontend/base/default/scripts/player/overview/planet/view.phtml b/src/application/design/frontend/base/default/scripts/player/overview/planet/view.phtml deleted file mode 100644 index c4a724d..0000000 --- a/src/application/design/frontend/base/default/scripts/player/overview/planet/view.phtml +++ /dev/null @@ -1 +0,0 @@ -renderPartial('planet-list') ?> diff --git a/src/application/design/frontend/base/default/scripts/player/overview/stats/mini.phtml b/src/application/design/frontend/base/default/scripts/player/overview/stats/mini.phtml deleted file mode 100644 index 6ca6d7d..0000000 --- a/src/application/design/frontend/base/default/scripts/player/overview/stats/mini.phtml +++ /dev/null @@ -1,8 +0,0 @@ -
-

__('Your statistics')?>

-
    - getPlayerStatData() as $stat): ?> -
  • - -
-
diff --git a/src/application/design/install/base/default/layouts/install.php b/src/application/design/install/base/default/layouts/install.php deleted file mode 100644 index 4778442..0000000 --- a/src/application/design/install/base/default/layouts/install.php +++ /dev/null @@ -1,165 +0,0 @@ - array( - 'update' => array('2columns-left'), - 'reference' => array( - 'content' => array( - 'children' => array( - 'status' => array( - 'type' => 'core/template', - 'template' => 'status.phtml' - ) - ) - ) - ) - ), - - 'install.intro' => array( - 'update' => array('install'), - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'intro.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 0 - ) - ) - ) - ) - ) - ), - - 'install.step.system' => array( - 'update' => array('install'), - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'step/system.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 1 - ) - ) - ) - ) - ) - ), - - 'install.step.database' => array( - 'update' => array('install'), - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'step/database.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 2 - ) - ) - ) - ) - ) - ), - - 'install.step.universe' => array( - 'update' => array('install'), - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'step/universe.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 3 - ) - ) - ) - ) - ) - ), - - 'install.step.profile' => array( - 'update' => array('install'), - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'step/profile.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 4 - ) - ) - ) - ) - ) - ), - - 'install.summary' => array( - 'update' => array('install'), - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'summary.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 5 - ) - ) - ) - ) - ) - ), - ); diff --git a/src/application/design/install/base/default/layouts/page.xml b/src/application/design/install/base/default/layouts/page.xml deleted file mode 100644 index e0837eb..0000000 --- a/src/application/design/install/base/default/layouts/page.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - page/2columns-left.phtml - - - - - - - - - - page/2columns-right.phtml - - - - - - - - - - page/3columns.phtml - - - - - - - - - - css/base.css - - - scripts/jquery/jquery-1.6.4.js - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/intro.phtml b/src/application/design/install/base/default/scripts/intro.phtml deleted file mode 100644 index 59beb4c..0000000 --- a/src/application/design/install/base/default/scripts/intro.phtml +++ /dev/null @@ -1,7 +0,0 @@ -
-

__('Welcome to the Wootook! installer')?>

- getLayout()->getMessagesblock()->renderGroupedHtml()?> -

__('This page will guide you through the installation proces of Wootook! the MMO game engine platform.')?>

-

__('Feel free to ask for help at any time at wootook.org.', 'http://wootook.org/board/')?>

-

-
\ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/page/html/head.phtml b/src/application/design/install/base/default/scripts/page/html/head.phtml deleted file mode 100644 index b98b464..0000000 --- a/src/application/design/install/base/default/scripts/page/html/head.phtml +++ /dev/null @@ -1,26 +0,0 @@ -<?php echo $this->escape($this->getTitle())?> - -getCss() as $css):?> - - -getInlineCss() as $css):?> - - - -getJs() as $js):?> - - -getSkinJs() as $js):?> - - -getInlineJs() as $js):?> - - \ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/page/html/message.phtml b/src/application/design/install/base/default/scripts/page/html/message.phtml deleted file mode 100644 index 1f3c4c9..0000000 --- a/src/application/design/install/base/default/scripts/page/html/message.phtml +++ /dev/null @@ -1,4 +0,0 @@ -
-

escape($this->getData('title'))?>

-

escape($this->getData('message'))?>

-
\ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/page/html/navigation.phtml b/src/application/design/install/base/default/scripts/page/html/navigation.phtml deleted file mode 100644 index 1d00580..0000000 --- a/src/application/design/install/base/default/scripts/page/html/navigation.phtml +++ /dev/null @@ -1,18 +0,0 @@ - - diff --git a/src/application/design/install/base/default/scripts/page/html/navigation/link.phtml b/src/application/design/install/base/default/scripts/page/html/navigation/link.phtml deleted file mode 100644 index 4fa6fc8..0000000 --- a/src/application/design/install/base/default/scripts/page/html/navigation/link.phtml +++ /dev/null @@ -1,3 +0,0 @@ - - getAttributes() as $attributeName => $attributeValue):?> ="">escape($this->getLabel())?> - diff --git a/src/application/design/install/base/default/scripts/page/html/navigation/node.phtml b/src/application/design/install/base/default/scripts/page/html/navigation/node.phtml deleted file mode 100644 index bce2e23..0000000 --- a/src/application/design/install/base/default/scripts/page/html/navigation/node.phtml +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/status.phtml b/src/application/design/install/base/default/scripts/status.phtml deleted file mode 100644 index 89d29d3..0000000 --- a/src/application/design/install/base/default/scripts/status.phtml +++ /dev/null @@ -1,9 +0,0 @@ -
- getData('step')?> -

__('Welcome')?>

-

__('System')?>

-

__('Database')?>

-

__('Universe')?>

-

__('Admin profile')?>

-

__('Summary')?>

-
\ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/step/database.phtml b/src/application/design/install/base/default/scripts/step/database.phtml deleted file mode 100644 index 7adaf52..0000000 --- a/src/application/design/install/base/default/scripts/step/database.phtml +++ /dev/null @@ -1,65 +0,0 @@ - -
-

__('Welcome to the Wootook! installer')?>

-

__('Database Config')?>

- getLayout()->getMessagesblock()->renderGroupedHtml()?> -
- -

- - -

-

- - -

-

- - -

-

- - -

-

- - -

-

- - -

-

- - -

-
-
-
- \ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/step/profile.phtml b/src/application/design/install/base/default/scripts/step/profile.phtml deleted file mode 100644 index b8cccf4..0000000 --- a/src/application/design/install/base/default/scripts/step/profile.phtml +++ /dev/null @@ -1,30 +0,0 @@ - -
-

__('Welcome to the Wootook! installer')?>

-

__('Admin Profile Config')?>

- getLayout()->getMessagesblock()->renderGroupedHtml()?> -
- -

- - -

-

- - -

-

- - -

-

- - -

-

- - -

-

-
-
\ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/step/system.phtml b/src/application/design/install/base/default/scripts/step/system.phtml deleted file mode 100644 index 7978c32..0000000 --- a/src/application/design/install/base/default/scripts/step/system.phtml +++ /dev/null @@ -1,477 +0,0 @@ - -
-

__('Welcome to the Wootook! installer')?>

-

__('System Config')?>

- getLayout()->getMessagesblock()->renderGroupedHtml()?> -
- -

- - -

-

- - -

-

-
-
\ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/step/universe.phtml b/src/application/design/install/base/default/scripts/step/universe.phtml deleted file mode 100644 index 9bcc975..0000000 --- a/src/application/design/install/base/default/scripts/step/universe.phtml +++ /dev/null @@ -1,37 +0,0 @@ - -
-

__('Welcome to the Wootook! installer')?>

-

__('Universe Config')?>

- getLayout()->getMessagesblock()->renderGroupedHtml()?> -
- -

- - -

-

- - -

-

- - -

-

- - getFormData('allow_spy_drone_attacks', true)):?>checked="checked" name="allow_spy_drone_attacks" value="1" /> -

-

- - - getFormData('use_large_numbers', true)):?>checked="checked" name="use_large_numbers" value="1" /> - - getFormData('use_large_numbers', false)):?>checked="checked" name="use_large_numbers" value="1" /> - __("'BC Math' extension is unavailable. This option will have no effect until the extension isn't active.")?> - -

-

- -

-
-
\ No newline at end of file diff --git a/src/application/design/install/base/default/scripts/summary.phtml b/src/application/design/install/base/default/scripts/summary.phtml deleted file mode 100644 index 662dfc3..0000000 --- a/src/application/design/install/base/default/scripts/summary.phtml +++ /dev/null @@ -1,7 +0,0 @@ -
-

__('Wootook! was successfully installed.')?>

- getLayout()->getMessagesblock()->renderGroupedHtml()?> -

__('You can now play at %s and tell your friends to come and play.', Wootook::getBaseUrl())?>

-

__('Feel free to ask for help at any time at wootook.org.', 'http://wootook.org/board/')?>

-

-
\ No newline at end of file diff --git a/src/application/gamedata/default/default/combat.php b/src/application/gamedata/default/default/combat.php deleted file mode 100644 index 8d931c7..0000000 --- a/src/application/gamedata/default/default/combat.php +++ /dev/null @@ -1 +0,0 @@ - array( - 'core' => array('Wootook_Core_Block_' => 'Wootook/Core/Block'), - 'empire' => array('Wootook_Empire_Block_' => 'Wootook/Empire/Block') - ) - ); \ No newline at end of file diff --git a/src/application/gamedata/default/default/prices.php b/src/application/gamedata/default/default/prices.php deleted file mode 100644 index dfd324f..0000000 --- a/src/application/gamedata/default/default/prices.php +++ /dev/null @@ -1,2 +0,0 @@ - array(), - 'layout.prepare.after' => array( - array('Wootook_Player_Model_Entity', 'layoutPrepareAfterListener') - ), - 'login.failure' => array(), - 'login.success' => array(), - 'logout.success' => array(), - 'register.before' => array(), - 'register.failure' => array(), - 'register.success' => array(), - 'user.init' => array(), - 'planet.init' => array( - array('Wootook_Empire_Model_Galaxy_Position', 'initPlanetListerner') - ), - 'planet.update' => array( - array('Wootook_Empire_Model_Planet', 'planetUpdateListener'), - array('Legacies_Empire_Model_Planet_Building_Shipyard', 'planetUpdateListener'), - 'flyingFleetListener' - ), - 'planet.shipyard.check-availability' => array(), - 'planet.shipyard.update-queue.before' => array(), - 'planet.shipyard.update-queue.after' => array(), - 'planet.shipyard.append-queue.before' => array(), - 'planet.shipyard.append-queue.after' => array(), - 'planet.building.building-time' => array(), - 'planet.shipyard.building-time' => array(), - 'planet.building.speed-enhancement' => array( - array('Legacies_Empire_Model_Planet_Building_NaniteFactory', 'buildingEnhancementListener'), - array('Legacies_Empire_Model_Planet_Building_RoboticFactory', 'buildingEnhancementListener') - ), - 'planet.shipyard.speed-enhancement' => array( - array('Legacies_Empire_Model_Planet_Building_NaniteFactory', 'buildingEnhancementListener'), - array('Legacies_Empire_Model_Planet_Building_RoboticFactory', 'buildingEnhancementListener') - ), - 'planet.research-lab.technology.speed-enhancement' => array( - array('Legacies_Empire_Model_Player_Technology_IntergalacticResearchNetwork', 'researchTechnologyEnhancementListener') - ), - 'core.mvc.controller.front.pre-dispatch' => array( - array('Wootook_Empire_Model_Planet', 'planetChangeListener') - ) - ); diff --git a/src/application/gamedata/legacies/default/locale/fr_FR/labels.php b/src/application/gamedata/legacies/default/locale/fr_FR/labels.php deleted file mode 100644 index ab43b0a..0000000 --- a/src/application/gamedata/legacies/default/locale/fr_FR/labels.php +++ /dev/null @@ -1,415 +0,0 @@ - array( - 'name' => 'Mine de métal', - 'description' => "

La mine de métal exploite les profondeurs géologiques à la recherche de ressources riches en métaux, puis les raffine et crée ensuite les alliages les plus solides.

Principales matières premières pour la construction de structures planétaires et de vaisseaux, les métaux permettent d'asseoir votre domination sur l'univers.

", - 'image' => 'medias/klore/images/building/metal-mine.jpg' - ), - - Legacies_Empire::ID_BUILDING_CRISTAL_MINE => array( - 'name' => 'Mine de cristal', - 'description' => "

La mine de cristal développe l'exploitation des minéraux entrant dans la comosition des systèmes électroniques.

Ces matériaux vous permettront d'augmenter la capacité de calculs de vos laboratoires ainsi que de ceux de vos systèmes de combat.

", - 'image' => 'medias/klore/images/building/cristal-mine.jpg' - ), - - Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => array( - 'name' => "Synthétiseur de deutérium", - 'description' => "

Le synthétiseur de deutérium permet d'exploiter les sources d'hydrogène lourd. Disponible en faible quantité sur les planètes telluriques et plus répandu sur les planètes géantes gazeuses, le deutérium et tritium composent votre principale source d'hydrogène lourd.

", - 'image' => 'medias/klore/images/building/deuterium-syntherizer.jpg' - ), - - Legacies_Empire::ID_BUILDING_SOLAR_PLANT => array( - 'name' => 'Centrale électrique solaire', - 'description' => "

La centrale électrique solaire est la source d'énergie la plus abordable.

", - 'image' => 'medias/klore/images/building/solar-plant.jpg' - ), - - Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array( - 'name' => 'Réacteur à fusion nucléaire', - 'description' => "

Fruit de longues décénnies de recherche, le réacteur à fusion nucléaire est désormais une source d'énergie rentable.

Nourrie par l'énergie engendrée par la fusion des isotopes d'hydrogène, cette centrale génère plus d'énergie que toutes les autres sources d'énergie. La contrepartie à cette surgénération d'énergie, est son côut en deutérium.

", - 'image' => 'medias/klore/images/building/fusion-reactor.jpg' - ), - - Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY => array( - 'name' => 'Usine de robots', - 'description' => "

L'usine de robots permet à votre empire de se développer plus rapidement en accélarant la fabrication et l'évolution de vos structures.

", - 'image' => 'medias/klore/images/building/robotic-factory.jpg' - ), - - Legacies_Empire::ID_BUILDING_NANITE_FACTORY => array( - 'name' => 'Usine de nanites', - 'description' => "

Fruit de la recherche des nano-technologies, l'usine de nanites produit en masse nano-robots capable de s'assembler pour former vos futures structures.

", - 'image' => 'medias/klore/images/building/nanite-factory.jpg' - ), - - Legacies_Empire::ID_BUILDING_SHIPYARD => array( - 'name' => 'Chantier spatial', - 'description' => "

Elément central de la construction de vaisseaux spaciaux et de systèmes de défenses, le chantier spatial permettra à votre empire de s'étendre et d'asseaoir sa suprématie.

", - 'image' => 'medias/klore/images/building/shipyard.jpg' - ), - - Legacies_Empire::ID_BUILDING_METAL_STORAGE => array( - 'name' => 'Hangar de métal', - 'description' => '', - 'image' => 'medias/klore/images/building/metal-storage.jpg' - ), - - Legacies_Empire::ID_BUILDING_CRISTAL_STORAGE => array( - 'name' => 'Hangar de cristal', - 'description' => '', - 'image' => 'medias/klore/images/building/cristal-storage.jpg' - ), - - Legacies_Empire::ID_BUILDING_DEUTERIUM_TANK => array( - 'name' => 'Réservoir de deutérium', - 'description' => '', - 'image' => 'medias/klore/images/building/deuterium-tank.jpg' - ), - - Legacies_Empire::ID_BUILDING_RESEARCH_LAB => array( - 'name' => 'Laboratoire de recherche', - 'description' => '', - 'image' => 'medias/klore/images/building/research-lab.jpg' - ), - - Legacies_Empire::ID_BUILDING_TERRAFORMER => array( - 'name' => 'Terraformeur', - 'description' => '', - 'image' => 'medias/klore/images/building/terraformer.jpg' - ), - - Legacies_Empire::ID_BUILDING_ALLIANCE_DEPOT => array( - 'name' => 'Dépôt de ravitaillement', - 'description' => '', - 'image' => 'medias/klore/images/building/alliance-depot.jpg' - ), - - Legacies_Empire::ID_BUILDING_MISSILE_SILO => array( - 'name' => 'Silo de missiles', - 'description' => '', - 'image' => 'medias/klore/images/building/missile-silo.jpg' - ), -// }}} - -// -// Moon buildings labels -// {{{ - Legacies_Empire::ID_BUILDING_LUNAR_BASE => array( - 'name' => 'Base lunaire', - 'description' => '', - 'image' => 'medias/klore/images/ship/lunar-base.jpg' - ), - - Legacies_Empire::ID_BUILDING_SENSOR_PHALANX => array( - 'name' => 'Phalange de capteur', - 'description' => '', - 'image' => 'medias/klore/images/ship/sensor-phalanx.jpg' - ), - - Legacies_Empire::ID_BUILDING_JUMP_GATE => array( - 'name' => 'Porte de saut spatial', - 'description' => '', - 'image' => 'medias/klore/images/ship/jump-gate.jpg' - ), -// }}} - -// -// Technologies labels -// {{{ - Legacies_Empire::ID_RESEARCH_ESPIONAGE_TECHNOLOGY => array( - 'name' => 'Techniques d\'espionnage', - 'description' => '', - 'image' => 'medias/klore/images/technology/espionnage.jpg' - ), - - Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => array( - 'name' => 'Recherche informatique', - 'description' => '', - 'image' => 'medias/klore/images/technology/computer.jpg' - ), - - Legacies_Empire::ID_RESEARCH_WEAPON_TECHNOLOGY => array( - 'name' => 'Technologies d\'armements', - 'description' => '', - 'image' => 'medias/klore/images/technology/weaponry.jpg' - ), - - Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => array( - 'name' => 'Boucliers énergétiques', - 'description' => '', - 'image' => 'medias/klore/images/technology/shielding.jpg' - ), - - Legacies_Empire::ID_RESEARCH_ARMOUR_TECHNOLOGY => array( - 'name' => 'Structures spatiales', - 'description' => '', - 'image' => 'medias/klore/images/technology/armour.jpg' - ), - - Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => array( - 'name' => 'Nouvelles énergies', - 'description' => '', - 'image' => 'medias/klore/images/technology/energy.jpg' - ), - - Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => array( - 'name' => 'Technologie hyperespace', - 'description' => '', - 'image' => 'medias/klore/images/technology/hyperspace-technology.jpg' - ), - - Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => array( - 'name' => 'Propulsion à combustion', - 'description' => '', - 'image' => 'medias/klore/images/technology/combustion-drive.jpg' - ), - - Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => array( - 'name' => 'Propulsion à impulsion', - 'description' => '', - 'image' => 'medias/klore/images/technology/impulse-drive.jpg' - ), - - Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => array( - 'name' => 'Propulsion hyperespace', - 'description' => '', - 'image' => 'medias/klore/images/technology/hyperspace-drive.jpg' - ), - - Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => array( - 'name' => 'Propriétés laser', - 'description' => '', - 'image' => 'medias/klore/images/technology/laser.jpg' - ), - - Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => array( - 'name' => 'Propriétés des ions', - 'description' => '', - 'image' => 'medias/klore/images/technology/ion.jpg' - ), - - Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY => array( - 'name' => 'Propriétés des plasma', - 'description' => '', - 'image' => 'medias/klore/images/technology/plasma.jpg' - ), - - Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK => array( - 'name' => 'Réseau de recherche intergalactique', - 'description' => '', - 'image' => 'medias/klore/images/technology/intergalactic-research-network.jpg' - ), - - Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY => array( - 'name' => 'Technologie expéditions', - 'description' => '', - 'image' => 'medias/klore/images/technology/expedition.jpg' - ), - - Legacies_Empire::ID_RESEARCH_ORE_MINING => array( - 'name' => 'Exploitation minière', - 'description' => '', - 'image' => 'medias/klore/images/technology/ore-mining.jpg' - ), - - Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => array( - 'name' => 'Graviton', - 'description' => '', - 'image' => 'medias/klore/images/technology/graviton.jpg' - ), -// }}} - -// -// Fleets labels -// {{{ - Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => array( - 'name' => 'Transporteur T5', - 'class' => 'Etalon', - 'description' => '', - 'image' => 'medias/klore/images/ship/light-transport.jpg' - ), - - Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => array( - 'name' => 'Transporteur T25', - 'class' => 'Buffle', - 'description' => '', - 'image' => 'medias/klore/images/ship/large-transport.jpg' - ), - - Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => array( - 'name' => 'Chasseur C50', - 'class' => 'Guêpe', - 'description' => '', - 'image' => 'medias/klore/images/ship/light-fighter.jpg' - ), - - Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => array( - 'name' => 'Chasseur C150', - 'class' => 'Frelon', - 'description' => '', - 'image' => 'medias/klore/images/ship/heavy-fighter.jpg' - ), - - Legacies_Empire::ID_SHIP_CRUISER => array( - 'name' => 'Croiseur V400', - 'class' => 'Aigle', - 'description' => '', - 'image' => 'medias/klore/images/ship/cruiser.jpg' - ), - - Legacies_Empire::ID_SHIP_BATTLESHIP => array( - 'name' => 'Vaisseau de bataille V1000', - 'class' => 'Faucon', - 'description' => '', - 'image' => 'medias/klore/images/ship/battleship.jpg' - ), - - Legacies_Empire::ID_SHIP_COLONY_SHIP => array( - 'name' => 'Vaisseau de colonisation', - 'class' => 'Romulus', - 'description' => '', - 'image' => 'medias/klore/images/ship/colony-ship.jpg' - ), - - Legacies_Empire::ID_SHIP_RECYCLER => array( - 'name' => 'Recycleur', - 'class' => 'Goule', - 'description' => '', - 'image' => 'medias/klore/images/ship/recycler.jpg' - ), - - Legacies_Empire::ID_SHIP_SPY_DRONE => array( - 'name' => 'Sonde d\'espionnage', - 'class' => 'Moustique', - 'description' => '', - 'image' => 'medias/klore/images/ship/spy-drone.jpg' - ), - - Legacies_Empire::ID_SHIP_BOMBER => array( - 'name' => 'Bombarider', - 'class' => 'Vengeur', - 'description' => '', - 'image' => 'medias/klore/images/ship/bomber.jpg' - ), - - Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array( - 'name' => 'Satellite solaire', - 'class' => 'Râ', - 'description' => '', - 'image' => 'medias/klore/images/ship/solar-satellite.jpg' - ), - - Legacies_Empire::ID_SHIP_DESTRUCTOR => array( - 'name' => 'Vaisseau de bataille V2000', - 'class' => 'Destructeur', - 'description' => '', - 'image' => 'medias/klore/images/ship/destructor.jpg' - ), - - Legacies_Empire::ID_SHIP_DEATH_STAR => array( - 'name' => 'Vaisseau mère M1', - 'class' => 'Vengeur', - 'description' => '', - 'image' => 'medias/klore/images/ship/death-star.jpg' - ), - - Legacies_Empire::ID_SHIP_BATTLECRUISER => array( - 'name' => 'Vaisseau de bataille V700', - 'class' => 'Dragon', - 'description' => '', - 'image' => 'medias/klore/images/ship/battlecruiser.jpg' - ), - - Legacies_Empire::ID_SHIP_SUPERNOVA => array( - 'name' => 'Vaisseau mère M5', - 'class' => 'Annihilateur', - 'description' => '', - 'image' => 'medias/klore/images/ship/supernova.jpg' - ), - - Legacies_Empire::ID_SHIP_ORE_MININER => array( - 'name' => 'Vaisseau d\'exploitation', - 'class' => 'Onyx', - 'description' => '', - 'image' => 'medias/klore/images/ship/ore-miner.jpg' - ), -// }}} - -// -// Defenses labels -// {{{ - Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => array( - 'name' => 'Lance-missiles balistiques', - 'class' => 'Défenseur', - 'description' => '', - 'image' => 'medias/klore/images/defense/rocket-launcher.jpg' - ), - - Legacies_Empire::ID_DEFENSE_LIGHT_LASER => array( - 'name' => 'Artillerie laser légère', - 'class' => 'Lux', - 'description' => '', - 'image' => 'medias/klore/images/defense/light-laser.jpg' - ), - - Legacies_Empire::ID_DEFENSE_HEAVY_LASER => array( - 'name' => 'Artillerie laser lourde', - 'class' => 'Seraphin', - 'description' => '', - 'image' => 'medias/klore/images/defense/heavy-laser.jpg' - ), - - Legacies_Empire::ID_DEFENSE_ION_CANNON => array( - 'name' => 'Canon à ions', - 'class' => 'Découpeur', - 'description' => '', - 'image' => 'medias/klore/images/defense/ion-canon.jpg' - ), - - Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => array( - 'name' => 'Canon à effet Gauss', - 'class' => 'Polaris', - 'description' => '', - 'image' => 'medias/klore/images/defense/gauss-canon.jpg' - ), - - Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => array( - 'name' => 'Canon à plasma', - 'class' => 'Infernal', - 'description' => '', - 'image' => 'medias/klore/images/defense/plasma-turret.jpg' - ), - - Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => array( - 'name' => 'Dôme bouclier', - 'class' => 'Sphere', - 'description' => '', - 'image' => 'medias/klore/images/defense/small-shield-dome.jpg' - ), - - Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => array( - 'name' => 'Grand bouclier planétaire', - 'class' => 'Gaia', - 'description' => '', - 'image' => 'medias/klore/images/defense/large-shield-dome.jpg' - ), -// }}} - -// -// Special defenses labels -// {{{ - Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => array( - 'name' => 'Missile anti-balistique', - 'description' => '', - 'image' => 'medias/klore/images/defense/antiballistic-missile.jpg' - ), - - Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => array( - 'name' => 'Missile stratégique', - 'description' => '', - 'image' => 'medias/klore/images/defense/interplanetary-missile.jpg' - ) -// }}} -); diff --git a/src/application/gamedata/legacies/default/modules.php b/src/application/gamedata/legacies/default/modules.php deleted file mode 100644 index b00c84f..0000000 --- a/src/application/gamedata/legacies/default/modules.php +++ /dev/null @@ -1,10 +0,0 @@ - array( - 'core' => array('Wootook_Core_Block_' => 'Wootook/Core/Block'), - 'empire' => array('Wootook_Empire_Block_' => 'Wootook/Empire/Block'), - 'player' => array('Wootook_Player_Block_' => 'Wootook/Player/Block'), - 'legacies-core' => array('Legacies_Core_Block_' => 'Legacies/Core/Block'), - 'legacies-empire' => array('Legacies_Empire_Block_' => 'Legacies/Empire/Block'), - 'legacies-stats' => array('Legacies_Stats_Block_' => 'Legacies/Stats/Block') - ) - ); diff --git a/src/application/gamedata/legacies/default/production.php b/src/application/gamedata/legacies/default/production.php deleted file mode 100644 index 545dcde..0000000 --- a/src/application/gamedata/legacies/default/production.php +++ /dev/null @@ -1,18 +0,0 @@ - 'Legacies_Empire_Model_Planet_Building_MetalMine', - Legacies_Empire::ID_BUILDING_CRISTAL_MINE => 'Legacies_Empire_Model_Planet_Building_CristalMine', - Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => 'Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser', - Legacies_Empire::ID_BUILDING_SOLAR_PLANT => 'Legacies_Empire_Model_Planet_Building_SolarPlant', - Legacies_Empire::ID_BUILDING_FUSION_REACTOR => 'Legacies_Empire_Model_Planet_Building_FusionReactor', -// }}} - -// -// Ships production -// {{{ - Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 'Legacies_Empire_Model_Planet_Ship_SolarSatellite', - Legacies_Empire::ID_SHIP_SUPERNOVA => 'Legacies_Empire_Model_Planet_Ship_Supernova' -// }}} - ); diff --git a/src/application/gamedata/legacies/version.php b/src/application/gamedata/legacies/version.php deleted file mode 100644 index 1b6f705..0000000 --- a/src/application/gamedata/legacies/version.php +++ /dev/null @@ -1,4 +0,0 @@ - '1.5.0', - 'Legacies_Empire' => '1.5.0', -); \ No newline at end of file diff --git a/src/application/locale/fr_FR/Legacies.csv b/src/application/locale/fr_FR/Legacies.csv deleted file mode 100644 index a19064b..0000000 --- a/src/application/locale/fr_FR/Legacies.csv +++ /dev/null @@ -1,39 +0,0 @@ -"Your session has expired, please login.","Votre session a expiré, veuillez vous reconnecter." -"Your username or credential is invalid, please check your input.","Votre nom d'utilisateur ou votre mot de passe n'est pas valide, veuillez vérifier votre saisie." -"No such user.","Cet utilisateur n'existe pas." -"You were banned, please contact admin for more information.","Vous ont été banni, veuillez contacter l'admin pour plus d'informations." -"You have 1 unread message.","Vous avez un message non lu." -"You have 1 new message.","Vous avez un nouveau message." -"You have no new message.","Vous n'avez pas de nouveau message." -"You have %1$d new messages","Vous avez %1$d nouveaux messages" -"You have %1$d unread messages.","Vous avez %1$d messages non lus." -"You have ""%1$d"" unread messages.","Vous avez ""%1$d"" messages non lus." -"No message.","Aucun message" -"1 messages.","Un message" -"%1$d messages.","%1$d messages." -"instantaneous","instantanné" -"Attack","Attaquer" -"Transport","Transporter" -"Station","Stationner" -"Settle","Coloniser" -"Recycle","Recycler" -"Destroy","Détruire" -"Missiles Launch","Attaque de missiles" -"Expedition","Expédition" -"Unknown","Inconnu" -"Planet is already destroyed","La planète est déjà détruite" -"Password:","Mot de passe :" -"I want to destroy this planet","Je confirme vouloir détruire cette planète" -"New name","Nouveau nom" -"Idle.","Inactif." -"Cancel","Annuler" -"Work in progress","Travail en cours" -"Buildings","Bâtiments" -"Research Laboratory","Laboratoire de recherches" -"Shipyard","Chantier spatial" -"Build","Construire" -"Metal","Métal" -"Cristal","Cristal" -"Deuterium","Deutérium" -"Energy","Energie" -"Messages","Messages" diff --git a/src/application/locale/fr_FR/Wootook_Core.csv b/src/application/locale/fr_FR/Wootook_Core.csv deleted file mode 100644 index 98a6fbf..0000000 --- a/src/application/locale/fr_FR/Wootook_Core.csv +++ /dev/null @@ -1,156 +0,0 @@ -"Game is disabled.","Le jeu est clos." -"%1$d day(s) and %2$d hour(s)","%1$d jour(s) et %2$d heure(s)" -"%1$d hour(s), %2$d minute(s) and %3$d second(s)","%1$d heure(s), %2$d minute(s) et %3$d seconde(s)" -"%1$d minute(s) and %2$d second(s)","%1$d minute(s) et %2$d seconde(s)" -"%1$d second(s)","%1$d seconde(s)" -"%1$d per minute","%1$d par minute" -"instantaneous","instantanné" -"Attack","Attaquer" -"Transport","Transporter" -"Station","Stationner" -"Settle","Coloniser" -"Recycle","Recycler" -"Destroy","Detruire" -"Missiles Launch","Envoi de missiles" -"Expedition","Expédition" -"Unknown","Inconnu" -"Planet is already destroyed.","La planète a déjà été détruite." -"Could not delete planet until fleets aten't retuned.","Impossible de détruire la planète tant que toutes les flottes ne sont pas revenues." -"You can't destroy your home planet.","Vous ne pouvez pas détruire votre planète mère." -"No such user.","Cet utilisateur n'existe pas." -"You were banned, please contact admin for more information.","Vous avez été banni. Veuillez contacter l'administrateur pour plus d'informations." -"Your username or credential is invalid, please check your input.","Votre nom d'utilisateur ou votre mot de passe sont invalides, veuillez vérifier votre saisie." -"My %s message!","My %s message!" -"An hostile fleet sent by %1$s, coming from %2$s, reaches your planet %3$d. It has been sent with the mission: %4$d","Une flotte hostile envoyée par %1$s et prevenant de %2$s atteint votre planète %3$d. Sa mission est : %4$d." -"Your hostile fleet, sent from %1$s, reaches %2$d\'s planet %3$d. It has been sent with the mission: %4$d","Votre flotte hostile envoyée depuis %1$s, atteint la planète de %2$d : %3$d. Sa mission est : %4$d" -"Your peaceful fleet, sent from %2$s, reaches the planet %3$d. It has been sent with the mission: %4$d","Votre flotte envoyée depuis %2$s, atteint la planète %3$d. Sa mission est : %4$d" -"A peaceful fleet sent by %1$s, coming from %2$s, reaches your planet %3$d. It has been sent with the mission: %4$d","Une flotte pacifique envoyée par %1$s et venant de %2$s atteint votre palnète %3$d. Sa mission est : %4$d" -"I want to destroy this planet","Je veux détruire cette planète." -"New name:","Nouveau nom:" -"You have 1 unread message.","Vous avez un message non lu." -"You have %1$d unread messages.","Vous avez %1$d messages non lus." -"Idle.","Inactif." -"Level %d","Niveau %d" -"Current count: %s","Disponible : %s" -"Build max (%s)","Construire le max (%s)" -"Build next level (%s)","Construire au niveau %s" -"Building time: %s","Temps de construction : %s" -"Lasts %s","Il reste %s" -"Cancel","Annuler" -"Work in progress","En cours..." -"Buildings","Bâtiments" -"Research Laboratory","Laboratoire de recherche" -"Shipyard","Chantier spatial" -"Build","Build" -"Metal","Métal" -"Cristal","Cristal" -"Deuterium","Deutérium" -"Energy","Energie" -"Messages","Messages" -"1 message.","Un message." -"You have no new message.","Vous n'avez pas de nouveau message." -"No message.","Pas de message." -"Username","Nom d'utilisateur" -"Password","Mot de passe" -"Remember me","Se souvenir de moi" -"Log in!","Connexion!" -"I have lost my password.","J'ai perdu mon mot de passe." -"Register","Créer un compte" -"Boards","Forum" -"Contact","Contact" -"Welcome on %s!","Bienvenue sur %s!" -"%1$s make you an emperor. Conquer outer space and master other players on %1$s.","%1$s fait de vous un empereur. Parcourez l'espace sidéral et conquérez les territoires d'autres joueurs sur %1$s." -"Register now!","S'enregistrer maintenant!" -"Player count: ","Nombre de joueurs : " -"Latest player: ","Dernier inscrit : " -"Online players: ","Joueurs en ligne : " -"User data:","Votre compte :" -"Username:","Nom d'empire :" -"Email:","Email :" -"Confirm email:","Confirmez l'email :" -"Password:","Mot de passe :" -"Confirm password:","Confirmez le mot de passe :" -"Planet:","Planète :" -"Planet name:","Nom de votre planète :" -"Register!","S'enregistrer!" -"Welcome to the Wootook! installer","Bienvenue sur l'installation de Wootook!" -"This page will guide you through the installation proces of Wootook! the MMO game engine platform.","Cette page vous guidera à travers le processus d'installation de Wootook! la plateforme de jeux web MMO." -"Feel free to ask for help at any time at wootook.org.","Feel free to ask for help at any time at wootook.org." -"Next step","Etape suivante" -"Welcome","Bienvenue" -"System","Système" -"Database","Base de données" -"Universe","Univers" -"Admin profile","Profil administrateur" -"Summary","Finalisation" -"Database Config","Configuration de votre base de données" -"Database host address:","Adresse du serveur :" -"Database host port:","Port du serveur :" -"Database account name:","Compte utilisateur:" -"Database account password:","Mot de passe :" -"Database name:","Nom de la base de données :" -"Table name prefix:","Préfixe des noms des tables :" -"Test connection","Tester la connexion" -"Connection succeeded.","Connexion réussie." -"Connection error: ","Erreur de connexion : " -"Admin Profile Config","Configuration du compte administrateur" -"Root admin account name:","Nom d'utilisateur :" -"Root admin email:","Email du compte administrateur :" -"Root admin account password:","Mot de passe :" -"Root admin account password confirm:","Confirmez le mot de passe :" -"System Config","Configuration système" -"Base URL path for the game:","URL de base Base du jeu :" -"Game timezone:","Fuseau horaire du jeu :" -"Africa","Afrique" -"America","Amerique" -"Atlantic","Atlantique" -"Asia","Asie" -"Europe","Europe" -"Pacific","Pacifique" -"Universe Config","configuration de l'univers" -"Galaxies count:","Nombre de galaxies :" -"Systems count:","Nombre de systèmes solaires :" -"Positions in each system:","Nombre de planètes dans chaque système solaire :" -"Allow spy drone attacks","Autoriser la attaques de sondes d'espionnage" -"Activate large numbers handling","Activer la gestion des très grands nombres" -"'BC Math' extension is unavailable. This option will have no effect until the extension isn't active.","L'extension PHP 'BC Math' est indisponible sur votre machine. Cette option n'aura aucun effet tant que l'extension ne sera pas activée." -"Wootook! was successfully installed.","Wootook! a été correctmeent installé." -"You can now play at %s and tell your friends to come and play.","Vous pouvez maintenant jouer sur %s et dire à vos amis de venir." -"Feel free to ask for help at any time at wootook.org.","Feel free to ask for help at any time at wootook.org." -"Play!","Jouer!" -"Shipyard is required","Le chantier spatial est requis" -"In order to build ships you will need to build a shipyard building.","Pour construire des vaisseaux, vous devrez construire un chantier spatial." -"Research lab is required","Le laboratoire de recherche est requis" -"In order to do technological researches, you will need to build a research lab building.","Pour effectuer des recherches de nouvelles technologies, vous devrez construire un laboratoire de recherches." -"Unnamed","Sans nom" -"Name","Nom" -"Galaxy","Galaxie" -"System","Système" -"Planet","Planète" -"Debris","Débris" -"Moon","Lune" -"Reset","Réinitialiser" -"Save","Sauvegarder" -"The shortcut has been saved.","Le raccourci a été enregistré." -"The shortcut has been deleted","Le raccourdi a été supprimé" -"The shortcut has been updated.","Le raccourci a été mis à jour." -"Success","Succès" -"Colony","Colonie" -"Moon","Lune" -"Class %s","Classe %s" -"Build","Construire" -"Game data successfully initialized.","Game data successfully initialized." -"Passwords does not match.","Les mots de passe ne correpsondent pas." -"Both e-mails does not match.","Les emails ne correpsondent pas." -"Could not create user.","Impossible de créer le compte d'utilisateur." -"Could not set to vacation mode.","Impossible d'activer le mode vacances." -"You currently can't get to vacation mode, please check your flying fleets, and building queues.","You currently can't get to vacation mode, please check your flying fleets, and building queues." -"Password was not correct.","Le mot de passe est incorrect." -"Planet has been successfully destroyed.","LA planète a été détruite." -"Open the chat.","Ouvrir le chat." -"No root view declared.","Aucune vue racine n'est déclarée." -"Query failed: SQLSTATE %s: %s.","La requête a échoué : SQLSTATE %s: %s." -"Undefined method %s::%s.","La méthode %s::%s est inconnue." -"Ajax failure.","Erreur AJAX." -"Invalid security key.","code de sécurité invalide." -"Form data error.","données de formulaire erronnées." diff --git a/src/application/test/translate.csv b/src/application/test/translate.csv deleted file mode 100644 index a873711..0000000 --- a/src/application/test/translate.csv +++ /dev/null @@ -1,154 +0,0 @@ -"Game is disabled.","Le jeu est clos." -"%1$d day(s) and %2$d hour(s)","%1$d jour(s) et %2$d heure(s)" -"%1$d hour(s), %2$d minute(s) and %3$d second(s)","%1$d heure(s), %2$d minute(s) et %3$d seconde(s)" -"%1$d minute(s) and %2$d second(s)","%1$d minute(s) et %2$d seconde(s)" -"%1$d second(s)","%1$d seconde(s)" -"%1$d per minute","%1$d par minute" -"instantaneous","instantanné" -"Attack","Attaquer" -"Transport","Transporter" -"Station","Stationner" -"Settle","Coloniser" -"Recycle","Recycler" -"Destroy","Detruire" -"Missiles Launch","Envoi de missiles" -"Expedition","Expédition" -"Unknown","Inconnu" -"Planet is already destroyed.","La planète a déjà été détruite." -"Could not delete planet until fleets aten't retuned.","Impossible de détruire la planète tant que toutes les flottes ne sont pas revenues." -"You can't destroy your home planet.","Vous ne pouvez pas détruire votre planète mère." -"No such user.","Cet utilisateur n'existe pas." -"You were banned, please contact admin for more information.","Vous avez été banni. Veuillez contacter l'administrateur pour plus d'informations." -"Your username or credential is invalid, please check your input.","Votre nom d'utilisateur ou votre mot de passe sont invalides, veuillez vérifier votre saisie." -"My %s message!","My %s message!" -"An hostile fleet sent by %1$s, coming from %2$s, reaches your planet %3$d. It has been sent with the mission: %4$d","Une flotte hostile envoyée par %1$s et prevenant de %2$s atteint votre planète %3$d. Sa mission est : %4$d." -"Your hostile fleet, sent from %1$s, reaches %2$d\'s planet %3$d. It has been sent with the mission: %4$d","Votre flotte hostile envoyée depuis %1$s, atteint la planète de %2$d : %3$d. Sa mission est : %4$d" -"Your peaceful fleet, sent from %2$s, reaches the planet %3$d. It has been sent with the mission: %4$d","Votre flotte envoyée depuis %2$s, atteint la planète %3$d. Sa mission est : %4$d" -"A peaceful fleet sent by %1$s, coming from %2$s, reaches your planet %3$d. It has been sent with the mission: %4$d","Une flotte pacifique envoyée par %1$s et venant de %2$s atteint votre palnète %3$d. Sa mission est : %4$d" -"I want to destroy this planet","Je veux détruire cette planète." -"New name:","Nouveau nom:" -"You have 1 unread message.","Vous avez un message non lu." -"You have %1$d unread messages.","Vous avez %1$d messages non lus." -"Idle.","Inactif." -"Level %d","Niveau %d" -"Current count: %s","Quantité actuelle : %s" -"Build max (%s)","Construire le max (%s)" -"Build next level (%s)","Construire le niveau suivant (%s)" -"Building time: %s","Temps de construction : %s" -"Lasts %s","Il reste %s" -"Cancel","Annuler" -"Work in progress","En cours..." -"Buildings","Bâtiments" -"Research Laboratory","Laboratoire de recherche" -"Shipyard","Chantier spatial" -"Build","Build" -"Metal","Métal" -"Cristal","Cristal" -"Deuterium","Deutérium" -"Energy","Energie" -"Messages","Messages" -"1 message.","Un message." -"You have no new message.","Vous n'avez pas de nouveau message." -"No message.","Pas de message." -"Username","Nom d'utilisateur" -"Password","Mot de passe" -"Remember me","Se souvenir de moi" -"Log in!","Connexion!" -"I have lost my password.","J'ai perdu mon mot de passe." -"Register","Créer un compte" -"Boards","Forum" -"Contact","Contact" -"Welcome on %s!","Bienvenue sur %s!" -"%1$s make you an emperor. Conquer outer space and master other players on %1$s.","%1$s fait de vous un empereur. Parcourez l'espace sidéral et conquérez les territoires d'autres joueurs sur %1$s." -"Register now!","S'enregistrer maintenant!" -"Player count: ","Nombre de joueurs : " -"Latest player: ","Dernier inscrit : " -"Online players: ","Joueurs en ligne : " -"User data:","Votre compte :" -"Username:","Nom d'empire :" -"Email:","Email :" -"Confirm email:","Confirmez l'email :" -"Password:","Mot de passe :" -"Confirm password:","Confirmez le mot de passe :" -"Planet:","Planète :" -"Planet name:","Nom de votre planète :" -"Register!","S'enregistrer!" -"Welcome to the Wootook! installer","Bienvenue sur l'installation de Wootook!" -"This page will guide you through the installation proces of Wootook! the MMO game engine platform.","Cette page vous guidera à travers le processus d'installation de Wootook! la plateforme de jeux web MMO." -"Feel free to ask for help at any time at wootook.org.","Feel free to ask for help at any time at wootook.org." -"Next step","Etape suivante" -"Welcome","Bienvenue" -"System","Système" -"Database","Base de données" -"Universe","Univers" -"Admin profile","Compte Admin" -"Summary","Finalisation" -"Database Config","Configuration de votre base de données" -"Database host address:","Adresse du serveur :" -"Database host port:","Port du serveur :" -"Database account name:","Compte utilisateur:" -"Database account password:","Mot de passe :" -"Database name:","Nom de la base de données :" -"Table name prefix:","Préfixe des noms des tables :" -"Test connection","Tester la connexion" -"Connection succeeded.","Connexion réussie." -"Connection error: ","Erreur de connexion : " -"Admin Profile Config","Configuration du compte administrateur" -"Root admin account name:","Nom d'utilisateur :" -"Root admin email:","Email du compte administrateur :" -"Root admin account password:","Mot de passe :" -"Root admin account password confirm:","Confirmez le mot de passe :" -"System Config","Configuration système" -"Base URL path for the game:","URL de base Base du jeu :" -"Game timezone:","Fuseau horaire du jeu :" -"Africa","Afrique" -"America","Amerique" -"Atlantic","Atlantique" -"Asia","Asie" -"Europe","Europe" -"Pacific","Pacifique" -"Universe Config","configuration de l'univers" -"Galaxies count:","Nombre de galaxies :" -"Systems count:","Nombre de systèmes solaires :" -"Positions in each system:","Nombre de planètes dans chaque système solaire :" -"Allow spy drone attacks","Autoriser la attaques de sondes d'espionnage" -"Activate large numbers handling","Activer la gestion des très grands nombres" -"'BC Math' extension is unavailable. This option will have no effect until the extension isn't active.","L'extension PHP 'BC Math' est indisponible sur votre machine. Cette option n'aura aucun effet tant que l'extension ne sera pas activée." -"Wootook! was successfully installed.","Wootook! a été correctmeent installé." -"You can now play at %s and tell your friends to come and play.","Vous pouvez maintenant jouer sur %s et dire à vos amis de venir." -"Feel free to ask for help at any time at wootook.org.","Feel free to ask for help at any time at wootook.org." -"Play!","Jouer!" -"Shipyard is required","Le chantier spatial est requis" -"In order to build ships you will need to build a shipyard building.","Pour construire des vaisseaux, vous devrez construire un chantier spatial." -"Research lab is required","Le laboratoire de recherche est requis" -"In order to do technological researches, you will need to build a research lab building.","Pour effectuer des recherches de nouvelles technologies, vous devrez construire un laboratoire de recherches." -"Unnamed","Sans nom" -"Name","Nom" -"Galaxy","Galaxie" -"System","Système" -"Planet","Planète" -"Debris","Débris" -"Moon","Lune" -"Reset","Réinitialiser" -"Save","Sauvegarder" -"The shortcut has been saved.","Le raccourci a été enregistré." -"The shortcut has been deleted","Le raccourdi a été supprimé" -"The shortcut has been updated.","Le raccourci a été mis à jour." -"Success","Succès" -"Colony","Colonie" -"Moon","Lune" -"Game data successfully initialized.","Game data successfully initialized." -"Passwords does not match.","Les mots de passe ne correpsondent pas." -"Both e-mails does not match.","Les emails ne correpsondent pas." -"Could not create user.","Impossible de créer le compte d'utilisateur." -"Could not set to vacation mode.","Impossible d'activer le mode vacances." -"You currently can't get to vacation mode, please check your flying fleets, and building queues.","You currently can't get to vacation mode, please check your flying fleets, and building queues." -"Password was not correct.","Le mot de passe est incorrect." -"Planet has been successfully destroyed.","LA planète a été détruite." -"Open the chat.","Ouvrir le chat." -"No root view declared.","Aucune vue racine n'est déclarée." -"Query failed: SQLSTATE %s: %s.","La requête a échoué : SQLSTATE %s: %s." -"Undefined method %s::%s.","La méthode %s::%s est inconnue." -"Ajax failure.","Erreur AJAX." -"Invalid security key.","code de sécurité invalide." -"Form data error.","données de formulaire erronnées." diff --git a/src/application/test/translate2.txt b/src/application/test/translate2.txt deleted file mode 100644 index 6731a74..0000000 Binary files a/src/application/test/translate2.txt and /dev/null differ diff --git a/src/fleetback.php b/src/fleetback.php deleted file mode 100644 index 4075674..0000000 --- a/src/fleetback.php +++ /dev/null @@ -1,77 +0,0 @@ - -Website: http://project.galacticnova.vinilox.eu/ -Last revision: 13/07/11 - -*/ - -define('INSIDE' , true); -define('INSTALL' , false); -require_once dirname(__FILE__) .'/application/bootstrap.php'; -includeLang('fleet'); - -$BoxTitle = $lang['fl_error']; -$TxtColor = "red"; -$BoxMessage = $lang['fl_notback']; -if (isset($_POST['fleetid']) && is_numeric($_POST['fleetid'])) { - $fleetid = intval($_POST['fleetid']); - - $readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write'); - $FleetRow = $readAdapter->select() - ->from(array('fleet' => $readAdapter->getTable('fleets'))) - ->where('fleet_id', $fleetid) - ->prepare() - ->fetch() - ; - $i = 0; - - if ($FleetRow['fleet_owner'] == $user['id']) { - if ($FleetRow['fleet_mess'] == 0 || $FleetRow['fleet_mess'] == 2) { - if ($FleetRow['fleet_end_stay'] != 0) { - // Faut calculer le temps reel de retour - if ($FleetRow['fleet_start_time'] > time()) { - // On a pas encore entamé le stationnement - // Il faut calculer la parcelle de temps ecoulée depuis le lancement de la flotte - $CurrentFlyingTime = time() - $FleetRow['start_time']; - } else { - // On est deja en stationnement - // Il faut donc directement calculer la durée d'un vol aller ou retour - $CurrentFlyingTime = $FleetRow['fleet_start_time'] - $FleetRow['start_time']; - } - } else { - // C'est quoi le stationnement ?? - // On calcule sagement la parcelle de temps ecoulée depuis le depart - $CurrentFlyingTime = time() - $FleetRow['start_time']; - } - $ReturnFlyingTime = $CurrentFlyingTime + time(); - - $writeAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write'); - $writeAdapter->update() - ->into($writeAdapter->getTable('fleets')) - ->set('fleet_start_time', time()) - ->set('fleet_end_stay', 0) - ->set('fleet_end_time', $ReturnFlyingTime) - ->set('fleet_target_owner', $user->getId()) - ->set('fleet_mess', 1) - ->where('fleet_id', $fleetid) - ->execute() - ; - - $BoxTitle = $lang['fl_sback']; - $TxtColor = "lime"; - $BoxMessage = $lang['fl_isback']; - } elseif ($FleetRow['fleet_mess'] == 1) { - $BoxMessage = $lang['fl_notback']; - } - } else { - $BoxMessage = $lang['fl_onlyyours']; - } -} - -message ($BoxMessage, $BoxTitle, "fleet.". PHPEXT, 2); diff --git a/src/fleetshortcut.php b/src/fleetshortcut.php deleted file mode 100644 index 016de90..0000000 --- a/src/fleetshortcut.php +++ /dev/null @@ -1,208 +0,0 @@ - - * 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 Wootook. - * - */ - -define('INSIDE' , true); -define('INSTALL' , false); -require_once dirname(__FILE__) .'/application/bootstrap.php'; - - -$mode = isset($_GET['mode']) ? $_GET['mode'] : null; -$a = isset($_GET['a']) ? $_GET['a'] : null; - -$user = Wootook_Player_Model_Session::getSingleton()->getPlayer(); - -if ($mode) { - if ($_POST) { - //Pegamos el texto :P - if (!isset($_POST["n"]) || empty($_POST["n"])) { - $name = Wootook::__("Unnamed"); - } else { - $name = $_POST["n"]; - } - - if (($offset = strpos($name, "\n")) !== false) { - $name = substr($name, 0, $offset); - } - if (($offset = strpos($name, "\r")) !== false) { - $name = substr($name, 0, $offset); - } - if (($offset = strpos($name, ",")) !== false) { - $name = substr($name, 0, $offset); - } - $planetTypes = array( - Wootook_Empire_Model_Planet::TYPE_PLANET, - Wootook_Empire_Model_Planet::TYPE_DEBRIS, - Wootook_Empire_Model_Planet::TYPE_MOON - ); - - $r = array(); - $r[0] = preg_replace('#[^[:alnum:]\s\-\_\']#', '', $name); - $r[1] = (isset($_POST['g']) && intval($_POST['g']) > 0 && intval($_POST['g']) <= Wootook::getGameConfig('engine/universe/galaxies')) ? intval($_POST['g']) : '1'; - $r[2] = (isset($_POST['s']) && intval($_POST['s']) > 0 && intval($_POST['s']) <= Wootook::getGameConfig('engine/universe/systems')) ? intval($_POST['s']) : '1'; - $r[3] = (isset($_POST['p']) && intval($_POST['p']) > 0 && intval($_POST['p']) <= Wootook::getGameConfig('engine/universe/positions')) ? intval($_POST['p']) : '1'; - $r[4] = (isset($_POST['t']) && intval($_POST['t']) > 0 && in_array(intval($_POST['t']), $planetTypes)) ? intval($_POST['t']) : '1'; - - $user['fleet_shortcut'] .= implode(",", $r); - $user->save(); - message(Wootook::__("The shortcut has been saved."), Wootook::__("Success"), "fleetshortcut.php"); - } - $page = "
- - - - "; - $page .= '
Nom [Galaxie/Système solaire/Planète]
- - - - - -
"; - //Muestra un (L) si el destino pertenece a luna, lo mismo para escombros - $page .= "
Effacer
'; -} else if ($a !== null) { - if ($_POST) { - //Armamos el array... - $scarray = explode("\r\n", $user['fleet_shortcut']); - if (isset($_POST["delete"])) { - unset($scarray[$a]); - $user['fleet_shortcut'] = implode("\r\n", $scarray); - doquery("UPDATE {{table}} SET fleet_shortcut={$db->quote($user['fleet_shortcut'])} WHERE id={$user['id']}", "users"); - message(Wootook::__("The shortcut has been deleted"), Wootook::__("Success"), "fleetshortcut.php"); - } else { - $r = explode(",", $scarray[$a]); - if (!isset($_POST["n"]) || empty($_POST["n"])) { - $name = $r[0]; - } else { - $name = $_POST["n"]; - } - - if (($offset = strpos($name, "\n")) !== false) { - $name = substr($name, 0, $offset); - } - if (($offset = strpos($name, "\r")) !== false) { - $name = substr($name, 0, $offset); - } - if (($offset = strpos($name, ",")) !== false) { - $name = substr($name, 0, $offset); - } - $planetTypes = array( - Wootook_Empire_Model_Planet::TYPE_PLANET, - Wootook_Empire_Model_Planet::TYPE_DEBRIS, - Wootook_Empire_Model_Planet::TYPE_MOON - ); - $r[0] = preg_replace('#[^[:alnum:]\s\-\_\']#', '', $name); - $r[1] = (isset($_POST['g']) && intval($_POST['g']) > 0 && intval($_POST['g']) <= Wootook::getGameConfig('engine/universe/galaxies')) ? intval($_POST['g']) : $r[1]; - $r[2] = (isset($_POST['s']) && intval($_POST['s']) > 0 && intval($_POST['s']) <= Wootook::getGameConfig('engine/universe/systems')) ? intval($_POST['s']) : $r[2]; - $r[3] = (isset($_POST['p']) && intval($_POST['p']) > 0 && intval($_POST['p']) <= Wootook::getGameConfig('engine/universe/positions')) ? intval($_POST['p']) : $r[3]; - $r[4] = (isset($_POST['t']) && intval($_POST['t']) > 0 && in_array(intval($_POST['t']), $planetTypes)) ? intval($_POST['t']) : $r[4]; - - $scarray[$a] = implode(",", $r); - $user['fleet_shortcut'] = implode("\r\n", $scarray); - $user->save(); - message(Wootook::__("The shortcut has been updated."), Wootook::__("Success"), "fleetshortcut.php"); - } - } - - if ($user['fleet_shortcut']) { - - $scarray = explode("\r\n",$user['fleet_shortcut']); - $c = explode(',',$scarray[$a]); - - $page = "
- - - "; - //if($i==0){$page .= "";} - $page .= " - "; - - } else { - $page .= message("Le raccourcis a été enregistré !","Enregistrer","fleetshortcut.php"); - } - - $page .= '
Editer: {$c[0]} [{$c[1]}:{$c[2]}:{$c[3]}]
- - - - - - -
"; - $page .= "
Retour
'; - - -} else { - - $page = ' - - - '; - - if($user['fleet_shortcut']){ - /* - Dentro de fleet_shortcut, se pueden almacenar las diferentes direcciones - de acceso directo, el formato es el siguiente. - Nombre, Galaxia,Sistema,Planeta,Tipo - */ - $scarray = explode("\r\n",$user['fleet_shortcut']); - $i=$e=0; - foreach($scarray as $a => $b){ - if($b!=""){ - $c = explode(',',$b); - if($i==0){$page .= "";} - $page .= ""; - if($i==1){$page .= "";} - if($i==1){$i=0;}else{$i=1;} - } - - } - if($i==1){$page .= "";} - - }else{$page .= "";} - - $page .= '
Raccourcis(Ajout)
"; - $page .= "{$c[0]} {$c[1]}:{$c[2]}:{$c[3]}"; - //Muestra un (L) si el destino pertenece a luna, lo mismo para escombros - if($c[4]==2){$page .= " (E)";}elseif($c[4]==3){$page .= " (L)";} - $page .= "
Pas de Raccourcis
Retour
'; -} -display($page,"Shortcutmanager"); - -// Created by Perberos. All rights reversed (C) 2006 -?> diff --git a/src/floten3.php b/src/floten3.php deleted file mode 100644 index 23f3985..0000000 --- a/src/floten3.php +++ /dev/null @@ -1,508 +0,0 @@ - - * 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 Wootook. - * - */ - -define('INSIDE' , true); -define('INSTALL' , false); -require_once dirname(__FILE__) .'/application/bootstrap.php'; - -includeLang('fleet'); - -$session = Wootook::getSession('fleet'); - -$user = Wootook_Player_Model_Session::getSingleton()->getPlayer(); -$planet = $user->getCurrentPlanet(); - -$mission = isset($_POST['mission']) ? intval($_POST['mission']) : 0; -$galaxy = isset($session['galaxy']) ? $session['galaxy'] : 0; -$system = isset($session['system']) ? $session['system'] : 0; -$position = isset($session['position']) ? $session['position'] : 0; -$type = isset($session['type']) ? $session['type'] : 0; -$speed = isset($session['speed']) ? $session['speed'] : 10; - -$protection = Wootook::getGameConfig('game/noob-protection/active'); -$protectionPointsCap = Wootook::getGameConfig('game/noob-protection/points-cap'); -$protectionMultiplier = Wootook::getGameConfig('game/noob-protection/multiplier'); - -$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton() - ->getConnection('core_read'); -$writeAdapter = Wootook_Core_Database_ConnectionManager::getSingleton() - ->getConnection('core_write'); - -if ($protectionPointsCap < 1) { - $protectionPointsCap = 0x7FFFFFFF; -} - -$fleetArray = $session['fleet']; - -if (!is_array($fleetArray)) { - message($lang['fl_fleet_err'], $lang['fl_error'], "fleet.php", 2); -} - -// On verifie s'il y a assez de vaisseaux sur la planete ! -foreach ($fleetArray as $shipId => $count) { - if ($count > $planet->getElement($shipId)) { - message($lang['fl_fleet_err'], $lang['fl_error'], "fleet.php", 2); - } -} - -$allowedPlanetTypes = array( - Wootook_Empire_Model_Planet::TYPE_PLANET, - Wootook_Empire_Model_Planet::TYPE_DEBRIS, - Wootook_Empire_Model_Planet::TYPE_MOON - ); -if (!in_array($type, $allowedPlanetTypes)) { - message($lang['fl_fleet_err_pl'], $lang['fl_error'], "fleet.php", 2); -} - -if ($planet->getGalaxy() == $galaxy && - $planet->getSystem() == $system && - $planet->getPosition() == $position && - $planet->getType() == $type) { - message($lang['fl_ownpl_err'], $lang['fl_error'], "fleet.php", 2); -} - -$YourPlanet = false; -$UsedPlanet = false; -$coords = array( - 'galaxy' => $galaxy, - 'system' => $system, - 'position' => $position - ); -if ($mission == Legacies_Empire::ID_MISSION_RECYCLE) { - $destination = Wootook_Empire_Model_Planet::factoryFromCoords($coords); -} else { - $destination = Wootook_Empire_Model_Planet::factoryFromCoords($coords, $type); -} - -// Test d'existence de l'enregistrement dans la galaxie ! -if ($mission != Legacies_Empire::ID_MISSION_EXPEDITION) { - if (!$destination->getId()) { - if ($mission != Legacies_Empire::ID_MISSION_SETTLE_COLONY) { - message($lang['fl_unknow_target'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } else if ($mission == Legacies_Empire::ID_MISSION_DESTROY) { - message($lang['fl_used_target'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } - } else if ($mission == Legacies_Empire::ID_MISSION_DESTROY && !$destination->isMoon()) { - message($lang['fl_used_target'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } -} else { - $EnvoiMaxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY); - $Expedition = 0; - if ($EnvoiMaxExpedition > 0) { - $statement = $readAdapter->select() - ->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)')) - ->from(array('fleet' => $readAdapter->getTable('fleets'))) - ->where('fleet_owner', new Wootook_Core_Database_Sql_Placeholder_Param('player', $user->getId())) - ->where('fleet_mission', Legacies_Empire::ID_MISSION_EXPEDITION) - ->prepare() - ; - - $Expedition = $statement->fetchColumn(); - } - - if ($EnvoiMaxExpedition == 0 ) { - message ($lang['fl_expe_notech'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } else if ($Expedition >= $EnvoiMaxExpedition ) { - message ($lang['fl_expe_max'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } -} - -if ($destination->getUserId() == $user['id']) { - $YourPlanet = true; - $UsedPlanet = true; -} else if ($destination->getId()) { - $UsedPlanet = true; -} - -$missionTypes = array(); -// Determinons les type de missions possibles par rapport a la planete cible -if ($position == (Wootook::getGameConfig('engine/universe/positions') + 1)) { - $missionTypes[Legacies_Empire::ID_MISSION_EXPEDITION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION]; -} else { - if ($type == Wootook_Empire_Model_Planet::TYPE_DEBRIS) { - if (isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) { - $missionTypes[Legacies_Empire::ID_MISSION_RECYCLE] = $lang['type_mission'][Legacies_Empire::ID_MISSION_RECYCLE]; - } - } else if ($type == Wootook_Empire_Model_Planet::TYPE_PLANET) { - if (isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0 && !$UsedPlanet) { - $missionTypes[Legacies_Empire::ID_MISSION_SETTLE_COLONY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_SETTLE_COLONY]; - } - if (isset($fleetArray[Legacies_Empire::ID_SHIP_ORE_MININER]) && $fleetArray[Legacies_Empire::ID_SHIP_ORE_MININER] > 0 && !$UsedPlanet) { - $missionTypes[Legacies_Empire::ID_MISSION_ORE_MINING] = $lang['type_mission'][Legacies_Empire::ID_MISSION_ORE_MINING]; - } - } else if ($type == Wootook_Empire_Model_Planet::TYPE_MOON) { - if (((isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA]) && $fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA] > 0)) && - !$YourPlanet && $UsedPlanet) { - $missionTypes[Legacies_Empire::ID_MISSION_DESTROY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_DESTROY]; - } - if (isset($fleetArray[Legacies_Empire::ID_SHIP_ORE_MININER]) && $fleetArray[Legacies_Empire::ID_SHIP_ORE_MININER] > 0 && !$YourPlanet) { - $missionTypes[Legacies_Empire::ID_MISSION_ORE_MINING] = $lang['type_mission'][Legacies_Empire::ID_MISSION_ORE_MINING]; - } - } - - if (in_array($type, array(Wootook_Empire_Model_Planet::TYPE_MOON, Wootook_Empire_Model_Planet::TYPE_PLANET))) { - if (isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && !$YourPlanet) { - $missionTypes[Legacies_Empire::ID_MISSION_SPY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_SPY]; - } - - if ((isset($fleetArray[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT]) && $fleetArray[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT]) && $fleetArray[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_LIGHT_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_LIGHT_FIGHTER] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_CRUISER]) && $fleetArray[Legacies_Empire::ID_SHIP_CRUISER] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && Wootook::getGameConfig('engine/combat/allow_spy_drone_attacks')) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_BOMBER]) && $fleetArray[Legacies_Empire::ID_SHIP_BOMBER] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_DESTRUCTOR]) && $fleetArray[Legacies_Empire::ID_SHIP_DESTRUCTOR] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_BATTLECRUISER]) && $fleetArray[Legacies_Empire::ID_SHIP_BATTLECRUISER] > 0) || - (isset($fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA]) && $fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA] > 0)) { - - if (!$YourPlanet) { - $missionTypes[Legacies_Empire::ID_MISSION_ATTACK] = $lang['type_mission'][Legacies_Empire::ID_MISSION_ATTACK]; - $missionTypes[Legacies_Empire::ID_MISSION_GROUP_ATTACK] = $lang['type_mission'][Legacies_Empire::ID_MISSION_GROUP_ATTACK]; - $missionTypes[Legacies_Empire::ID_MISSION_STATION_ALLY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION_ALLY]; - } - $missionTypes[Legacies_Empire::ID_MISSION_TRANSPORT] = $lang['type_mission'][Legacies_Empire::ID_MISSION_TRANSPORT]; - } - - if ($YourPlanet) { - $missionTypes[Legacies_Empire::ID_MISSION_STATION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION]; - } - } -} - -if (isset($fleetArray[Legacies_Empire::ID_SHIP_SOLAR_SATELLITE])) { - $missionTypes = array(); -} - -if (!isset($missionTypes[$mission])) { - message($lang['fl_bad_mission'], $lang['fl_error'], "fleet." . PHPEXT, 2); -} - -if (!$destination->getId()) { - $destinationUser = $user; -} else { - $destinationUser = $destination->getUser(); -} - -$myGameLevel = $readAdapter->select() - ->column('total_points') - ->from(array('statpoints' => $readAdapter->getTable('statpoints'))) - ->where('stat_type', 1) - ->where('stat_code', 1) - ->where('id_owner', new Wootook_Core_Database_Sql_Placeholder_Param('player', $user->getId())) - ->prepare() - ->fetchColumn() -; -if ($destinationUser->getId()) { - $hisGameLevel = $readAdapter->select() - ->column('total_points') - ->from(array('statpoints' => $readAdapter->getTable('statpoints'))) - ->where('stat_type', 1) - ->where('stat_code', 1) - ->where('id_owner', new Wootook_Core_Database_Sql_Placeholder_Param('player', $destinationUser->getId())) - ->prepare() - ->fetchColumn() - ; -} else { - $hisGameLevel = 0; -} - -$vacationMode = $destinationUser->isVacation(); - -if ($protection) { - $protectedMissions = array( - Legacies_Empire::ID_MISSION_ATTACK, - Legacies_Empire::ID_MISSION_GROUP_ATTACK, - Legacies_Empire::ID_MISSION_STATION_ALLY, - Legacies_Empire::ID_MISSION_SPY, - Legacies_Empire::ID_MISSION_DESTROY - ); - if ($destinationUser->getId() && in_array($mission, $protectedMissions)) { - if ($myGameLevel > ($hisGameLevel * $protectionMultiplier) && $hisGameLevel < ($protectionPointsCap * 1000)) { - message($lang['fl_noob_mess_n'], $lang['fl_noob_title'], "fleet." . PHPEXT, 2); - } else if (($myGameLevel * $protectionMultiplier) < $hisGameLevel && $myGameLevel < ($protectionPointsCap * 1000)) { - message($lang['fl_noob_mess_n'], $lang['fl_noob_title'], "fleet." . PHPEXT, 2); - } - } -} - -if ($vacationMode && $mission != Legacies_Empire::ID_MISSION_RECYCLE) { - message($lang['fl_vacation_pla'], $lang['fl_vacation_ttl'], "fleet." . PHPEXT, 2); -} - -$currentFleets = $user->getFleets()->getSize(); - -if (($user->getElement(Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY) + 1) <= $currentFleets) { - message("Pas de slot disponible", "Erreur", "fleet." . PHPEXT, 1); -} - -$metal = isset($_POST['resource1']) ? intval($_POST['resource1']) : 0; -$cristal = isset($_POST['resource2']) ? intval($_POST['resource2']) : 0; -$deuterium = isset($_POST['resource3']) ? intval($_POST['resource3']) : 0; - -if ($metal + $cristal + $deuterium < 1 && $mission == Legacies_Empire::ID_MISSION_TRANSPORT) { - message("".$lang['fl_noenoughtgoods']."", $lang['type_mission'][3], "fleet." . PHPEXT, 1); -} -if ($mission != Legacies_Empire::ID_MISSION_EXPEDITION) { - $userMissions = array( - Legacies_Empire::ID_MISSION_ATTACK, - Legacies_Empire::ID_MISSION_GROUP_ATTACK, - Legacies_Empire::ID_MISSION_TRANSPORT, - Legacies_Empire::ID_MISSION_STATION, - Legacies_Empire::ID_MISSION_STATION_ALLY, - Legacies_Empire::ID_MISSION_SPY - ); - if (!$destination->getUserId() && in_array($mission, $userMissions)) { - message ($lang['fl_bad_planet01'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } - if ($destination->getId() && $mission == Legacies_Empire::ID_MISSION_SETTLE_COLONY) { - message ($lang['fl_bad_planet02'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } - if ($destination->getId() != $planet->getId() && $mission == Legacies_Empire::ID_MISSION_STATION) { - message ($lang['fl_dont_stay_here'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } - if ($destination->getElement(Legacies_Empire::ID_BUILDING_ALLIANCE_DEPOT) < 1 && $destinationUser->getId() != $user->getId() && $mission == Legacies_Empire::ID_MISSION_STATION_ALLY) { - message ($lang['fl_no_allydeposit'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } - if ($destinationUser->getId() == $user->getId() && ($mission == Legacies_Empire::ID_MISSION_ATTACK)) { - message ($lang['fl_no_self_attack'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } - if ($destinationUser->getId() == $user->getId() && ($mission == Legacies_Empire::ID_MISSION_SPY)) { - message ($lang['fl_no_self_spy'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } - if ($destinationUser->getId() != $user->getId() && $mission == Legacies_Empire::ID_MISSION_STATION) { - message ($lang['fl_only_stay_at_home'], $lang['fl_error'], "fleet." . PHPEXT, 2); - } -} - -$possibleSpeeds = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); - -$AllFleetSpeed = GetFleetMaxSpeed($fleetArray, 0, $user); -$SpeedFactor = Wootook::getGameConfig('game/speed/general'); -$MaxFleetSpeed = min($AllFleetSpeed); - -if (!in_array($speed, $possibleSpeeds)) { - message ($lang['fl_cheat_speed'], $lang['fl_error'], "fleet." . PHPEXT, 2); -} - -$error = 0; -$errorlist = ""; -if ($galaxy > Wootook::getGameConfig('engine/universe/galaxies') || $galaxy < 1) { - $error++; - $errorlist .= $lang['fl_limit_galaxy']; -} -if ($system > Wootook::getGameConfig('engine/universe/systems') || $system < 1) { - $error++; - $errorlist .= $lang['fl_limit_system']; -} -if ($position > (Wootook::getGameConfig('engine/universe/positions') + 1) || $position < 1) { - $error++; - $errorlist .= $lang['fl_limit_planet']; -} - -if ($error > 0) { - message($errorlist, $lang['fl_error'], "fleet." . PHPEXT, 2); -} - -if (!isset($fleetArray)) { - message($lang['fl_no_fleetarray'], $lang['fl_error'], "fleet." . PHPEXT, 2); -} - -$distance = GetTargetDistance($planet->getGalaxy(), $galaxy, $planet->getSystem(), $system, $planet->getPosition(), $position); -$duration = GetMissionDuration($speed, $MaxFleetSpeed, $distance, $SpeedFactor); -$consumption = GetFleetConsumption($fleetArray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user); - -$startTime = time() + $duration; -if ($mission == Legacies_Empire::ID_MISSION_EXPEDITION && isset($_POST['expeditiontime']) && is_int($_POST['expeditiontime']) - && ($expeditionTime = intval($_POST['expeditiontime'])) >= 1 && $expeditionTime <= 10) { - $StayDuration = $expeditionTime * 3600; - $StayTime = $startTime + $expeditionTime * 3600; -} elseif ($mission == Legacies_Empire::ID_MISSION_STATION_ALLY || $mission == Legacies_Empire::ID_MISSION_ORE_MINING && is_int($_POST['holdingtime']) - && ($holdingTime = intval($_POST['holdingtime'])) >= 1 && $holdingTime <= 10) { - $StayDuration = $holdingTime * 3600; - $StayTime = $startTime + $holdingTime * 3600; -} else { - $StayDuration = 0; - $StayTime = 0; -} - -/* END Refactoring */ -$endTime = $StayDuration + (2 * $duration) + time(); -$FleetStorage = 0; -$FleetShipCount = array_sum($fleetArray); -$serializedFleetArray = ''; - -foreach ($fleetArray as $shipId => $count) { - $FleetStorage += $pricelist[$shipId]["capacity"] * $count; - $serializedFleetArray .= $shipId .",". $count .";"; - $planet->setElement($shipId, $planet->getElement($shipId) - $count); -} - -$StockMetal = $planet['metal']; -$StockCrystal = $planet['cristal']; -$StockDeuterium = $planet['deuterium'] - $consumption; - -$FleetStorage -= $consumption; -$StorageNeeded = 0; -if (!isset($_POST['resource1']) || intval($_POST['resource1']) < 1) { - $TransMetal = 0; -} else { - $TransMetal = intval($_POST['resource1']); - if (Math::comp($StockMetal, $TransMetal) < 0) { - $TransMetal = $StockMetal; - } - $StorageNeeded = Math::add($TransMetal, $StorageNeeded); -} -if (!isset($_POST['resource2']) || intval($_POST['resource2']) < 1) { - $TransCrystal = 0; -} else { - $TransCrystal = intval($_POST['resource2']); - if (Math::comp($StockCrystal, $TransCrystal) < 0) { - $TransCrystal = $StockCrystal; - } - $StorageNeeded = Math::add($TransCrystal, $StorageNeeded); -} -if (!isset($_POST['resource3']) || intval($_POST['resource3']) < 1) { - $TransDeuterium = 0; -} else { - $TransDeuterium = intval($_POST['resource3']); - if (Math::comp($StockDeuterium, $TransDeuterium) < 0) { - $TransDeuterium = $StockDeuterium; - } - $StorageNeeded = Math::add($TransDeuterium, $StorageNeeded); -} - -if ($StorageNeeded > $FleetStorage) { - message($lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage), $lang['fl_error'], "fleet." . PHPEXT, 2); -} - -if ($destinationUser['authlevel'] > $user['authlevel']) { - $specialMissions = array( - Legacies_Empire::ID_MISSION_ATTACK, - Legacies_Empire::ID_MISSION_GROUP_ATTACK, - Legacies_Empire::ID_MISSION_SPY, - Legacies_Empire::ID_MISSION_DESTROY - ); - - if (in_array($mission, $specialMissions)) { - message($lang['fl_adm_attak'], $lang['fl_warning'], "fleet." . PHPEXT, 2); - } -} - -/* BEGIN Refactoring */ -try { - $writeAdapter->beginTransaction(); - - $mapper = $writeAdapter->getDataMapper(); - $dateMapper = $mapper->load('date-time'); - - $writeAdapter->insert() - ->into($writeAdapter->getTable('fleets')) - ->set('fleet_owner', $user->getId()) - ->set('fleet_mission', $mission) - ->set('fleet_amount', $FleetShipCount) - ->set('fleet_array', $serializedFleetArray) - ->set('fleet_start_time', $dateMapper->encode($startTime)) - ->set('fleet_start_galaxy', $planet->getGalaxy()) - ->set('fleet_start_system', $planet->getSystem()) - ->set('fleet_start_planet', $planet->getPosition()) - ->set('fleet_start_type', $planet->getType()) - ->set('fleet_end_time', $dateMapper->encode($endTime)) - ->set('fleet_end_stay', $dateMapper->encode($StayTime)) - ->set('fleet_end_galaxy', $galaxy) - ->set('fleet_end_system', $system) - ->set('fleet_end_planet', $position) - ->set('fleet_end_type', $type) - ->set('fleet_resource_metal', intval($TransMetal)) - ->set('fleet_resource_crystal', intval($TransCrystal)) // FIXME: refactor field name - ->set('fleet_resource_deuterium', intval($TransDeuterium)) - ->set('fleet_target_owner', $destination['id_owner']) - ->set('start_time', $dateMapper->encode(time())) - ->execute() - ; - - $planet["metal"] = $planet["metal"] - $TransMetal; - $planet["cristal"] = $planet["cristal"] - $TransCrystal; - $planet["deuterium"] = $planet["deuterium"] - $TransDeuterium - $consumption; - $planet->save(); - - $writeAdapter->commit(); -} catch (Exception $e) { - Wootook_Core_ErrorProfiler::getSingleton()->addException($e); - $writeAdapter->rollback(); - message($errorlist, $lang['fl_error'], "fleet." . PHPEXT, 2); -} -/* END Refactoring */ - -$page = "
"; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; -$page .= ""; - -$helper = Wootook_Empire_Helper_Config_Labels::getSingleton(); -foreach ($fleetArray as $shipId => $shipCount) { - $page .= ""; - $page .= ""; - $page .= ""; -} -$page .= "
". $lang['fl_fleet_send'] ."
". $lang['fl_mission'] ."". $missionTypes[$mission] ."
". $lang['fl_dist'] ."". pretty_number($distance) ."
". $lang['fl_speed'] ."". pretty_number($_POST['speedallsmin']) ."
". $lang['fl_deute_need'] ."". pretty_number($consumption) ."
". $lang['fl_from'] ."". $planet->getCoords() ."
". $lang['fl_dest'] ."". $galaxy . ':' . $system . ':' . $position ."
". $lang['fl_time_go'] ."". date("M D d H:i:s", $startTime) ."
". $lang['fl_time_back'] ."". date("M D d H:i:s", $endTime) ."
". $lang['fl_title'] ."
". $helper[$shipId]['name'] ."". pretty_number($shipCount) ."
"; - -display($page, $lang['fl_title']); diff --git a/src/galaxy.php b/src/galaxy.php deleted file mode 100644 index b3f8cb5..0000000 --- a/src/galaxy.php +++ /dev/null @@ -1,159 +0,0 @@ - - * 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 Wootook. - * - */ - -define('INSIDE' , true); -define('INSTALL' , false); -require_once dirname(__FILE__) .'/application/bootstrap.php'; - -includeLang('galaxy'); - -$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_planet'] ."';", 'planets', true); -$lunarow = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_luna'] ."';", 'lunas', true); -$galaxyrow = doquery("SELECT * FROM {{table}} WHERE `id_planet` = '". $CurrentPlanet['id'] ."';", 'galaxy', true); - -$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"]; -$fleetmax = $user['computer_tech'] + 1; -$CurrentPlID = $CurrentPlanet['id']; -$CurrentMIP = $CurrentPlanet['interplanetary_misil']; -$CurrentRC = $CurrentPlanet['recycler']; -$CurrentSP = $CurrentPlanet['spy_sonde']; -$HavePhalanx = $CurrentPlanet['phalanx']; -$CurrentSystem = $CurrentPlanet['system']; -$CurrentGalaxy = $CurrentPlanet['galaxy']; -$CanDestroy = $CurrentPlanet[$resource[213]] + $CurrentPlanet[$resource[214]]; - -$maxfleet = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '". $user['id'] ."';", 'fleets'); -$maxfleet_count = $maxfleet->rowCount(); - -if (!isset($mode)) { - if (isset($_GET['mode'])) { - $mode = intval($_GET['mode']); - } else { - $mode = 0; - } -} - -$galaxy = 1; -$system = 1; -$planet = null; - -if ($mode == 0) { - $galaxy = $CurrentGalaxy; - $system = $CurrentSystem; -} elseif ($mode == 1 || $mode == 3) { - if (isset($_POST["galaxyLeft"])) { - if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 1 || $_POST["galaxy"] > Wootook::getGameConfig('engine/universe/galaxies')) { - $galaxy = 1; - } else { - $galaxy = intval($_POST["galaxy"]) - 1; - } - } elseif (isset($_POST["galaxyRight"])) { - if (!isset($_POST["galaxy"]) || $_POST["galaxy"] >= Wootook::getGameConfig('engine/universe/galaxies')) { - $galaxy = Wootook::getGameConfig('engine/universe/galaxies'); - } else { - $galaxy = intval($_POST["galaxy"]) + 1; - } - } else if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 1 || $_POST["galaxy"] > Wootook::getGameConfig('engine/universe/galaxies')) { - $galaxy = 1; - } else { - $galaxy = intval($_POST["galaxy"]); - } - - if (isset($_POST["systemLeft"])) { - if (!isset($_POST["system"]) || $_POST["system"] <= 1 || $_POST["system"] > Wootook::getGameConfig('engine/universe/systems')) { - $system = 1; - } else { - $system = intval($_POST["system"]) - 1; - } - } elseif (isset($_POST["systemRight"])) { - if (!isset($_POST["system"]) || $_POST["system"] >= Wootook::getGameConfig('engine/universe/systems')) { - $system = Wootook::getGameConfig('engine/universe/systems'); - } else { - $system = intval($_POST["system"]) + 1; - } - } else if (!isset($_POST["system"]) || $_POST["system"] <= 1 || $_POST["system"] > Wootook::getGameConfig('engine/universe/systems')) { - $system = 1; - } else { - $system = intval($_POST["system"]); - } -} elseif ($mode == 2) { - if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 0) { - $galaxy = 1; - } else if ($_POST["galaxy"] >= Wootook::getGameConfig('engine/universe/galaxies')) { - $galaxy = Wootook::getGameConfig('engine/universe/galaxies'); - } else { - $galaxy = intval($_POST["galaxy"]) + 1; - } - - if (!isset($_POST["system"]) || $_POST["system"] <= 0) { - $system = 1; - } else if ($_POST["system"] >= Wootook::getGameConfig('engine/universe/systems')) { - $system = Wootook::getGameConfig('engine/universe/systems'); - } else { - $system = intval($_POST["system"]) + 1; - } - - if (!isset($_POST["planet"]) || $_POST["planet"] <= 0) { - $planet = 1; - } else if ($_POST["planet"] >= Wootook::getGameConfig('engine/universe/positions')) { - $planet = Wootook::getGameConfig('engine/universe/positions'); - } else { - $planet = intval($_POST["planet"]) + 1; - } -} - -$planetcount = 0; -$lunacount = 0; - -$page = InsertGalaxyScripts($CurrentPlanet); - -$page .= ShowGalaxySelector ( $galaxy, $system ); - -if ($mode == 2) { - $page .= ShowGalaxyMISelector($galaxy, $system, $planet, $CurrentPlanet['id'], $CurrentMIP); -} - -$page .= ""; - -$page .= ShowGalaxyTitles($galaxy, $system); -$page .= ShowGalaxyRows($galaxy, $system); -$page .= ShowGalaxyFooter($galaxy, $system, $CurrentMIP, $CurrentRC, $CurrentSP); - -$page .= "
"; - -display($page, $lang, false, '', false); - -// ----------------------------------------------------------------------------------------------------------- -// History version -// 1.0 - Created by Perberos -// 1.1 - Modified by -MoF- (UGamela germany) -// 1.2 - 1er Nettoyage Chlorel ... -// 1.3 - 2eme Nettoyage Chlorel ... Mise en fonction et debuging complet -?> \ No newline at end of file diff --git a/src/includes/functions/GalaxyRowUser.php b/src/includes/functions/GalaxyRowUser.php deleted file mode 100644 index 6e4f460..0000000 --- a/src/includes/functions/GalaxyRowUser.php +++ /dev/null @@ -1,136 +0,0 @@ - - * 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 Wootook. - * - */ - -/** - * - * @deprecated - * @param Wootook_Empire_Model_Planet $currentPlanet - * @param Wootook_Player_Model_Entity $currentPlayer - */ -function GalaxyRowUser($currentPlanet, $currentPlayer) { - global $user; - - if (is_array($currentPlayer)) { - $currentPlayer = new Wootook_Player_Model_Entity($currentPlayer); - } - if (is_array($currentPlanet)) { - $currentPlanet = new Wootook_Empire_Model_Planet($currentPlanet); - $currentPlanet->setData('last_update', new Wootook_Core_DateTime($currentPlanet->getData('last_update'))); - } - if (!$currentPlayer || !$currentPlayer->getId() || !$currentPlanet || $currentPlanet->isDestroyed()) { - return ''; - } - - $activeNoobProtection = Wootook::getGameConfig('game/noob-protection/active'); - $noobProtectionMultiplier = Wootook::getGameConfig('game/noob-protection/multiplier'); - $noobProtectionPointsLimit = Wootook::getGameConfig('game/noob-protection/points-cap'); - - $readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read'); - - $statement = $readAdapter->select() - ->column('total_points') - ->column('total_rank') - ->from(array('stats' => $readAdapter->getTable('statpoints'))) - ->where('id_owner', new Wootook_Core_Database_Sql_Placeholder_Variable('player_id')) - ->where('stat_code', 1) - ->where('stat_type', 1) - ->prepare() - ; - - $statement->execute(array('player_id' => $user->getId())); - $playerPoints = $statement->fetchColumn(0); - - $statement->execute(array('player_id' => $currentPlayer->getId())); - $currentPlayerPoints = $statement->fetchColumn(0); - $currentPlayerRank = $statement->fetchColumn(1); - - $classes = array(); - if ($currentPlayer->isBanned()) { - $classes['banned'] = 'B'; - } - if ($currentPlayer->isVacation()) { - $classes['vacation'] = 'V'; - } - $pastDate = new Wootook_Core_DateTime(); - $pastDate->sub(8, Wootook_Core_DateTime::DAY); - if ($pastDate->isLater($currentPlayer->getLastLoginDate())) { - $classes['inactive'] = 'i'; - } - - $pastDate->sub(22, Wootook_Core_DateTime::DAY); - if ($pastDate->isLater($currentPlayer->getLastLoginDate())) { - $classes['long-inactive'] = 'I'; - } - if ($currentPlayer->isAuthorized(LEVEL_ADMIN)) { - $classes['admin'] = 'A'; - } else if ($currentPlayer->isAuthorized(LEVEL_OPERATOR)) { - $classes['operator'] = 'O'; - } else if ($currentPlayer->isAuthorized(LEVEL_MODERATOR)) { - $classes['moderator'] = 'M'; - } - - if ($activeNoobProtection) { - if ($playerPoints <= $noobProtectionPointsLimit && ($playerPoints * $noobProtectionMultiplier) < $currentPlayerPoints) { - $classes['strong'] = 'F'; - } else if ($currentPlayerPoints <= $noobProtectionPointsLimit && ($currentPlayerPoints * $noobProtectionMultiplier) < $playerPoints) { - $classes['strong'] = 'F'; - } - } - - $output = ''; - if (count($classes) > 0) { - $output .= '' . $currentPlayer->getUsername() . ''; - foreach ($classes as $class => $identifier) { - $output .= '' . $identifier . ''; - } - } else { - $output .= '' . $currentPlayer->getUsername() . ''; - } - - if (true || $currentPlayer->getId() !== $user->getId()) { - $translator = Wootook::getTranslator(); - $messageUrl = Wootook::getStaticUrl('messages.php', array('mode' => 'write', 'id' => $currentPlayer->getId())); - $buddyUrl = Wootook::getStaticUrl('buddy.php', array('a' => '2', 'u' => $currentPlayer->getId())); - $statsUrl = Wootook::getStaticUrl('stat.php', array('who' => 'player', 'start' => 100 * floor($currentPlayerRank / 100))); - - $output .=<< -

{$translator->translate('Player: %s', $currentPlayer->getUsername())}

-

{$translator->translate('Rank: %d', $currentPlayerRank)}

-

{$translator->translate('Send a message')}

-

{$translator->translate('Add to buddy list')}

-

{$translator->translate('Statistics')}

- -HTML_EOF; - } - - $output .= ''; - return $output; -} diff --git a/src/includes/functions/MissionCaseAttack.php b/src/includes/functions/MissionCaseAttack.php deleted file mode 100644 index 44e32d1..0000000 --- a/src/includes/functions/MissionCaseAttack.php +++ /dev/null @@ -1,458 +0,0 @@ - - * 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 Wootook. - * - */ - -/** - * @deprecated - * @param unknown_type $FleetRow - */ -function MissionCaseAttack($FleetRow) -{ - global $lang; - - $pricelist = Wootook_Empire_Helper_Config_Prices::getSingleton(); - $resource = Wootook_Empire_Helper_Config_FieldsAlias::getSingleton(); - $CombatCaps = Wootook_Empire_Helper_Config_Combat::getSingleton(); - - if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] <= time()) { - -// refactored parts -// {{{ - $targetPlanet = Wootook_Empire_Model_Planet::factoryFromCoords(array( - 'galaxy' => $FleetRow['fleet_end_galaxy'], - 'system' => $FleetRow['fleet_end_system'], - 'planet' => $FleetRow['fleet_end_planet'], - 'type' => $FleetRow['fleet_end_type'] - )); - - /* - * Update planet resources and constructions - */ - Wootook::dispatchEvent('planet.update', array( - 'planet' => $targetPlanet - )); - $targetPlanet->save(); - - $TargetUser = $targetPlanet->getUser(); - $CurrentUser = Wootook_Player_Model_Entity::factory($FleetRow['fleet_owner']); - - $TargetUserID = $TargetUser->getId(); - $CurrentUserID = $CurrentUser->getId(); - - $TargetTechno = array( - 'military_tech' => $TargetUser->getData('military_tech'), - 'defence_tech' => $TargetUser->getData('defence_tech'), - 'shield_tech' => $TargetUser->getData('shield_tech') - ); - - $CurrentTechno = array( - 'military_tech' => $CurrentUser->getData('military_tech'), - 'defence_tech' => $CurrentUser->getData('defence_tech'), - 'shield_tech' => $CurrentUser->getData('shield_tech') - ); -// }}} - for ($SetItem = 200; $SetItem < 500; $SetItem++) { - if ($targetPlanet[$resource[$SetItem]] > 0) { - $TargetSet[$SetItem]['count'] = $targetPlanet[$resource[$SetItem]]; - } - } - - $TheFleet = explode(";", $FleetRow['fleet_array']); - foreach($TheFleet as $a => $b) { - if ($b != '') { - $a = explode(",", $b); - $CurrentSet[$a[0]]['count'] = $a[1]; - } - } - - include_once($xnova_root_path . 'includes/ataki.' . PHPEXT); - // Calcul de la duree de traitement (initialisation) - $mtime = microtime(); - $mtime = explode(" ", $mtime); - $mtime = $mtime[1] + $mtime[0]; - $starttime = $mtime; - - $walka = walka($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno); - // Calcul de la duree de traitement (calcul) - $mtime = microtime(); - $mtime = explode(" ", $mtime); - $mtime = $mtime[1] + $mtime[0]; - $endtime = $mtime; - $totaltime = ($endtime - $starttime); - // Ce qu'il reste de l'attaquant - $CurrentSet = $walka["atakujacy"]; - // Ce qu'il reste de l'attaqué - $TargetSet = $walka["wrog"]; - // Le resultat de la bataille - $FleetResult = $walka["wygrana"]; - // Rapport long (rapport de bataille detaillé) - $dane_do_rw = $walka["dane_do_rw"]; - // Rapport court (cdr + unitées perdues) - $zlom = $walka["zlom"]; - - $FleetArray = ""; - $FleetAmount = 0; - $FleetStorage = 0; - foreach ($CurrentSet as $Ship => $Count) { - $FleetStorage += $pricelist[$Ship]["capacity"] * $Count['count']; - $FleetArray .= $Ship . "," . $Count['count'] . ";"; - $FleetAmount += $Count['count']; - } - // Au cas ou le p'tit rigolo qu'a envoyé la flotte y avait mis des ressources ... - $FleetStorage -= $FleetRow["fleet_resource_metal"]; - $FleetStorage -= $FleetRow["fleet_resource_crystal"]; - $FleetStorage -= $FleetRow["fleet_resource_deuterium"]; - - $targetPlanetUpd = ""; - if (!is_null($TargetSet)) { - foreach($TargetSet as $Ship => $Count) { - $targetPlanetUpd .= "`" . $resource[$Ship] . "` = '" . $Count['count'] . "', "; - } - } - // Determination des ressources pillées - $Mining['metal'] = 0; - $Mining['crystal'] = 0; - $Mining['deuter'] = 0; - if ($FleetResult == "a") { - if ($FleetStorage > 0) { - $metal = $targetPlanet['metal'] / 2; - $crystal = $targetPlanet['crystal'] / 2; - $deuter = $targetPlanet["deuterium"] / 2; - if (($metal) > $FleetStorage / 3) { - $Mining['metal'] = $FleetStorage / 3; - $FleetStorage = $FleetStorage - $Mining['metal']; - } else { - $Mining['metal'] = $metal; - $FleetStorage = $FleetStorage - $Mining['metal']; - } - - if (($crystal) > $FleetStorage / 2) { - $Mining['crystal'] = $FleetStorage / 2; - $FleetStorage = $FleetStorage - $Mining['crystal']; - } else { - $Mining['crystal'] = $crystal; - $FleetStorage = $FleetStorage - $Mining['crystal']; - } - - if (($deuter) > $FleetStorage) { - $Mining['deuter'] = $FleetStorage; - $FleetStorage = $FleetStorage - $Mining['deuter']; - } else { - $Mining['deuter'] = $deuter; - $FleetStorage = $FleetStorage - $Mining['deuter']; - } - } - } - $Mining['metal'] = round($Mining['metal']); - $Mining['crystal'] = round($Mining['crystal']); - $Mining['deuter'] = round($Mining['deuter']); - // Mise a jour de l'enregistrement de la planete attaquée - $QryUpdateTarget = "UPDATE {{table}} SET "; - $QryUpdateTarget .= $targetPlanetUpd; - $QryUpdateTarget .= "`metal` = `metal` - '" . $Mining['metal'] . "', "; - $QryUpdateTarget .= "`crystal` = `crystal` - '" . $Mining['crystal'] . "', "; - $QryUpdateTarget .= "`deuterium` = `deuterium` - '" . $Mining['deuter'] . "' "; - $QryUpdateTarget .= "WHERE "; - $QryUpdateTarget .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; - $QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; - $QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND "; - $QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' "; - $QryUpdateTarget .= "LIMIT 1;"; - doquery($QryUpdateTarget , 'planets'); - // Mise a jour du champ de ruine devant la planete attaquée - $QryUpdateGalaxy = "UPDATE {{table}} SET "; - $QryUpdateGalaxy .= "`metal` = `metal` + '" . $zlom['metal'] . "', "; - $QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $zlom['crystal'] . "' "; - $QryUpdateGalaxy .= "WHERE "; - $QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; - $QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; - $QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; - $QryUpdateGalaxy .= "LIMIT 1;"; - doquery($QryUpdateGalaxy , 'galaxy'); - // Là on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune ! - $FleetDebris = $zlom['metal'] + $zlom['crystal']; - $StrAttackerUnits = sprintf ($lang['sys_attacker_lostunits'], pretty_number ($zlom["atakujacy"])); - $StrDefenderUnits = sprintf ($lang['sys_defender_lostunits'], pretty_number ($zlom["wrog"])); - $StrRuins = sprintf ($lang['sys_gcdrunits'], pretty_number ($zlom["metal"]), $lang['Metal'], pretty_number ($zlom['crystal']), $lang['Crystal']); - $DebrisField = $StrAttackerUnits . "
" . $StrDefenderUnits . "
" . $StrRuins; - $MoonChance = $FleetDebris / 100000; - if ($FleetDebris > 2000000) { - $MoonChance = 20; - } - if ($FleetDebris < 100000) { - $UserChance = 0; - $ChanceMoon = ""; - } elseif ($FleetDebris >= 100000) { - $UserChance = mt_rand(1, 100); - $ChanceMoon = sprintf ($lang['sys_moonproba'], $MoonChance); - } - - if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) { - $user = Wootook_Player_Model_Entity::factory($TargetUserID); - $user->createNewPlanet( - intval($FleetRow['fleet_end_galaxy']), - intval($FleetRow['fleet_end_system']), - intval($FleetRow['fleet_end_planet']), - Wootook_Empire_Model_Planet::TYPE_MOON, - Wootook::__('Moon') - ); - $GottenMoon = Wootook::_('A moon has been created!'); - } elseif ($UserChance = 0 or $UserChance > $MoonChance) { - $GottenMoon = ""; - } - - $AttackDate = date("r", $FleetRow["fleet_start_time"]); - $title = sprintf ($lang['sys_attack_title'], $AttackDate); - $raport = "
" . $title . "
"; - $zniszczony = false; - $a_zestrzelona = 0; - $AttackTechon['A'] = $CurrentTechno["military_tech"] * 10; - $AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10; - $AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10; - $AttackerData = sprintf ($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']); - $AttackerTech = sprintf ($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']); - - $DefendTechon['A'] = $TargetTechno["military_tech"] * 10; - $DefendTechon['B'] = $TargetTechno["defence_tech"] * 10; - $DefendTechon['C'] = $TargetTechno["shield_tech"] * 10; - $DefenderData = sprintf ($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); - $DefenderTech = sprintf ($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']); - - foreach ($dane_do_rw as $a => $b) { - $raport .= "

" . $AttackerData . "
" . $AttackerTech . ""; - if ($b["atakujacy"]['count'] > 0) { - $raport1 = ""; - $raport2 = ""; - $raport3 = ""; - $raport4 = ""; - $raport5 = ""; - foreach ($b["atakujacy"] as $Ship => $Data) { - if (is_numeric($Ship)) { - if ($Data['count'] > 0) { - $raport1 .= ""; - $raport2 .= ""; - $raport3 .= ""; - $raport4 .= ""; - $raport5 .= ""; - } - } - } - $raport1 .= ""; - $raport2 .= ""; - $raport3 .= ""; - $raport4 .= ""; - $raport5 .= ""; - $raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5; - } else { - if ($a == 2) { - $a_zestrzelona = 1; - } - $zniszczony = true; - $raport .= "
" . $lang['sys_destroyed']; - } - - $raport .= "
" . $lang['sys_ship_type'] . "
" . $lang['sys_ship_count'] . "
" . $lang['sys_ship_weapon'] . "
" . $lang['sys_ship_shield'] . "
" . $lang['sys_ship_armour'] . "" . $lang["tech_rc"][$Ship] . "" . pretty_number ($Data['count']) . "" . pretty_number (round($Data["atak"] / $Data['count'])) . "" . pretty_number (round($Data["tarcza"] / $Data['count'])) . "" . pretty_number (round($Data["obrona"] / $Data['count'])) . "
"; - $raport .= "

" . $DefenderData . "
" . $DefenderTech . ""; - if ($b["wrog"]['count'] > 0) { - $raport1 = ""; - $raport2 = ""; - $raport3 = ""; - $raport4 = ""; - $raport5 = ""; - foreach ($b["wrog"] as $Ship => $Data) { - if (is_numeric($Ship)) { - if ($Data['count'] > 0) { - $raport1 .= ""; - $raport2 .= ""; - $raport3 .= ""; - $raport4 .= ""; - $raport5 .= ""; - } - } - } - $raport1 .= ""; - $raport2 .= ""; - $raport3 .= ""; - $raport4 .= ""; - $raport5 .= ""; - $raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5; - } else { - $zniszczony = true; - $raport .= "
" . $lang['sys_destroyed']; - } - $raport .= "
" . $lang['sys_ship_type'] . "
" . $lang['sys_ship_count'] . "
" . $lang['sys_ship_weapon'] . "
" . $lang['sys_ship_shield'] . "
" . $lang['sys_ship_armour'] . "" . $lang["tech_rc"][$Ship] . "" . pretty_number ($Data['count']) . "" . pretty_number (round($Data["atak"] / $Data['count'])) . "" . pretty_number (round($Data["tarcza"] / $Data['count'])) . "" . pretty_number (round($Data["obrona"] / $Data['count'])) . "
"; - - if (($zniszczony == false) and !($a == 8)) { - $AttackWaveStat = sprintf ($lang['sys_attack_attack_wave'], pretty_number (floor($b["atakujacy"]["atak"])), pretty_number (floor($b["wrog"]["tarcza"]))); - $DefendWavaStat = sprintf ($lang['sys_attack_defend_wave'], pretty_number (floor($b["wrog"]["atak"])), pretty_number (floor($b["atakujacy"]["tarcza"]))); - $raport .= "
" . $AttackWaveStat . "
" . $DefendWavaStat . "
"; - } - } - switch ($FleetResult) { - case "a": - $Pillage = sprintf ($lang['sys_stealed_ressources'], pretty_number ($Mining['metal']), $lang['metal'], pretty_number ($Mining['crystal']), $lang['crystal'], pretty_number ($Mining['deuter']), $lang['Deuterium']); - $raport .= $lang['sys_attacker_won'] . "
" . $Pillage . "
"; - $raport .= $DebrisField . "
"; - $raport .= $ChanceMoon . "
"; - $raport .= $GottenMoon . "
"; - break; - case "r": - $raport .= $lang['sys_both_won'] . "
"; - $raport .= $DebrisField . "
"; - $raport .= $ChanceMoon . "
"; - $raport .= $GottenMoon . "
"; - break; - case "w": - $raport .= $lang['sys_defender_won'] . "
"; - $raport .= $DebrisField . "
"; - $raport .= $ChanceMoon . "
"; - $raport .= $GottenMoon . "
"; - doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets'); - break; - default: - break; - } - $SimMessage = sprintf ($lang['sys_rapport_build_time'], $totaltime); - $raport .= $SimMessage . "
"; - - $rid = md5($raport); - $QryInsertRapport = "INSERT INTO {{table}} SET "; - $QryInsertRapport .= "`time` = UNIX_TIMESTAMP(), "; - $QryInsertRapport .= "`id_owner1` = '" . $FleetRow['fleet_owner'] . "', "; - $QryInsertRapport .= "`id_owner2` = '" . $TargetUserID . "', "; - $QryInsertRapport .= "`rid` = '" . $rid . "', "; - $QryInsertRapport .= "`a_zestrzelona` = '" . $a_zestrzelona . "', "; - $QryInsertRapport .= "`raport` = '" . addslashes ($raport) . "';"; - doquery($QryInsertRapport , 'rw'); - // Colorisation du résumé de rapport pour l'attaquant - $raport = ""; - $raport .= "
"; - if ($FleetResult == "a") { - $raport .= ""; - } elseif ($FleetResult == "r") { - $raport .= ""; - } elseif ($FleetResult == "w") { - $raport .= ""; - } - $raport .= $lang['sys_mess_attack_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "]

"; - $raport .= "" . $lang['sys_perte_attaquant'] . ": " . pretty_number ($zlom["atakujacy"]) . ""; - $raport .= " " . $lang['sys_perte_defenseur'] . ":" . pretty_number ($zlom["wrog"]) . "
" ; - $raport .= $lang['sys_gain'] . " " . $lang['Metal'] . ":" . pretty_number ($Mining['metal']) . " " . $lang['Crystal'] . ":" . pretty_number ($Mining['crystal']) . " " . $lang['Deuterium'] . ":" . pretty_number ($Mining['deuter']) . "
"; - $raport .= $lang['sys_debris'] . " " . $lang['Metal'] . ":" . pretty_number ($zlom['metal']) . " " . $lang['Crystal'] . ":" . pretty_number ($zlom['crystal']) . "
"; - - $Mining['metal'] = $Mining['metal'] + $FleetRow["fleet_resource_metal"]; - $Mining['crystal'] = $Mining['crystal'] + $FleetRow["fleet_resource_crystal"]; - $Mining['deuter'] = $Mining['deuter'] + $FleetRow["fleet_resource_deuterium"]; - - $QryUpdateFleet = "UPDATE {{table}} SET "; - $QryUpdateFleet .= "`fleet_amount` = '" . $FleetAmount . "', "; - $QryUpdateFleet .= "`fleet_array` = '" . $FleetArray . "', "; - $QryUpdateFleet .= "`fleet_mess` = '1', "; - $QryUpdateFleet .= "`fleet_resource_metal` = '" . $Mining['metal'] . "', "; - $QryUpdateFleet .= "`fleet_resource_crystal` = '" . $Mining['crystal'] . "', "; - $QryUpdateFleet .= "`fleet_resource_deuterium` = '" . $Mining['deuter'] . "' "; - $QryUpdateFleet .= "WHERE fleet_id = '" . $FleetRow['fleet_id'] . "' "; - $QryUpdateFleet .= "LIMIT 1 ;"; - doquery($QryUpdateFleet , 'fleets'); - - SendSimpleMessage ($CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport); - // Ajout du petit point raideur - $AddPoint = $CurrentUser['xpraid'] + 1; - - $QryUpdateOfficier = "UPDATE {{table}} SET "; - $QryUpdateOfficier .= "`xpraid` = '" . $AddPoint . "' "; - $QryUpdateOfficier .= "WHERE id = '" . $CurrentUserID . "' "; - $QryUpdateOfficier .= "LIMIT 1 ;"; - doquery($QryUpdateOfficier, 'users'); - // Ajout d'un point au compteur de raids - $RaidsTotal = $CurrentUser['raids'] + 1; - if ($FleetResult == "a") { - $RaidsWin = $CurrentUser['raidswin'] + 1; - $QryUpdateRaidsCompteur = "UPDATE {{table}} SET "; - $QryUpdateRaidsCompteur .= "`raidswin` ='" . $RaidsWin . "', "; - $QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' "; - $QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' "; - $QryUpdateRaidsCompteur .= "LIMIT 1 ;"; - doquery($QryUpdateRaidsCompteur, 'users'); - } elseif ($FleetResult == "r" || $FleetResult == "w") { - $RaidsLoose = $CurrentUser['raidsloose'] + 1; - $QryUpdateRaidsCompteur = "UPDATE {{table}} SET "; - $QryUpdateRaidsCompteur .= "`raidswin` ='" . $RaidsLoose . "', "; - $QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' "; - $QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' "; - $QryUpdateRaidsCompteur .= "LIMIT 1 ;"; - doquery($QryUpdateRaidsCompteur, 'users'); - } - // Colorisation du résumé de rapport pour l'attaquant - $raport2 = ""; - $raport2 .= "
"; - if ($FleetResult == "a") { - $raport2 .= ""; - } elseif ($FleetResult == "r") { - $raport2 .= ""; - } elseif ($FleetResult == "w") { - $raport2 .= ""; - } - $raport2 .= $lang['sys_mess_attack_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "]

"; - - SendSimpleMessage ($TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport2); - } -// Retour de flotte (s'il en reste) - $fquery = ""; - if ($FleetRow['fleet_end_time'] <= time()) { - if (!is_null($CurrentSet)) { - foreach($CurrentSet as $Ship => $Count) { - $fquery .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` + '" . $Count['count'] . "', "; - } - } else { - $fleet = explode(";", $FleetRow['fleet_array']); - foreach($fleet as $a => $b) { - if ($b != '') { - $a = explode(",", $b); - $fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n"; - } - } - } - - doquery ("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); - if (!($FleetResult == "w")) { - $QryUpdatePlanet = "UPDATE {{table}} SET "; - $QryUpdatePlanet .= $fquery; - $QryUpdatePlanet .= "`metal` = `metal` + " . $FleetRow['fleet_resource_metal'] . ", "; - $QryUpdatePlanet .= "`crystal` = `crystal` + " . $FleetRow['fleet_resource_crystal'] . ", "; - $QryUpdatePlanet .= "`deuterium` = `deuterium` + " . $FleetRow['fleet_resource_deuterium'] . " "; - $QryUpdatePlanet .= "WHERE "; - $QryUpdatePlanet .= "`galaxy` = " . $FleetRow['fleet_start_galaxy'] . " AND "; - $QryUpdatePlanet .= "`system` = " . $FleetRow['fleet_start_system'] . " AND "; - $QryUpdatePlanet .= "`planet` = " . $FleetRow['fleet_start_planet'] . " AND "; - $QryUpdatePlanet .= "`planet_type` = " . $FleetRow['fleet_start_type'] . " LIMIT 1 ;"; - doquery($QryUpdatePlanet, 'planets'); - } - } -} diff --git a/src/includes/functions/MissionCaseColonisation.php b/src/includes/functions/MissionCaseColonisation.php deleted file mode 100644 index b736091..0000000 --- a/src/includes/functions/MissionCaseColonisation.php +++ /dev/null @@ -1,138 +0,0 @@ - - * 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 Wootook. - * - */ - -/** - * - * @deprecated - * @param Wootook_Empire_Model_Fleet|array $fleet - */ -function MissionCaseColonisation($fleet) -{ - $readConnection = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read'); - - $player = new Wootook_Player_Model_Entity(); - $player->load($fleet->getData('fleet_owner')); - if (!$player->getId()) { - $fleet->delete(); - return; - } - - $event = Wootook::dispatchEvent('fleet.mission.colonize.max-allowed-planets', array( - 'base_count' => MAX_PLAYER_PLANETS, - 'count' => MAX_PLAYER_PLANETS, - 'player' => $player, - 'fleet' => $fleet - )); - - $maxAllowedPlanetCount = $event->getData('count'); - - /* first trip */ - if ($fleet->getData('fleet_mess') == 0) { - if ($fleet->getActionTime()->isEarlier()) { - return; - } - if ($player->getPlanetCollection()->getSize() >= $maxAllowedPlanetCount && !$player->isAuthorized(array(LEVEL_ADMIN))) { - /* no more planets to colonize */ - - $coords = sprintf('%d:%d:%d', $fleet->getData('fleet_end_galaxy'), $fleet->getData('fleet_end_system'), $fleet->getData('fleet_end_planet')); - SendSimpleMessage($player->getId(), null, $fleet['fleet_end_time'], 0, - Wootook::__('Colonization'), Wootook::__('Colonization report'), - Wootook::__("The fleet has arrived at the coordinates [%1\$s], but unfortunatly colonization cannot happen : you can't have more than %2\$d colonies.", $coords, $maxAllowedPlanetCount)); - - $fleet->goBack(); - return; - } - - $statement = $readConnection->select() - ->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)')) - ->from($readConnection->getTable('planets')) - ->where('galaxy', $fleet->getData('fleet_end_galaxy')) - ->where('system', $fleet->getData('fleet_end_system')) - ->where('planet', $fleet->getData('fleet_end_planet')) - ->prepare() - ; - - $statement->execute(); - if ($statement->fetchColumn() > 0) { - $coords = sprintf('%d:%d:%d', $fleet->getData('fleet_end_galaxy'), $fleet->getData('fleet_end_system'), $fleet->getData('fleet_end_planet')); - SendSimpleMessage($player->getId(), null, $fleet['fleet_end_time'], 0, - Wootook::__('Colonization'), Wootook::__('Colonization report'), - Wootook::__("The fleet has arrived at the coordinates [%1\$s], but unfortunatly colonization cannot happen : the planet is already colonized.", $coords)); - - $fleet->goBack(); - return; - } - - if (mt_rand(0, 100) >= 75) { - $baseSize = Wootook::getGameConfig('planet/initial/fields'); - $factor = 2 * $position / (1 + log($position)); - $fuzz = 2 * $factor * pow(sin($factor), 2) / 2 + $factor / 4; - $size = ($baseSize * mt_rand(floor($factor / 10), ceil($factor * 5 / 4))) + mt_rand(0, $fuzz); - - $player->createNewPlanet( - $fleet->getData('fleet_end_galaxy'), - $fleet->getData('fleet_end_system'), - $fleet->getData('fleet_end_planet'), - Wootook_Empire_Model_Planet::TYPE_PLANET, - Wootook::__('Colony'), - $size - ); - - $coords = sprintf('%d:%d:%d', $fleet->getData('fleet_end_galaxy'), $fleet->getData('fleet_end_system'), $fleet->getData('fleet_end_planet')); - SendSimpleMessage($player->getId(), null, $fleet['fleet_end_time'], 0, - Wootook::__('Colonization'), Wootook::__('Colonization report'), - Wootook::__("The fleet has arrived at the coordinates [%1\$s], the settlers succeeded creating your new colony.", $coords)); - - $fleet->delete(); - return; - } else { - $coords = sprintf('%d:%d:%d', $fleet->getData('fleet_end_galaxy'), $fleet->getData('fleet_end_system'), $fleet->getData('fleet_end_planet')); - SendSimpleMessage($player->getId(), null, $fleet['fleet_end_time'], 0, - Wootook::__('Colonization'), Wootook::__('Colonization report'), - Wootook::__("The fleet has arrived at the coordinates [%1\$s], the settlers failed creating your new colony, no planet was there.", $coords)); - - $fleet->goBack(); - return; - } - } - - /* back trip */ - if ($fleet->getArrivalTime()->isEarlier()) { - return; - } - - $fleet->dock($fleet->getOriginPlanet()); - - $coords = sprintf('%d:%d:%d', $fleet->getData('fleet_end_galaxy'), $fleet->getData('fleet_end_system'), $fleet->getData('fleet_end_planet')); - SendSimpleMessage($player->getId(), null, $fleet['fleet_end_time'], 0, - Wootook::__('Colonization'), Wootook::__('Colonization report'), - Wootook::__("The fleet went back from the coordinates [%1\$s], the settlers failed creating your new colony.", $coords)); - return; -} \ No newline at end of file diff --git a/src/includes/functions/MissionCaseExploit.php b/src/includes/functions/MissionCaseExploit.php deleted file mode 100644 index 5b424c6..0000000 --- a/src/includes/functions/MissionCaseExploit.php +++ /dev/null @@ -1,137 +0,0 @@ - - * 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 Wootook. - * - */ - -/** - * - * @deprecated - * @param unknown_type $fleet - */ -function MissionCaseExploit($fleet) -{ - global $lang; - - $prices = Wootook_Empire_Helper_Config_Prices::getSingleton(); - $player = Wootook_Player_Model_Session::getSingleton()->getPlayer(); - $writeAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write'); - - $userId = $fleet['fleet_owner']; - $MessSender = $lang['sys_mess_qg']; - $MessTitle = $lang['sys_expe_report']; - - if ($fleet['fleet_mess'] == 0) { - if ($fleet['fleet_end_stay'] < time()) { - $stayDuration = ($fleet['fleet_end_stay'] - $fleet['fleet_start_time']); - - $shipList = array(); - $fleetCapacity = array(); - $storageShips = array( - Legacies_Empire::ID_SHIP_ORE_MININER, - Legacies_Empire::ID_SHIP_DEATH_STAR, - Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT, - Legacies_Empire::ID_SHIP_LARGE_TRANSPORT, - Legacies_Empire::ID_SHIP_SUPERNOVA, - ); - foreach (explode(";", $fleet['fleet_array']) as $shipData) { - if ($shipData) { - $shipData = explode(',', $shipData); - if (count($shipData) != 2) { - continue; - } - - $shipList[$shipData[0]] = $shipData[1]; - - if (in_array($shipData[0], $storageShips) && isset($prices[$shipData[0]]) && isset($prices[$shipData[0]]['capacity'])) { - $fleetCapacity += $prices[$shipData[0]]['capacity']; - } - } - } - - if (!isset($shipList[Legacies_Empire::ID_SHIP_ORE_MININER])) { - return; - } - - $fleetSentResources = $fleet['fleet_resource_metal'] + $fleet['fleet_resource_crystal'] + $fleet['fleet_resource_deuterium']; - $fleetAvailableCapacity = $fleetCapacity - $fleetSentResources; - - $minerCount = $shipList[Legacies_Empire::ID_SHIP_ORE_MININER]; - - mt_srand(); - $miningAmount = Math::mul(Math::mul($minerCount, $stayDuration), Math::pow(1.2, $player->getElement(Legacies_Empire::ID_RESEARCH_ORE_MINING))); - - $random = mt_rand(1, 10000); - $metalOreAmount = Math::mul($miningAmount, Math::div($random, 10000)); - - $random = mt_rand(1, 10000); - $cristalOreAmount = Math::mul($miningAmount, Math::div($random, 10000)); - - $totalOreAmount = Math::add($metalOreAmount, $cristalOreAmount); - if (Math::comp($totalOreAmount, $fleetAvailableCapacity) > 0) { - $ratio = Math::div($fleetAvailableCapacity, $totalOreAmount); - - $metalOreAmount = Math::mul($metalOreAmount, $ratio); - $cristalOreAmount = Math::mul($cristalOreAmount, $ratio); - } - - $statement = $writeAdapter->update() - ->into($writeAdapter->getTable('fleets')) - ->set('fleet_resource_metal', Math::add($fleet['fleet_resource_metal'], $metalOreAmount)) - ->set('fleet_resource_crystal', Math::add($fleet['fleet_resource_crystal'], $cristalOreAmount)) - ->prepare() - ; - $statement->execute(); - } - } else { - // La Flotte est de retour a quai - if ($fleet['fleet_end_time'] < time()) { - $coords = array( - 'galaxy' => $fleet['fleet_start_galaxy'], - 'system' => $fleet['fleet_start_system'], - 'position' => $fleet['fleet_start_planet'] - ); - $planet = Wootook_Empire_Model_Planet::factoryFromCoords($coords, $fleet['fleet_start_type']); - if (!$planet->getId() || $planet->getPlayerId() != $player->getId()) - foreach (explode(";", $fleet['fleet_array']) as $shipData) { - if ($shipData) { - $shipData = explode(',', $shipData); - if (count($shipData) != 2) { - continue; - } - - $planet->setElement($shipData[0], Math::add($planet->getElement($shipData[0]), $shipData[1])); - } - } - $planet->save(); - - SendSimpleMessage($userId, '', $fleet['fleet_end_time'], 15, $MessSender, $MessTitle, $lang['sys_expe_back_home']); - - $writeAdapter->delete()->from($writeAdapter->getTable('fleets'))->where('fleet_id', $fleet['fleet_id']); - } - } -} diff --git a/src/includes/functions/ShowGalaxyRows.php b/src/includes/functions/ShowGalaxyRows.php deleted file mode 100644 index fa5eef7..0000000 --- a/src/includes/functions/ShowGalaxyRows.php +++ /dev/null @@ -1,121 +0,0 @@ - - * 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 Wootook. - * - */ - -/** - * - * @deprecated - * @param int $Galaxy - * @param int $System - */ -function ShowGalaxyRows($Galaxy, $System) -{ - global $planetcount; - - $readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read'); - - $galaxyStatement = $readAdapter->select() - ->column('*') - ->from($readAdapter->getTable('galaxy')) - ->where('galaxy', $Galaxy) - ->where('system', $System) - ->where('planet', new Wootook_Core_Database_Sql_Placeholder_Variable('planet')) - ->limit(1) - ->prepare() - ; - - $planetStatement = $readAdapter->select() - ->column('*') - ->from($readAdapter->getTable('planets')) - ->where('id', new Wootook_Core_Database_Sql_Placeholder_Variable('planet_id')) - ->limit(1) - ->prepare() - ; - - $output = ""; - for ($Planet = 1; $Planet <= Wootook::getGameConfig('engine/universe/positions'); $Planet++) { - if ($galaxyStatement->execute(array('planet' => $Planet))) { - /** @var Wootook_Empire_Model_Galaxy_Position $galaxyPosition */ - $galaxyPosition = $galaxyStatement->fetchEntity('Wootook_Empire_Model_Galaxy_Position'); - } else { - $output .= ''; - continue; - } - - $output .= ""; - if ($galaxyPosition->getData('galaxy') && $galaxyPosition["id_planet"] != 0) { - if ($planetStatement->execute(array('planet_id' => $galaxyPosition["id_planet"]))) { - /** @var Wootook_Empire_Model_Planet $currentPlanet */ - $currentPlanet = $planetStatement->fetchEntity('Wootook_Empire_Model_Planet'); - } else { - $currentPlanet = new Wootook_Empire_Model_Planet(); - } - - if ($currentPlanet->getId() && !$currentPlanet->isDestroyed()) { - $planetcount++; - $currentPlayer = $currentPlanet->getPlayer(); - } else { - CheckAbandonPlanetState($currentPlanet); - $currentPlayer = new Wootook_Player_Model_Entity(); - } - - if ($galaxyPosition["id_luna"] != 0) { - if ($planetStatement->execute(array('planet_id' => $galaxyPosition["id_luna"]))) { - /** @var Wootook_Empire_Model_Planet $currentMoon */ - $currentMoon = $planetStatement->fetchEntity('Wootook_Empire_Model_Planet'); - } else { - $currentMoon = new Wootook_Empire_Model_Planet(); - } - - if ($currentMoon->isDestroyed()) { - CheckAbandonMoonState($currentMoon); - } - } else { - $currentMoon = new Wootook_Empire_Model_Planet(); - } - } else { - $currentPlanet = new Wootook_Empire_Model_Planet(); - $currentPlayer = new Wootook_Player_Model_Entity(); - $currentMoon = new Wootook_Empire_Model_Planet(); - } - $output .= GalaxyRowPos($Planet, $galaxyPosition); - $output .= GalaxyRowPlanet($galaxyPosition, $currentPlanet, $currentPlayer, $Galaxy, $System, $Planet, 1); - $output .= GalaxyRowPlanetName($galaxyPosition, $currentPlanet, $currentPlayer, $Galaxy, $System, $Planet, 1); - $output .= GalaxyRowMoon($galaxyPosition, $currentMoon , $currentPlayer, $Galaxy, $System, $Planet, 3); - $output .= GalaxyRowDebris($galaxyPosition, $currentPlanet, $currentPlayer, $Galaxy, $System, $Planet, 2); - $output .= GalaxyRowUser($currentPlanet, $currentPlayer); - $output .= GalaxyRowAlly($galaxyPosition, $currentPlanet, $currentPlayer, $Galaxy, $System, $Planet, 0); - $output .= GalaxyRowActions($galaxyPosition, $currentPlanet, $currentPlayer, $Galaxy, $System, $Planet, 0); - $output .= ""; - } - - return $output; -} - -?> \ No newline at end of file diff --git a/src/includes/todofleetcontrol.php b/src/includes/todofleetcontrol.php deleted file mode 100644 index 819c79f..0000000 --- a/src/includes/todofleetcontrol.php +++ /dev/null @@ -1,74 +0,0 @@ - - * 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 Wootook. - * - */ - -require_once ROOT_PATH . 'includes/deprecated.php'; - -/** - * @deprecated - * {{{ - */ -include(ROOT_PATH . 'includes/functions/MissionCaseAttack.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/MissionCaseStay.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/MissionCaseStayAlly.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/MissionCaseTransport.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/MissionCaseSpy.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/MissionCaseRecycling.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/MissionCaseDestruction.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/MissionCaseColonisation.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/MissionCaseExpedition.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/SendSimpleMessage.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/SpyTarget.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/RestoreFleetToPlanet.'.PHPEXT); -include(ROOT_PATH . 'includes/functions/StoreGoodsToPlanet.'.PHPEXT); // includes/functions/StoreGoodsToPlanet.php -include(ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.'.PHPEXT); // infos.php, includes/functions/BuildFleetEventTable.php -include(ROOT_PATH . 'includes/functions/InsertGalaxyScripts.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyCheckFunctions.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/ShowGalaxyRows.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GetPhalanxRange.'.PHPEXT); // <- TODO: delete -include(ROOT_PATH . 'includes/functions/GetMissileRange.'.PHPEXT); // <- TODO: delete -include(ROOT_PATH . 'includes/functions/GalaxyRowPos.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyRowPlanet.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyRowPlanetName.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyRowMoon.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyRowDebris.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyRowUser.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyRowAlly.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyRowActions.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/ShowGalaxySelector.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/ShowGalaxyMISelector.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/ShowGalaxyTitles.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/GalaxyLegendPopup.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/ShowGalaxyFooter.'.PHPEXT); // galaxy.php -include(ROOT_PATH . 'includes/functions/MessageForm.'.PHPEXT); // alliance.php -include(ROOT_PATH . 'includes/functions/MipCombatEngine.'.PHPEXT); // mipattack.php -include(ROOT_PATH . 'includes/functions/BuildFleetEventTable.'.PHPEXT); // phalanx.php -/** - * }}} - */ diff --git a/src/install/gameplays.php b/src/install/gameplays.php deleted file mode 100644 index ab036c5..0000000 --- a/src/install/gameplays.php +++ /dev/null @@ -1,26 +0,0 @@ - array( - 'label' => 'Legacies', - 'description' => "Conquer planets and grow your outer space empire, fight against other space emperors and master the outer space.", - 'modules' => array( - 'Wootook_Core' => array( - 'code_pool' => 'core', - 'version' => '1.5.0' - ), - 'Wootook_Empire' => array( - 'code_pool' => 'core', - 'version' => '1.5.0' - ), - 'Legacies_Empire' => array( - 'code_pool' => 'core', - 'version' => '1.5.0' - ), -/* - 'Legacies_Officers' => array( - 'code_pool' => 'core', - 'version' => '1.5.0' - ), -*/ - ) - ) - ); diff --git a/src/install/index.php b/src/install/index.php deleted file mode 100644 index d96aacc..0000000 --- a/src/install/index.php +++ /dev/null @@ -1,592 +0,0 @@ - - * 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 Wootook. - * - */ - -define('DEBUG', true); -define('DEPRECATION', true); - -define('STEP_SYSTEM', 1); -define('STEP_DATABASE', 2); -define('STEP_UNIVERSE', 3); -define('STEP_PROFILE', 4); -define('STEP_CONFIG', 5); - -if (!defined('DEBUG') && ($env = getenv('DEBUG')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) { - define('DEBUG', true); -} else if (!defined('DEBUG') && isset($_SERVER['DEBUG']) && in_array(strtolower($_SERVER['DEBUG']), array('1', 'on', 'true'))) { - define('DEBUG', true); -} - -if (!defined('DEPRECATION') && ($env = getenv('DEPRECATION')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) { - define('DEPRECATION', true); -} else if (!defined('DEPRECATION') && isset($_SERVER['DEPRECATION']) && in_array(strtolower($_SERVER['DEPRECATION']), array('1', 'on', 'true'))) { - define('DEPRECATION', true); -} - -if (!defined('BCNUMBERS') && ($env = getenv('BCNUMBERS')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) { - define('BCNUMBERS', true); -} else if (!defined('BCNUMBERS') && isset($_SERVER['BCNUMBERS']) && in_array(strtolower($_SERVER['BCNUMBERS']), array('1', 'on', 'true'))) { - define('BCNUMBERS', true); -} - -if (!defined('DEBUG')) { - @ini_set('display_errors', false); -} else { - @ini_set('display_errors', true); - @error_reporting(E_ALL | E_STRICT); -} - -defined('ROOT_PATH') || define('ROOT_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR); -defined('APPLICATION_PATH') || define('APPLICATION_PATH', ROOT_PATH . 'application' . DIRECTORY_SEPARATOR); - -defined('PHPEXT') || define('PHPEXT', 'php'); - -defined('VERSION') || define('VERSION', '1.5.0-beta2'); - -set_include_path(implode(PATH_SEPARATOR, array( - APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'libraries', - APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'local', - APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'community', - APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'core', - get_include_path() - ))); - -function __autoload($class) { - include_once str_replace('_', '/', $class) . '.php'; -} - -Wootook::$isInstalled = false; - -include ROOT_PATH . 'includes' . DIRECTORY_SEPARATOR . 'constants.php'; - -Wootook_Core_ErrorProfiler::register(); -Wootook_Core_Helper_Config_Events::registerEvents(); - -$mode = isset($_GET['mode']) ? strval($_GET['mode']) : 'intro'; -$step = isset($_GET['step']) ? intval($_GET['step']) : 1; -$prevStep = $step - 1; -$nextStep = $step + 1; - -$baseUrl = (isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) == "on" ? 'https://' : 'http://') - . $_SERVER["SERVER_NAME"] . ($_SERVER["SERVER_PORT"] != "80" ? ":{$_SERVER["SERVER_PORT"]}" : ''); - -if (isset($_SERVER['REQUEST_URI'])) { - $pathOffset = strrpos($_SERVER['REQUEST_URI'], 'install/'); - $baseUrl .= substr($_SERVER['REQUEST_URI'], 0, strpos(substr($_SERVER['REQUEST_URI'], 0, -1), '/')) . '/'; -} -$session = Wootook::getSession('install'); - -$website = new Wootook_Core_Model_Website(); -$website->setId(0)->setData('code', Wootook_Core_Model_Website::DEFAULT_CODE); -Wootook::setDefaultWebsite($website); - -$game = new Wootook_Core_Model_Game(); -$game->setId(0)->setData('code', Wootook_Core_Model_Game::DEFAULT_CODE); -Wootook::setDefaultGame($game); - -$configRewrites = array( - 'default' => array( - 'web' => array( - 'url' => array( - 'base' => $baseUrl, - 'link' => $baseUrl, - 'skin' => $baseUrl . 'skin/', - 'js' => $baseUrl . 'js/', - 'css' => $baseUrl . 'css/' - ) - ), - 'system' => array( - 'path' => array( - 'base' => ROOT_PATH, - 'design' => APPLICATION_PATH . 'design' . DIRECTORY_SEPARATOR, - 'skin' => ROOT_PATH . 'skin' . DIRECTORY_SEPARATOR, - ) - ), - 'package' => 'default', - 'theme' => 'default', - 'layout' => array( - 'page' => 'page.xml', - 'install' => 'install.php' - ), - 'engine' => array( - 'storyline' => array( - 'universe' => 'legacies', - 'episode' => 'default', - ) - ), - 'resources' => array( - 'initial' => array( - 'metal' => 500, - 'cristal' => 500, - 'deuterium' => 0, - 'energy' => 0, - ), - 'base-income' => array( - 'metal' => 20, - 'cristal' => 10, - 'deuterium' => 0, - 'energy' => 0, - ), - ), - 'planet' => array( - 'initial' => array( - 'fields' => 163 - ) - ) - ) - ); - -$config = unserialize($session->getData('config')); -if (is_array($config)) { - Wootook::loadConfig(array_merge_recursive($config, $configRewrites)); -} else { - Wootook::loadConfig($configRewrites); -} -unset($config); - -$layout = new Wootook_Core_Model_Layout('install'); - -$request = new Wootook_Core_Mvc_Controller_Request_Http(); -$response = new Wootook_Core_Mvc_Controller_Response_Http(); - -switch ($mode) { -case 'intro': - $layout->load('install.intro'); - $layout->getMessagesBlock()->prepareMessages('install'); - $session->setData('step', 1); - break; - -case 'install': - if ($step > $session->getData('step')) { - $session->setData('step', 0); - $response->setRedirect("?mode=intro", Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_TEMPORARY); - $response->sendHeaders(); - exit(0); - } - - switch ($step) { - case STEP_SYSTEM: - if ($request->isPost()) { - $form = new Wootook_Core_Form($session, array( - 'url_path' => 'text', - 'timezone' => 'text' - )); - $form->setRequest($request); - $form->populate(); - - if (!$form->validate()) { - $session->setData('step', STEP_SYSTEM); - $session->setFormData($form->getData()); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_SYSTEM))); - $response->sendHeaders(); - exit(0); - } - - $urlPath = $request->getPost('url_path'); - - $config = array( - 'global' => array( - 'resource' => array() - ), - 'backend' => array( - 'web' => array( - 'url' => array( - 'base' => $request->getPost('url_path'), - 'link' => $request->getPost('url_path') . 'admin/', - 'skin' => $request->getPost('url_path') . 'skin/', - 'js' => $request->getPost('url_path') . 'js/', - 'css' => $request->getPost('url_path') . 'css/', - ) - ), - 'system' => array( - 'path' => array( - 'base' => ROOT_PATH, - 'skin' => ROOT_PATH . 'skin' . DIRECTORY_SEPARATOR, - 'design' => ROOT_PATH . 'application' . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR, - ), - 'date' => array( - 'timezone' => $request->getPost('timezone') - ) - ), - ), - 'frontend' => array( - 'web' => array( - 'url' => array( - 'base' => $request->getPost('url_path'), - 'link' => $request->getPost('url_path'), - 'skin' => $request->getPost('url_path') . 'skin/', - 'js' => $request->getPost('url_path') . 'js/', - 'css' => $request->getPost('url_path') . 'css/', - ) - ), - 'system' => array( - 'path' => array( - 'base' => ROOT_PATH, - 'skin' => ROOT_PATH . 'skin' . DIRECTORY_SEPARATOR, - 'design' => ROOT_PATH . 'application' . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR, - ), - 'date' => array( - 'timezone' => $request->getPost('timezone') - ) - ), - 'engine' => array( - 'storyline' => array( - 'universe' => 'legacies', - 'episode' => 'default', - ), - 'core' => array( - 'use_large_numbers' => true - ), - 'universe' => array( - 'galaxies' => 3, - 'systems' => 100, - 'positions' => 15 - ), - 'combat' => array( - 'allow_spy_drone_attacks' => true - ) - ), - 'locales' => array( - 'fr' => 'fr_FR', - 'fr_FR' => 'fr_FR', - 'en' => 'en_US', - 'en_US' => 'en_US' - ) - ) - ); - $session->setData('config', serialize($config)); - - $session->setData('step', STEP_DATABASE); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_DATABASE))); - $response->sendHeaders(); - exit(0); - } - - $layout->load('install.step.system'); - $layout->getMessagesBlock()->prepareMessages('install'); - break; - - case STEP_DATABASE: - $config = unserialize($session->getData('config')); - if (isset($config['global']['database'])) { - $session->setFormData(array( - 'host' => $config['global']['database']['default']['params']['hostname'], - 'port' => $config['global']['database']['default']['params']['port'], - 'user' => $config['global']['database']['default']['params']['username'], - 'password' => $config['global']['database']['default']['params']['password'], - 'dbname' => $config['global']['database']['default']['params']['database'], - 'prefix' => $config['global']['database']['default']['table_prefix'], - )); - } - - if ($request->isPost()) { - $form = new Wootook_Core_Form($session, array( - 'host' => 'text', - 'port' => 'text', - 'user' => 'text', - 'password' => 'text', - 'dbname' => 'text', - 'prefix' => 'text', - )); - $form->setRequest($request); - $form->populate(); - - if (!$form->validate()) { - $session->setData('step', STEP_DATABASE); - $session->setFormData($request->getAllDatas()); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_DATABASE))); - $response->sendHeaders(); - exit(0); - } - - if ($request->getPost('test')) { - $data = array( - 'status' => 'pending', - 'message' => '' - ); - - try { - $hostname = $request->getPost('host'); - $username = $request->getPost('user'); - $password = $request->getPost('password'); - $database = $request->getPost('dbname'); - $port = $request->getPost('port'); - - $connection = new Wootook_Core_Database_Adapter_Pdo_Mysql("mysql:dbname={$database};host={$hostname};port={$port}", $username, $password); - $data['status'] = 'success'; - } catch (PDOException $e) { - $data['status'] = 'error'; - $data['message'] = $e->getMessage(); - } - - Wootook_Core_ErrorProfiler::unregister(true); - $response->setHeader('Content-Type', 'application/json'); - $response->setBody(json_encode($data)); - - $response->sendHeaders(); - echo $response->sendBody(); - exit(0); - } - - $config = unserialize($session->getData('config')); - $config['global']['resource']['database'] = array( - 'default' => array( - 'engine' => 'pdo.mysql', - 'options' => array( - ), - 'params' => array( - 'hostname' => $request->getPost('host'), - 'username' => $request->getPost('user'), - 'password' => $request->getPost('password'), - 'database' => $request->getPost('dbname'), - 'port' => $request->getPost('port') - ), - 'table_prefix' => $request->getPost('prefix'), - ), - 'core_setup' => array( - 'use' => 'default' - ), - 'core_read' => array( - 'use' => 'default' - ), - 'core_write' => array( - 'use' => 'default' - ), - ); - $session->setData('config', serialize($config)); - - $session->setData('step', STEP_UNIVERSE); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE))); - $response->sendHeaders(); - exit(0); - } - - $layout->load('install.step.database'); - $layout->getMessagesBlock()->prepareMessages('install'); - break; - - case STEP_UNIVERSE: - if ($request->isPost()) { - $form = new Wootook_Core_Form($session, array( - 'galaxies' => 'text', - 'systems' => 'text', - 'positions' => 'text', - - 'allow_spy_drone_attacks' => 'text', - 'use_large_numbers' => 'text' - )); - $form->setRequest($request); - $form->populate(); - - if (!$form->validate()) { - $session->setData('step', STEP_UNIVERSE); - $session->setFormData($request->getAllDatas()); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); - $response->sendHeaders(); - exit(0); - } - - $config = unserialize($session->getData('config')); - $config['default'] = array( - 'engine' => array( - 'core' => array( - 'use_large_numbers' => (bool) $request->getPost('use_large_numbers') - ), - 'universe' => array( - 'galaxies' => $request->getPost('galaxies'), - 'systems' => $request->getPost('systems'), - 'positions' => $request->getPost('positions') - ), - 'combat' => array( - 'allow_spy_drone_attacks' => (bool) $request->getPost('allow_spy_drone_attacks') - ) - ), - ); - $session->setData('config', serialize($config)); - $writer = new Wootook_Core_Config_Adapter_Array(); - $writer->setData($config); - $writer->save(APPLICATION_PATH . 'configs' . DIRECTORY_SEPARATOR . 'local.php'); - - Wootook::loadConfig(array_merge_recursive($writer->toArray(), $configRewrites)); - - $galaxyCount = Wootook::getConfig('engine/universe/galaxies'); - $systemCount = Wootook::getConfig('engine/universe/systems'); - - $gameplays = include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'gameplays.php'; - $gameplayKey = Wootook::getConfig('storyline/universe'); - if (!isset($gameplays[$gameplayKey])) { - $gameplayKey = key($gameplays); - } - $moduleList = $gameplays[$gameplayKey]['modules']; - - $installedModules = array(); - $updater = new Wootook_Core_Setup_Updater(); - foreach ($moduleList as $module => $moduleData) { - $version = $moduleData['version']; - $codePool = $moduleData['code_pool']; - $modulePath = str_replace('_', DIRECTORY_SEPARATOR, $module); - - $scriptPath = APPLICATION_PATH . 'code' . DIRECTORY_SEPARATOR . $codePool - . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . 'install' - . DIRECTORY_SEPARATOR . 'mysql5'; - - try { - $queue = new Wootook_Core_Setup_Updater_ScriptQueue($scriptPath, null, $version); - - foreach ($queue as $installScript) { - $updater->run($installScript['script']); - $installedModules[$module] = $installScript['version']['version']; - } - } catch (Wootook_Core_Setup_Exception_VersionStageError $e) { - Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); - continue; - } catch (Wootook_Core_Setup_Exception_VersionValueError $e) { - Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); - continue; - } catch (Wootook_Core_Setup_Exception_RuntimeException $e) { - $session->addError($e->getMessage()); - Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e); - - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE))); - $response->sendHeaders(); - exit(0); - break; - } - } - $path = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'gamedata' . DIRECTORY_SEPARATOR - . $gameplayKey . DIRECTORY_SEPARATOR . 'version.php'; - file_put_contents($path, '<' . '?p' . 'hp ' . var_export($installedModules, true) . ';'); - - $session->addSuccess(Wootook::__('Game data successfully initialized.')); - $session->setData('step', STEP_PROFILE); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); - $response->sendHeaders(); - exit(0); - } - - $layout->load('install.step.universe'); - $layout->getMessagesBlock()->prepareMessages('install'); - break; - - case STEP_PROFILE: - if ($request->isPost()) { - $form = new Wootook_Core_Form($session, array( - 'username' => 'text', - 'email' => 'text', - 'email_confirm' => 'text', - 'password' => 'text', - 'password_confirm' => 'text', - )); - $form->setRequest($request); - $form->populate(); - - if (!$form->validate()) { - $session->setData('step', STEP_PROFILE); - $session->setFormData($request->getAllDatas()); - $session->addError(Wootook::__('Form data error.')); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); - $response->sendHeaders(); - exit(0); - } - - if ($request->getPost('password') != $request->getPost('password_confirm')) { - $session->setData('step', STEP_PROFILE); - $session->setFormData($request->getAllDatas()); - $session->addError(Wootook::__('Passwords does not match.')); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); - $response->sendHeaders(); - exit(0); - } - - if ($request->getPost('email') != $request->getPost('email_confirm')) { - $session->setData('step', STEP_PROFILE); - $session->setFormData($request->getAllDatas()); - $session->addError(Wootook::__('Both e-mails does not match.')); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); - $response->sendHeaders(); - exit(0); - } - - try { - $user = Wootook_Player_Model_Entity::register($request->getPost('username'), $request->getPost('email'), $request->getPost('password')); - } catch (Wootook_Empire_Exception_RuntimeException $e) { - } - - $layout->getMessagesBlock()->prepareMessages('user'); - if (!$user || !$user->getId()) { - $session->setData('step', STEP_PROFILE); - $session->setFormData($request->getAllDatas()); - $session->addError(Wootook::__('Could not create user.')); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE))); - $response->sendHeaders(); - exit(0); - } else { - Wootook_Player_Model_Session::getSingleton()->setLoggedIn($user); - - $user->setData('authlevel', LEVEL_ADMIN)->save(); - - $user->getHomePlanet()->setName(Wootook::__('Planet'))->save(); - } - - $session->setData('step', STEP_CONFIG); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'install', 'step' => STEP_CONFIG))); - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'summary'))); - $response->sendHeaders(); - exit(0); - } - - $layout->load('install.step.profile'); - $layout->getMessagesBlock()->prepareMessages('install'); - break; - - case STEP_CONFIG: - //* - $response->setRedirect(Wootook::getStaticUrl('install/index.php', array('mode' => 'summary'))); - $response->sendHeaders(); - exit(0); - /*/ - if ($request->isPost()) { - $session->setData('step', $step); - $response->setRedirect("?mode=install&step={$nextStep}"); - $response->sendHeaders(); - exit(0); - } - - $layout->getMessagesBlock()->prepareMessages('install'); - $layout->load('install.step.config'); - //*/ - break; - } - break; -case 'summary': - $layout->load('install.summary'); - $layout->getMessagesBlock()->prepareMessages('install'); - break; -} -echo $layout->render(); diff --git a/src/language/en/admin/banned.mo b/src/language/en/admin/banned.mo deleted file mode 100644 index 01f6d62..0000000 --- a/src/language/en/admin/banned.mo +++ /dev/null @@ -1,49 +0,0 @@ - - * Copyright (c) 2011-Present, Wootook Contributors - * 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 Wootook. - * - */ - - -$lang['ip_ban_sys'] = 'IP banning system'; -$lang['nr'] = 'Number'; -$lang['IP'] = 'IP'; -$lang['cause'] = 'Reason'; -$lang['ban_time'] = 'Duration'; -$lang['ip_ban'] = 'IP Ban'; -$lang['add_ip_ban_ok'] = 'The IP address %s was successfully banned.'; -$lang['add_ip_ban'] = 'Add IP address'; -$lang['addb'] = 'Add'; -$lang['rem_ip_ban_ok'] = 'The IP address %s was successfully removed.'; -$lang['rem_ip_ban'] = 'Remove IP address'; -$lang['remb'] = 'Remove'; -$lang['error'] = 'Error'; -$lang['add_no_ip'] = 'You should add at least one IP address'; -$lang['rem_no_ip'] = 'You should select which IP address to remove'; -$lang['no_admin'] = 'You are not an administrator or you dont have the right permissions.'; -?> \ No newline at end of file diff --git a/src/language/en/admin/server.mo b/src/language/en/admin/server.mo deleted file mode 100644 index df07596..0000000 --- a/src/language/en/admin/server.mo +++ /dev/null @@ -1,36 +0,0 @@ - - * Copyright (c) 2011-Present, Wootook Contributors - * 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 Wootook. - * - */ - -$lang['server_information'] = 'Server information'; -$lang['serverip'] = 'Server IP address'; -$lang['server_software'] ='Server software'; -$lang['server_system'] = ' Server operating system'; -$lang['php_version'] = 'PHP version'; diff --git a/src/language/en/announce.mo b/src/language/en/announce.mo deleted file mode 100644 index 3a19f0b..0000000 --- a/src/language/en/announce.mo +++ /dev/null @@ -1,52 +0,0 @@ - - * Copyright (c) 2011-Present, Wootook Contributors - * 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 Wootook. - * - */ - -$lang['add_announce'] = 'Add an trade'; -$lang['metal'] = 'Metal'; -$lang['crystal'] = 'Crystal'; -$lang['deuterium'] = 'Deuterium'; -$lang['Resources_to_be_sold'] = 'Resources to be sold'; -$lang['Desired_resources'] = 'Wanted resources'; -$lang['send'] = 'Send'; -$lang['Your_announce_was_recorded'] = 'Your trade was sent successfully'; -$lang['return_to_announce'] = 'Return to trade'; -$lang['Classifieds'] = 'Published trade'; -$lang['Action'] = 'Action'; -$lang['Galaxy'] = 'Galaxy'; -$lang['Solar_system'] = 'Solar system'; -$lang['Infos_of_delivery'] = 'trader information'; -$lang['Salesman'] = 'User'; -$lang['Delete'] = 'Delete'; -$lang['announce_status'] = 'Announce status'; -$lang['Your_announce_not_recorded'] = 'Your trade was not sent'; -$lang['Your_announce_was_deleted'] = 'Your trade was successfully deleted'; - -?> diff --git a/src/language/en/lang_info.cfg b/src/language/en/lang_info.cfg deleted file mode 100644 index 127828b..0000000 --- a/src/language/en/lang_info.cfg +++ /dev/null @@ -1,34 +0,0 @@ - - * Copyright (c) 2011-Present, Wootook Contributors - * 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 Wootook. - * - */ - - -$langInfos['ENCODING'] = 'UTF-8'; -$langInfos['DIRECTION'] = 'http://wootook.org/'; diff --git a/src/language/en/supp.mo b/src/language/en/supp.mo deleted file mode 100644 index 0ca8f96..0000000 --- a/src/language/en/supp.mo +++ /dev/null @@ -1,52 +0,0 @@ - - * Copyright (c) 2011-Present, Wootook Contributors - * 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 Wootook. - * - */ - -$lang['supp_header'] = "Suport"; -$lang['ticket_id'] = "#Ticket-ID"; -$lang['subject'] = "Subject"; -$lang['status'] = "Status"; -$lang['ticket_posted'] = "Posted in:"; -$lang['ticket_new'] = "New Ticket"; -$lang['input_text'] = "Problem description:"; -$lang['answer_new'] = "Answer:"; -$lang['text'] = "Text:"; -$lang['message_a'] = "Message status:"; -$lang['sendit_a'] = "Your message was sent"; -$lang['message_t'] = "Ticket status:"; -$lang['sendit_t'] = "The ticket was sent."; -$lang['close_t'] = "The ticket was closed."; -$lang['sendit_error'] = "Error:"; -$lang['sendit_error_msg'] = "You didnt fill all the data!"; -$lang['supp_admin_system'] = "Support System Administration"; -$lang['close_ticket'] = "Close Ticket"; -$lang['player'] = "Player"; -$lang['input_text'] = "Send"; - diff --git a/src/medias/klore/images/building/alliance-depot.jpg b/src/medias/klore/images/building/alliance-depot.jpg deleted file mode 100644 index e7b7f7f..0000000 Binary files a/src/medias/klore/images/building/alliance-depot.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/cristal-mine.jpg b/src/medias/klore/images/building/cristal-mine.jpg deleted file mode 100644 index fcdf957..0000000 Binary files a/src/medias/klore/images/building/cristal-mine.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/cristal-storage.jpg b/src/medias/klore/images/building/cristal-storage.jpg deleted file mode 100644 index 777707c..0000000 Binary files a/src/medias/klore/images/building/cristal-storage.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/deuterium-syntherizer.jpg b/src/medias/klore/images/building/deuterium-syntherizer.jpg deleted file mode 100644 index 31f2637..0000000 Binary files a/src/medias/klore/images/building/deuterium-syntherizer.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/deuterium-tank.jpg b/src/medias/klore/images/building/deuterium-tank.jpg deleted file mode 100644 index 7908e9f..0000000 Binary files a/src/medias/klore/images/building/deuterium-tank.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/fusion-reactor.jpg b/src/medias/klore/images/building/fusion-reactor.jpg deleted file mode 100644 index e4e28ee..0000000 Binary files a/src/medias/klore/images/building/fusion-reactor.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/jump-gate.jpg b/src/medias/klore/images/building/jump-gate.jpg deleted file mode 100644 index df95db9..0000000 Binary files a/src/medias/klore/images/building/jump-gate.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/lunar-base.jpg b/src/medias/klore/images/building/lunar-base.jpg deleted file mode 100644 index 7345110..0000000 Binary files a/src/medias/klore/images/building/lunar-base.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/metal-mine.jpg b/src/medias/klore/images/building/metal-mine.jpg deleted file mode 100644 index b11c616..0000000 Binary files a/src/medias/klore/images/building/metal-mine.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/metal-storage.jpg b/src/medias/klore/images/building/metal-storage.jpg deleted file mode 100644 index 9199a8a..0000000 Binary files a/src/medias/klore/images/building/metal-storage.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/missile-silo.jpg b/src/medias/klore/images/building/missile-silo.jpg deleted file mode 100644 index cc59a21..0000000 Binary files a/src/medias/klore/images/building/missile-silo.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/nanite-factory.jpg b/src/medias/klore/images/building/nanite-factory.jpg deleted file mode 100644 index c15b9c5..0000000 Binary files a/src/medias/klore/images/building/nanite-factory.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/research-lab.jpg b/src/medias/klore/images/building/research-lab.jpg deleted file mode 100644 index bbabfa6..0000000 Binary files a/src/medias/klore/images/building/research-lab.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/robotic-factory.jpg b/src/medias/klore/images/building/robotic-factory.jpg deleted file mode 100644 index 83f1ec0..0000000 Binary files a/src/medias/klore/images/building/robotic-factory.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/sensor-phalanx.jpg b/src/medias/klore/images/building/sensor-phalanx.jpg deleted file mode 100644 index 03f3031..0000000 Binary files a/src/medias/klore/images/building/sensor-phalanx.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/shipyard.jpg b/src/medias/klore/images/building/shipyard.jpg deleted file mode 100644 index 2d81393..0000000 Binary files a/src/medias/klore/images/building/shipyard.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/solar-plant.jpg b/src/medias/klore/images/building/solar-plant.jpg deleted file mode 100644 index 23e9d59..0000000 Binary files a/src/medias/klore/images/building/solar-plant.jpg and /dev/null differ diff --git a/src/medias/klore/images/building/terraformer.jpg b/src/medias/klore/images/building/terraformer.jpg deleted file mode 100644 index e12efdd..0000000 Binary files a/src/medias/klore/images/building/terraformer.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/antiballistic-missile.jpg b/src/medias/klore/images/defense/antiballistic-missile.jpg deleted file mode 100644 index f35eb79..0000000 Binary files a/src/medias/klore/images/defense/antiballistic-missile.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/gauss-canon.jpg b/src/medias/klore/images/defense/gauss-canon.jpg deleted file mode 100644 index 7540d90..0000000 Binary files a/src/medias/klore/images/defense/gauss-canon.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/heavy-laser.jpg b/src/medias/klore/images/defense/heavy-laser.jpg deleted file mode 100644 index 870f852..0000000 Binary files a/src/medias/klore/images/defense/heavy-laser.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/interplanetary-missile.jpg b/src/medias/klore/images/defense/interplanetary-missile.jpg deleted file mode 100644 index a037494..0000000 Binary files a/src/medias/klore/images/defense/interplanetary-missile.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/ion-canon.jpg b/src/medias/klore/images/defense/ion-canon.jpg deleted file mode 100644 index 6885f94..0000000 Binary files a/src/medias/klore/images/defense/ion-canon.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/large-shield-dome.jpg b/src/medias/klore/images/defense/large-shield-dome.jpg deleted file mode 100644 index 52b93f0..0000000 Binary files a/src/medias/klore/images/defense/large-shield-dome.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/light-laser.jpg b/src/medias/klore/images/defense/light-laser.jpg deleted file mode 100644 index 541b22e..0000000 Binary files a/src/medias/klore/images/defense/light-laser.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/plasma-turret.jpg b/src/medias/klore/images/defense/plasma-turret.jpg deleted file mode 100644 index e0a14a2..0000000 Binary files a/src/medias/klore/images/defense/plasma-turret.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/rocket-launcher.jpg b/src/medias/klore/images/defense/rocket-launcher.jpg deleted file mode 100644 index d1eebc5..0000000 Binary files a/src/medias/klore/images/defense/rocket-launcher.jpg and /dev/null differ diff --git a/src/medias/klore/images/defense/small-shield-dome.jpg b/src/medias/klore/images/defense/small-shield-dome.jpg deleted file mode 100644 index 74d8744..0000000 Binary files a/src/medias/klore/images/defense/small-shield-dome.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/battlecruiser.jpg b/src/medias/klore/images/ship/battlecruiser.jpg deleted file mode 100644 index 51e8b34..0000000 Binary files a/src/medias/klore/images/ship/battlecruiser.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/battleship.jpg b/src/medias/klore/images/ship/battleship.jpg deleted file mode 100644 index 395caff..0000000 Binary files a/src/medias/klore/images/ship/battleship.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/bomber.jpg b/src/medias/klore/images/ship/bomber.jpg deleted file mode 100644 index e0bbe5c..0000000 Binary files a/src/medias/klore/images/ship/bomber.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/colony-ship.jpg b/src/medias/klore/images/ship/colony-ship.jpg deleted file mode 100644 index 2f932ea..0000000 Binary files a/src/medias/klore/images/ship/colony-ship.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/cruiser.jpg b/src/medias/klore/images/ship/cruiser.jpg deleted file mode 100644 index 97729cd..0000000 Binary files a/src/medias/klore/images/ship/cruiser.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/death-star.jpg b/src/medias/klore/images/ship/death-star.jpg deleted file mode 100644 index 453372a..0000000 Binary files a/src/medias/klore/images/ship/death-star.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/destructor.jpg b/src/medias/klore/images/ship/destructor.jpg deleted file mode 100644 index aac6d6b..0000000 Binary files a/src/medias/klore/images/ship/destructor.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/heavy-fighter.jpg b/src/medias/klore/images/ship/heavy-fighter.jpg deleted file mode 100644 index 4fbb6e7..0000000 Binary files a/src/medias/klore/images/ship/heavy-fighter.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/large-transport.jpg b/src/medias/klore/images/ship/large-transport.jpg deleted file mode 100644 index aba4772..0000000 Binary files a/src/medias/klore/images/ship/large-transport.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/light-fighter.jpg b/src/medias/klore/images/ship/light-fighter.jpg deleted file mode 100644 index e59a213..0000000 Binary files a/src/medias/klore/images/ship/light-fighter.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/light-transport.jpg b/src/medias/klore/images/ship/light-transport.jpg deleted file mode 100644 index ceb9434..0000000 Binary files a/src/medias/klore/images/ship/light-transport.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/ore-miner.jpg b/src/medias/klore/images/ship/ore-miner.jpg deleted file mode 100644 index e83a7ec..0000000 Binary files a/src/medias/klore/images/ship/ore-miner.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/recycler.jpg b/src/medias/klore/images/ship/recycler.jpg deleted file mode 100644 index 046617d..0000000 Binary files a/src/medias/klore/images/ship/recycler.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/solar-satellite.jpg b/src/medias/klore/images/ship/solar-satellite.jpg deleted file mode 100644 index af690e5..0000000 Binary files a/src/medias/klore/images/ship/solar-satellite.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/spy-drone.jpg b/src/medias/klore/images/ship/spy-drone.jpg deleted file mode 100644 index bb9b3fd..0000000 Binary files a/src/medias/klore/images/ship/spy-drone.jpg and /dev/null differ diff --git a/src/medias/klore/images/ship/supernova.jpg b/src/medias/klore/images/ship/supernova.jpg deleted file mode 100644 index 3ebb876..0000000 Binary files a/src/medias/klore/images/ship/supernova.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/armour.jpg b/src/medias/klore/images/technology/armour.jpg deleted file mode 100644 index 1028560..0000000 Binary files a/src/medias/klore/images/technology/armour.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/combustion-drive.jpg b/src/medias/klore/images/technology/combustion-drive.jpg deleted file mode 100644 index 3711874..0000000 Binary files a/src/medias/klore/images/technology/combustion-drive.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/computer.jpg b/src/medias/klore/images/technology/computer.jpg deleted file mode 100644 index 01bca1b..0000000 Binary files a/src/medias/klore/images/technology/computer.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/energy.jpg b/src/medias/klore/images/technology/energy.jpg deleted file mode 100644 index 08049f6..0000000 Binary files a/src/medias/klore/images/technology/energy.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/espionnage.jpg b/src/medias/klore/images/technology/espionnage.jpg deleted file mode 100644 index 81201c5..0000000 Binary files a/src/medias/klore/images/technology/espionnage.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/expedition.jpg b/src/medias/klore/images/technology/expedition.jpg deleted file mode 100644 index 0cbee64..0000000 Binary files a/src/medias/klore/images/technology/expedition.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/graviton.jpg b/src/medias/klore/images/technology/graviton.jpg deleted file mode 100644 index 68fac77..0000000 Binary files a/src/medias/klore/images/technology/graviton.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/hyperspace-drive.jpg b/src/medias/klore/images/technology/hyperspace-drive.jpg deleted file mode 100644 index fa8f4cd..0000000 Binary files a/src/medias/klore/images/technology/hyperspace-drive.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/hyperspace-technology.jpg b/src/medias/klore/images/technology/hyperspace-technology.jpg deleted file mode 100644 index 343cea3..0000000 Binary files a/src/medias/klore/images/technology/hyperspace-technology.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/impulse-drive.jpg b/src/medias/klore/images/technology/impulse-drive.jpg deleted file mode 100644 index 085ed02..0000000 Binary files a/src/medias/klore/images/technology/impulse-drive.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/intergalactic-research-network.jpg b/src/medias/klore/images/technology/intergalactic-research-network.jpg deleted file mode 100644 index 39a2821..0000000 Binary files a/src/medias/klore/images/technology/intergalactic-research-network.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/interplanetary-missile.jpg b/src/medias/klore/images/technology/interplanetary-missile.jpg deleted file mode 100644 index a037494..0000000 Binary files a/src/medias/klore/images/technology/interplanetary-missile.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/ion.jpg b/src/medias/klore/images/technology/ion.jpg deleted file mode 100644 index ad65150..0000000 Binary files a/src/medias/klore/images/technology/ion.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/laser.jpg b/src/medias/klore/images/technology/laser.jpg deleted file mode 100644 index 4cdbf1f..0000000 Binary files a/src/medias/klore/images/technology/laser.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/ore-mining.jpg b/src/medias/klore/images/technology/ore-mining.jpg deleted file mode 100644 index a10af80..0000000 Binary files a/src/medias/klore/images/technology/ore-mining.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/plasma.jpg b/src/medias/klore/images/technology/plasma.jpg deleted file mode 100644 index 15baf33..0000000 Binary files a/src/medias/klore/images/technology/plasma.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/shielding.jpg b/src/medias/klore/images/technology/shielding.jpg deleted file mode 100644 index 070f02a..0000000 Binary files a/src/medias/klore/images/technology/shielding.jpg and /dev/null differ diff --git a/src/medias/klore/images/technology/weaponry.jpg b/src/medias/klore/images/technology/weaponry.jpg deleted file mode 100644 index 16ef740..0000000 Binary files a/src/medias/klore/images/technology/weaponry.jpg and /dev/null differ diff --git a/src/scripts/createbanner.php b/src/scripts/createbanner.php deleted file mode 100644 index 3520f82..0000000 --- a/src/scripts/createbanner.php +++ /dev/null @@ -1,107 +0,0 @@ - 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. - * - */ -define('DISABLE_IDENTITY_CHECK', true); -require_once dirname(dirname(__FILE__)) . '/application/bootstrap.php'; - -define('FONT_FILE', dirname(__FILE__) . '/resources/fonts/visitor/visitor.ttf'); -define('BACKGROUND_FILE', dirname(__FILE__) . '/resources/backgrounds/default.png'); -define('TIMEZONE', 'Europe/Paris'); - -date_default_timezone_set(TIMEZONE); - -if (isset($_GET['id'])) { - $id = (int) $_GET['id']; -} else { - header('HTTP/1.1 412 Precondition Failed'); - die(); -} - -$textColor = array( - Wootook_Core_Model_Image_Png::COLOR_RED => 0xEF, - Wootook_Core_Model_Image_Png::COLOR_GREEN => 0xEF, - Wootook_Core_Model_Image_Png::COLOR_BLUE => 0xEF - ); - -$db = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection(Wootook_Core_Database_ConnectionManager::DEFAULT_CONNECTION_NAME); -$statement = $db->select() - ->column(array('username' => 'username'), 'user') - ->column(array('planet_name' => 'name'), 'planet') - ->column(array('build_points' => 'build_points', 'fleet_points' => 'fleet_points', 'tech_points' => 'tech_points', 'total_points' => 'total_points'), 'stats') - ->from(array('user' => $db->getTable('users'))) - ->joinLeft(array('stats' => $db->getTable('statpoints')), 'stats.id_owner=users.id') - ->joinLeft(array('planet' => $db->getTable('planets')), 'planet.id_owner=users.id') - ->where('user.id', $id) - ->prepare() -; - - -$data = array_merge( - array( - 'game_name' => Wootook::getGameConfig('game/general/name'), - 'date' => date('d M Y') - ), - $statement->fetch() - ); - -$image = new Wootook_Core_Model_Image_Png(); -$image - ->setBackground(BACKGROUND_FILE) - ->addText($data['game_name'], 24, FONT_FILE, 5, 37, 0, $textColor) - ->addText($data['username'], 24, FONT_FILE, 250, 37, 0, $textColor) - - ->addText('Batiments:', - 14, FONT_FILE, 5, 50, 0, $textColor) - ->addText(Math::render($data['build_points']), 14, FONT_FILE, 100, 50, 0, $textColor) - ->addText('Flottes:', 14, FONT_FILE, 5, 70, 0, $textColor) - ->addText(Math::render($data['fleet_points']), 14, FONT_FILE, 100, 70, 0, $textColor) - - ->addText('Technologies:', 14, FONT_FILE, 205, 50, 0, $textColor) - ->addText(Math::render($data['tech_points']), 14, FONT_FILE, 320, 50, 0, $textColor) - ->addText('Total:', 14, FONT_FILE, 205, 70, 0, $textColor) - ->addText(Math::render($data['total_points']), 14, FONT_FILE, 320, 70, 0, $textColor) -; - -foreach ($image->getHeaders() as $headerName => $headerValue) { - header(sprintf('%s: %s', $headerName, $headerValue)); -} - -echo $image->render(); diff --git a/src/scripts/jquery/jquery-1.6.4.js b/src/scripts/jquery/jquery-1.6.4.js deleted file mode 100644 index 11e6d06..0000000 --- a/src/scripts/jquery/jquery-1.6.4.js +++ /dev/null @@ -1,9046 +0,0 @@ -/*! - * jQuery JavaScript Library v1.6.4 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Sep 12 18:54:48 2011 -0400 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Check for digits - rdigit = /\d/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = (context ? context.ownerDocument || context : document); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return (context || rootjQuery).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if (selector.selector !== undefined) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.6.4", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + (this.selector ? " " : "") + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.done( fn ); - - return this; - }, - - eq: function( i ) { - return i === -1 ? - this.slice( i ) : - this.slice( i, +i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).unbind( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery._Deferred(); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNaN: function( obj ) { - return obj == null || !rdigit.test( obj ) || isNaN( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw msg; - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return (new Function( "return " + data ))(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // The extra typeof function check is to prevent crashes - // in Safari 2 (See: #3039) - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array ) { - if ( !array ) { - return -1; - } - - if ( indexOf ) { - return indexOf.call( array, elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return (new Date()).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -var // Promise methods - promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ), - // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - // Create a simple deferred (one callbacks list) - _Deferred: function() { - var // callbacks list - callbacks = [], - // stored [ context , args ] - fired, - // to avoid firing when already doing so - firing, - // flag to know if the deferred has been cancelled - cancelled, - // the deferred itself - deferred = { - - // done( f1, f2, ...) - done: function() { - if ( !cancelled ) { - var args = arguments, - i, - length, - elem, - type, - _fired; - if ( fired ) { - _fired = fired; - fired = 0; - } - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - deferred.done.apply( deferred, elem ); - } else if ( type === "function" ) { - callbacks.push( elem ); - } - } - if ( _fired ) { - deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); - } - } - return this; - }, - - // resolve with given context and args - resolveWith: function( context, args ) { - if ( !cancelled && !fired && !firing ) { - // make sure args are available (#8421) - args = args || []; - firing = 1; - try { - while( callbacks[ 0 ] ) { - callbacks.shift().apply( context, args ); - } - } - finally { - fired = [ context, args ]; - firing = 0; - } - } - return this; - }, - - // resolve with this as context and given arguments - resolve: function() { - deferred.resolveWith( this, arguments ); - return this; - }, - - // Has this deferred been resolved? - isResolved: function() { - return !!( firing || fired ); - }, - - // Cancel - cancel: function() { - cancelled = 1; - callbacks = []; - return this; - } - }; - - return deferred; - }, - - // Full fledged deferred (two callbacks list) - Deferred: function( func ) { - var deferred = jQuery._Deferred(), - failDeferred = jQuery._Deferred(), - promise; - // Add errorDeferred methods, then and promise - jQuery.extend( deferred, { - then: function( doneCallbacks, failCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ); - return this; - }, - always: function() { - return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments ); - }, - fail: failDeferred.done, - rejectWith: failDeferred.resolveWith, - reject: failDeferred.resolve, - isRejected: failDeferred.isResolved, - pipe: function( fnDone, fnFail ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - if ( promise ) { - return promise; - } - promise = obj = {}; - } - var i = promiseMethods.length; - while( i-- ) { - obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; - } - return obj; - } - }); - // Make sure only one callback list will be used - deferred.done( failDeferred.cancel ).fail( deferred.cancel ); - // Unexpose cancel - delete deferred.cancel; - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = arguments, - i = 0, - length = args.length, - count = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - // Strange bug in FF4: - // Values changed onto the arguments object sometimes end up as undefined values - // outside the $.when method. Cloning the object into a fresh array solves the issue - deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); - } - }; - } - if ( length > 1 ) { - for( ; i < length; i++ ) { - if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return deferred.promise(); - } -}); - - - -jQuery.support = (function() { - - var div = document.createElement( "div" ), - documentElement = document.documentElement, - all, - a, - select, - opt, - input, - marginDiv, - support, - fragment, - body, - testElementParent, - testElement, - testElementStyle, - tds, - events, - eventName, - i, - isSupported; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
a"; - - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName( "tbody" ).length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName( "link" ).length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute( "href" ) === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55$/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains it's value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.firstChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - div.innerHTML = ""; - - // Figure out if the W3C box model works as expected - div.style.width = div.style.paddingLeft = "1px"; - - body = document.getElementsByTagName( "body" )[ 0 ]; - // We use our own, invisible, body unless the body is already present - // in which case we use a div (#9239) - testElement = document.createElement( body ? "div" : "body" ); - testElementStyle = { - visibility: "hidden", - width: 0, - height: 0, - border: 0, - margin: 0, - background: "none" - }; - if ( body ) { - jQuery.extend( testElementStyle, { - position: "absolute", - left: "-1000px", - top: "-1000px" - }); - } - for ( i in testElementStyle ) { - testElement.style[ i ] = testElementStyle[ i ]; - } - testElement.appendChild( div ); - testElementParent = body || documentElement; - testElementParent.insertBefore( testElement, testElementParent.firstChild ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - support.boxModel = div.offsetWidth === 2; - - if ( "zoom" in div.style ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.innerHTML = "
t
"; - tds = div.getElementsByTagName( "td" ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE < 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( document.defaultView && document.defaultView.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Remove the body element we added - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); - - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - } ) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - // Null connected elements to avoid leaks in IE - testElement = fragment = select = opt = body = marginDiv = div = input = null; - - return support; -})(); - -// Keep track of boxModel -jQuery.boxModel = jQuery.support.boxModel; - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ jQuery.expando ] = id = ++jQuery.uuid; - } else { - id = jQuery.expando; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery - // metadata on plain JS objects when the object is serialized using - // JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); - } else { - cache[ id ] = jQuery.extend(cache[ id ], name); - } - } - - thisCache = cache[ id ]; - - // Internal jQuery data is stored in a separate object inside the object's data - // cache in order to avoid key collisions between internal data and user-defined - // data - if ( pvt ) { - if ( !thisCache[ internalKey ] ) { - thisCache[ internalKey ] = {}; - } - - thisCache = thisCache[ internalKey ]; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should - // not attempt to inspect the internal events object using jQuery.data, as this - // internal data object is undocumented and subject to change. - if ( name === "events" && !thisCache[name] ) { - return thisCache[ internalKey ] && thisCache[ internalKey ].events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; - - if ( thisCache ) { - - // Support interoperable removal of hyphenated or camelcased keys - if ( !thisCache[ name ] ) { - name = jQuery.camelCase( name ); - } - - delete thisCache[ name ]; - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !isEmptyDataObject(thisCache) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( pvt ) { - delete cache[ id ][ internalKey ]; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - var internalCache = cache[ id ][ internalKey ]; - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the entire user cache at once because it's faster than - // iterating through each key, but we need to continue to persist internal - // data if it existed - if ( internalCache ) { - cache[ id ] = {}; - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery - // metadata on plain JS objects when the object is serialized using - // JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - - cache[ id ][ internalKey ] = internalCache; - - // Otherwise, we need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - } else if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ jQuery.expando ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - } else { - elem[ jQuery.expando ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 ) { - var attr = this[0].attributes, name; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - var parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var $this = jQuery( this ), - args = [ parts[0], value ]; - - $this.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - $this.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - !jQuery.isNaN( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON -// property to be considered empty objects; this property always exists in -// order to make sure JSON.stringify does not expose internal metadata -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery.data( elem, deferDataKey, undefined, true ); - if ( defer && - ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && - ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery.data( elem, queueDataKey, undefined, true ) && - !jQuery.data( elem, markDataKey, undefined, true ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.resolve(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = (type || "fx") + "mark"; - jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); - if ( count ) { - jQuery.data( elem, key, count, true ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - if ( elem ) { - type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type, undefined, true ); - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery.data( elem, type, jQuery.makeArray(data), true ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - defer; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift("inprogress"); - } - - fn.call(elem, function() { - jQuery.dequeue(elem, type); - }); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; - type = type || "fx"; - - return this.queue( type, function() { - var elem = this; - setTimeout(function() { - jQuery.dequeue( elem, type ); - }, time ); - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) { - count++; - tmp.done( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - nodeHook, boolHook; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = (value || "").split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " "; - for ( var i = 0, l = this.length; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return undefined; - } - - var isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { - var option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attrFix: { - // Always normalize to ensure hook usage - tabindex: "tabIndex" - }, - - attr: function( elem, name, value, pass ) { - var nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return undefined; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( !("getAttribute" in elem) ) { - return jQuery.prop( elem, name, value ); - } - - var ret, hooks, - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // Normalize the name if needed - if ( notxml ) { - name = jQuery.attrFix[ name ] || name; - - hooks = jQuery.attrHooks[ name ]; - - if ( !hooks ) { - // Use boolHook for boolean attributes - if ( rboolean.test( name ) ) { - hooks = boolHook; - - // Use nodeHook if available( IE6/7 ) - } else if ( nodeHook ) { - hooks = nodeHook; - } - } - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return undefined; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, name ) { - var propName; - if ( elem.nodeType === 1 ) { - name = jQuery.attrFix[ name ] || name; - - jQuery.attr( elem, name, "" ); - elem.removeAttribute( name ); - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) { - elem[ propName ] = false; - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return undefined; - } - - var ret, hooks, - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return (elem[ name ] = value); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabindex propHook to attrHooks for back-compat -jQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode; - return jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !jQuery.support.getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - // Return undefined if nodeValue is empty string - return ret && ret.nodeValue !== "" ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return (ret.nodeValue = value + ""); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return (elem.style.cssText = "" + value); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0); - } - } - }); -}); - - - - -var rnamespaces = /\.(.*)$/, - rformElems = /^(?:textarea|input|select)$/i, - rperiod = /\./g, - rspaces = / /g, - rescape = /[^\w\s.|`]/g, - fcleanup = function( nm ) { - return nm.replace(rescape, "\\$&"); - }; - -/* - * A number of helper functions used for managing events. - * Many of the ideas behind this code originated from - * Dean Edwards' addEvent library. - */ -jQuery.event = { - - // Bind an event to an element - // Original by Dean Edwards - add: function( elem, types, handler, data ) { - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - if ( handler === false ) { - handler = returnFalse; - } else if ( !handler ) { - // Fixes bug #7229. Fix recommended by jdalton - return; - } - - var handleObjIn, handleObj; - - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the function being executed has a unique ID - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure - var elemData = jQuery._data( elem ); - - // If no elemData is found then we must be trying to bind to one of the - // banned noData elements - if ( !elemData ) { - return; - } - - var events = elemData.events, - eventHandle = elemData.handle; - - if ( !events ) { - elemData.events = events = {}; - } - - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.handle.apply( eventHandle.elem, arguments ) : - undefined; - }; - } - - // Add elem as a property of the handle function - // This is to prevent a memory leak with non-native events in IE. - eventHandle.elem = elem; - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = types.split(" "); - - var type, i = 0, namespaces; - - while ( (type = types[ i++ ]) ) { - handleObj = handleObjIn ? - jQuery.extend({}, handleObjIn) : - { handler: handler, data: data }; - - // Namespaced event handlers - if ( type.indexOf(".") > -1 ) { - namespaces = type.split("."); - type = namespaces.shift(); - handleObj.namespace = namespaces.slice(0).sort().join("."); - - } else { - namespaces = []; - handleObj.namespace = ""; - } - - handleObj.type = type; - if ( !handleObj.guid ) { - handleObj.guid = handler.guid; - } - - // Get the current list of functions bound to this event - var handlers = events[ type ], - special = jQuery.event.special[ type ] || {}; - - // Init the event handler queue - if ( !handlers ) { - handlers = events[ type ] = []; - - // Check for a special event handler - // Only use addEventListener/attachEvent if the special - // events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add the function to the element's handler list - handlers.push( handleObj ); - - // Keep track of which events have been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, pos ) { - // don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - if ( handler === false ) { - handler = returnFalse; - } - - var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - events = elemData && elemData.events; - - if ( !elemData || !events ) { - return; - } - - // types is actually an event object here - if ( types && types.type ) { - handler = types.handler; - types = types.type; - } - - // Unbind all events for the element - if ( !types || typeof types === "string" && types.charAt(0) === "." ) { - types = types || ""; - - for ( type in events ) { - jQuery.event.remove( elem, type + types ); - } - - return; - } - - // Handle multiple events separated by a space - // jQuery(...).unbind("mouseover mouseout", fn); - types = types.split(" "); - - while ( (type = types[ i++ ]) ) { - origType = type; - handleObj = null; - all = type.indexOf(".") < 0; - namespaces = []; - - if ( !all ) { - // Namespaced event handlers - namespaces = type.split("."); - type = namespaces.shift(); - - namespace = new RegExp("(^|\\.)" + - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - eventType = events[ type ]; - - if ( !eventType ) { - continue; - } - - if ( !handler ) { - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( all || namespace.test( handleObj.namespace ) ) { - jQuery.event.remove( elem, origType, handleObj.handler, j ); - eventType.splice( j--, 1 ); - } - } - - continue; - } - - special = jQuery.event.special[ type ] || {}; - - for ( j = pos || 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( handler.guid === handleObj.guid ) { - // remove the given handler for the given type - if ( all || namespace.test( handleObj.namespace ) ) { - if ( pos == null ) { - eventType.splice( j--, 1 ); - } - - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - - if ( pos != null ) { - break; - } - } - } - - // remove generic event handler if no more handlers exist - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - ret = null; - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - var handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - delete elemData.events; - delete elemData.handle; - - if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem, undefined, true ); - } - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Event object or event type - var type = event.type || event, - namespaces = [], - exclusive; - - if ( type.indexOf("!") >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.exclusive = exclusive; - event.namespace = namespaces.join("."); - event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); - - // triggerHandler() and global events don't bubble or run the default action - if ( onlyHandlers || !elem ) { - event.preventDefault(); - event.stopPropagation(); - } - - // Handle a global trigger - if ( !elem ) { - // TODO: Stop taunting the data cache; remove global events and always attach to document - jQuery.each( jQuery.cache, function() { - // internalKey variable is just used to make it easier to find - // and potentially change this stuff later; currently it just - // points to jQuery.expando - var internalKey = jQuery.expando, - internalCache = this[ internalKey ]; - if ( internalCache && internalCache.events && internalCache.events[ type ] ) { - jQuery.event.trigger( event, data, internalCache.handle.elem ); - } - }); - return; - } - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - event.target = elem; - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - var cur = elem, - // IE doesn't like method names with a colon (#3533, #8272) - ontype = type.indexOf(":") < 0 ? "on" + type : ""; - - // Fire event on the current element, then bubble up the DOM tree - do { - var handle = jQuery._data( cur, "handle" ); - - event.currentTarget = cur; - if ( handle ) { - handle.apply( cur, data ); - } - - // Trigger an inline bound script - if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) { - event.result = false; - event.preventDefault(); - } - - // Bubble up to document, then to window - cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window; - } while ( cur && !event.isPropagationStopped() ); - - // If nobody prevented the default action, do it now - if ( !event.isDefaultPrevented() ) { - var old, - special = jQuery.event.special[ type ] || {}; - - if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction)() check here because IE6/7 fails that test. - // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch. - try { - if ( ontype && elem[ type ] ) { - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - jQuery.event.triggered = type; - elem[ type ](); - } - } catch ( ieError ) {} - - if ( old ) { - elem[ ontype ] = old; - } - - jQuery.event.triggered = undefined; - } - } - - return event.result; - }, - - handle: function( event ) { - event = jQuery.event.fix( event || window.event ); - // Snapshot the handlers list since a called handler may add/remove events. - var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0), - run_all = !event.exclusive && !event.namespace, - args = Array.prototype.slice.call( arguments, 0 ); - - // Use the fix-ed Event rather than the (read-only) native event - args[0] = event; - event.currentTarget = this; - - for ( var j = 0, l = handlers.length; j < l; j++ ) { - var handleObj = handlers[ j ]; - - // Triggered event must 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event. - if ( run_all || event.namespace_re.test( handleObj.namespace ) ) { - // Pass in a reference to the handler function itself - // So that we can later remove it - event.handler = handleObj.handler; - event.data = handleObj.data; - event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - return event.result; - }, - - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // store a copy of the original event object - // and "clone" to set read-only properties - var originalEvent = event; - event = jQuery.Event( originalEvent ); - - for ( var i = this.props.length, prop; i; ) { - prop = this.props[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary - if ( !event.target ) { - // Fixes #1925 where srcElement might not be defined either - event.target = event.srcElement || document; - } - - // check if target is a textnode (safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && event.fromElement ) { - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; - } - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && event.clientX != null ) { - var eventDocument = event.target.ownerDocument || document, - doc = eventDocument.documentElement, - body = eventDocument.body; - - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Add which for key events - if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { - event.which = event.charCode != null ? event.charCode : event.keyCode; - } - - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) - if ( !event.metaKey && event.ctrlKey ) { - event.metaKey = event.ctrlKey; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && event.button !== undefined ) { - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); - } - - return event; - }, - - // Deprecated, use jQuery.guid instead - guid: 1E8, - - // Deprecated, use jQuery.proxy instead - proxy: jQuery.proxy, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady, - teardown: jQuery.noop - }, - - live: { - add: function( handleObj ) { - jQuery.event.add( this, - liveConvert( handleObj.origType, handleObj.selector ), - jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); - }, - - remove: function( handleObj ) { - jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); - } - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !this.preventDefault ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // timeStamp is buggy for some events on Firefox(#3843) - // So we won't rely on the native value - this.timeStamp = jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Checks if an event happened on an element within another element -// Used in jQuery.event.special.mouseenter and mouseleave handlers -var withinElement = function( event ) { - - // Check if mouse(over|out) are still within the same parent element - var related = event.relatedTarget, - inside = false, - eventType = event.type; - - event.type = event.data; - - if ( related !== this ) { - - if ( related ) { - inside = jQuery.contains( this, related ); - } - - if ( !inside ) { - - jQuery.event.handle.apply( this, arguments ); - - event.type = eventType; - } - } -}, - -// In case of event delegation, we only need to rename the event.type, -// liveHandler will take care of the rest. -delegate = function( event ) { - event.type = event.data; - jQuery.event.handle.apply( this, arguments ); -}; - -// Create mouseenter and mouseleave events -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - setup: function( data ) { - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); - }, - teardown: function( data ) { - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); - } - }; -}); - -// submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function( data, namespaces ) { - if ( !jQuery.nodeName( this, "form" ) ) { - jQuery.event.add(this, "click.specialSubmit", function( e ) { - // Avoid triggering error on non-existent type attribute in IE VML (#7071) - var elem = e.target, - type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : ""; - - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { - trigger( "submit", this, arguments ); - } - }); - - jQuery.event.add(this, "keypress.specialSubmit", function( e ) { - var elem = e.target, - type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : ""; - - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { - trigger( "submit", this, arguments ); - } - }); - - } else { - return false; - } - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialSubmit" ); - } - }; - -} - -// change delegation, happens here so we have bind. -if ( !jQuery.support.changeBubbles ) { - - var changeFilters, - - getVal = function( elem ) { - var type = jQuery.nodeName( elem, "input" ) ? elem.type : "", - val = elem.value; - - if ( type === "radio" || type === "checkbox" ) { - val = elem.checked; - - } else if ( type === "select-multiple" ) { - val = elem.selectedIndex > -1 ? - jQuery.map( elem.options, function( elem ) { - return elem.selected; - }).join("-") : - ""; - - } else if ( jQuery.nodeName( elem, "select" ) ) { - val = elem.selectedIndex; - } - - return val; - }, - - testChange = function testChange( e ) { - var elem = e.target, data, val; - - if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { - return; - } - - data = jQuery._data( elem, "_change_data" ); - val = getVal(elem); - - // the current data will be also retrieved by beforeactivate - if ( e.type !== "focusout" || elem.type !== "radio" ) { - jQuery._data( elem, "_change_data", val ); - } - - if ( data === undefined || val === data ) { - return; - } - - if ( data != null || val ) { - e.type = "change"; - e.liveFired = undefined; - jQuery.event.trigger( e, arguments[1], elem ); - } - }; - - jQuery.event.special.change = { - filters: { - focusout: testChange, - - beforedeactivate: testChange, - - click: function( e ) { - var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; - - if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) { - testChange.call( this, e ); - } - }, - - // Change has to be called before submit - // Keydown will be called before keypress, which is used in submit-event delegation - keydown: function( e ) { - var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; - - if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) || - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || - type === "select-multiple" ) { - testChange.call( this, e ); - } - }, - - // Beforeactivate happens also before the previous element is blurred - // with this event you can't trigger a change event, but you can store - // information - beforeactivate: function( e ) { - var elem = e.target; - jQuery._data( elem, "_change_data", getVal(elem) ); - } - }, - - setup: function( data, namespaces ) { - if ( this.type === "file" ) { - return false; - } - - for ( var type in changeFilters ) { - jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); - } - - return rformElems.test( this.nodeName ); - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialChange" ); - - return rformElems.test( this.nodeName ); - } - }; - - changeFilters = jQuery.event.special.change.filters; - - // Handle when the input is .focus()'d - changeFilters.focus = changeFilters.beforeactivate; -} - -function trigger( type, elem, args ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - // Don't pass args or remember liveFired; they apply to the donor event. - var event = jQuery.extend( {}, args[ 0 ] ); - event.type = type; - event.originalEvent = {}; - event.liveFired = undefined; - jQuery.event.handle.call( elem, event ); - if ( event.isDefaultPrevented() ) { - args[ 0 ].preventDefault(); - } -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - - function handler( donor ) { - // Donor event is always a native one; fix it and switch its type. - // Let focusin/out handler cancel the donor focus/blur event. - var e = jQuery.event.fix( donor ); - e.type = fix; - e.originalEvent = {}; - jQuery.event.trigger( e, null, e.target ); - if ( e.isDefaultPrevented() ) { - donor.preventDefault(); - } - } - }); -} - -jQuery.each(["bind", "one"], function( i, name ) { - jQuery.fn[ name ] = function( type, data, fn ) { - var handler; - - // Handle object literals - if ( typeof type === "object" ) { - for ( var key in type ) { - this[ name ](key, data, type[key], fn); - } - return this; - } - - if ( arguments.length === 2 || data === false ) { - fn = data; - data = undefined; - } - - if ( name === "one" ) { - handler = function( event ) { - jQuery( this ).unbind( event, handler ); - return fn.apply( this, arguments ); - }; - handler.guid = fn.guid || jQuery.guid++; - } else { - handler = fn; - } - - if ( type === "unload" && name !== "one" ) { - this.one( type, data, fn ); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.add( this[i], type, handler, data ); - } - } - - return this; - }; -}); - -jQuery.fn.extend({ - unbind: function( type, fn ) { - // Handle object literals - if ( typeof type === "object" && !type.preventDefault ) { - for ( var key in type ) { - this.unbind(key, type[key]); - } - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.remove( this[i], type, fn ); - } - } - - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.live( types, data, fn, selector ); - }, - - undelegate: function( selector, types, fn ) { - if ( arguments.length === 0 ) { - return this.unbind( "live" ); - - } else { - return this.die( types, null, fn, selector ); - } - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -var liveMap = { - focus: "focusin", - blur: "focusout", - mouseenter: "mouseover", - mouseleave: "mouseout" -}; - -jQuery.each(["live", "die"], function( i, name ) { - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { - var type, i = 0, match, namespaces, preType, - selector = origSelector || this.selector, - context = origSelector ? this : jQuery( this.context ); - - if ( typeof types === "object" && !types.preventDefault ) { - for ( var key in types ) { - context[ name ]( key, data, types[key], selector ); - } - - return this; - } - - if ( name === "die" && !types && - origSelector && origSelector.charAt(0) === "." ) { - - context.unbind( origSelector ); - - return this; - } - - if ( data === false || jQuery.isFunction( data ) ) { - fn = data || returnFalse; - data = undefined; - } - - types = (types || "").split(" "); - - while ( (type = types[ i++ ]) != null ) { - match = rnamespaces.exec( type ); - namespaces = ""; - - if ( match ) { - namespaces = match[0]; - type = type.replace( rnamespaces, "" ); - } - - if ( type === "hover" ) { - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); - continue; - } - - preType = type; - - if ( liveMap[ type ] ) { - types.push( liveMap[ type ] + namespaces ); - type = type + namespaces; - - } else { - type = (liveMap[ type ] || type) + namespaces; - } - - if ( name === "live" ) { - // bind live handler - for ( var j = 0, l = context.length; j < l; j++ ) { - jQuery.event.add( context[j], "live." + liveConvert( type, selector ), - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); - } - - } else { - // unbind live handler - context.unbind( "live." + liveConvert( type, selector ), fn ); - } - } - - return this; - }; -}); - -function liveHandler( event ) { - var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, - elems = [], - selectors = [], - events = jQuery._data( this, "events" ); - - // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) - if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { - return; - } - - if ( event.namespace ) { - namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - event.liveFired = this; - - var live = events.live.slice(0); - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { - selectors.push( handleObj.selector ); - - } else { - live.splice( j--, 1 ); - } - } - - match = jQuery( event.target ).closest( selectors, event.currentTarget ); - - for ( i = 0, l = match.length; i < l; i++ ) { - close = match[i]; - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) { - elem = close.elem; - related = null; - - // Those two events require additional checking - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { - event.type = handleObj.preType; - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; - - // Make sure not to accidentally match a child element with the same selector - if ( related && jQuery.contains( elem, related ) ) { - related = elem; - } - } - - if ( !related || related !== elem ) { - elems.push({ elem: elem, handleObj: handleObj, level: close.level }); - } - } - } - } - - for ( i = 0, l = elems.length; i < l; i++ ) { - match = elems[i]; - - if ( maxLevel && match.level > maxLevel ) { - break; - } - - event.currentTarget = match.elem; - event.data = match.handleObj.data; - event.handleObj = match.handleObj; - - ret = match.handleObj.origHandler.apply( match.elem, arguments ); - - if ( ret === false || event.isPropagationStopped() ) { - maxLevel = match.level; - - if ( ret === false ) { - stop = false; - } - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - - return stop; -} - -function liveConvert( type, selector ) { - return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&"); -} - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.bind( name, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var match, - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var found, item, - filter = Expr.filter[ type ], - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw "Syntax error, unrecognized expression: " + msg; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - var first = match[2], - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Utility function for retreiving the text value of an array of DOM nodes -Sizzle.getText = function( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += Sizzle.getText( elem.childNodes ); - } - } - - return ret; -}; - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( typeof selector === "string" ? - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array - if ( jQuery.isArray( selectors ) ) { - var match, selector, - matches = {}, - level = 1; - - if ( cur && selectors.length ) { - for ( i = 0, l = selectors.length; i < l; i++ ) { - selector = selectors[i]; - - if ( !matches[ selector ] ) { - matches[ selector ] = POS.test( selector ) ? - jQuery( selector, context || this.context ) : - selector; - } - } - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( selector in matches ) { - match = matches[ selector ]; - - if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) { - ret.push({ selector: selector, elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ), - // The variable 'args' was introduced in - // https://github.com/jquery/jquery/commit/52a0238 - // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. - // http://code.google.com/p/v8/issues/detail?id=1050 - args = slice.call(arguments); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, args.join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return (elem === qualifier) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; - }); -} - - - - -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /", "" ], - legend: [ 1, "
", "
" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - col: [ 2, "", "
" ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }; - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and