diff --git a/alliance.php b/alliance.php
index 3c90d3c..8229453 100644
--- a/alliance.php
+++ b/alliance.php
@@ -671,7 +671,6 @@ 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['r0'] = $b['name'];
$lang['a'] = $a;
$lang['r1'] = ""; //{$b[1]}
@@ -688,7 +687,6 @@ elseif ($user->getData('ally_id') != 0 && $user->getData('ally_request') == 0) {
} else {
$lang['id'] = $a;
$lang['r0'] = $b['name'];
- $lang['delete'] = "";
$lang['a'] = $a;
$lang['r1'] = "-";
$lang['r2'] = "";
diff --git a/application/bootstrap.php b/application/bootstrap.php
index abd1b68..1981347 100644
--- a/application/bootstrap.php
+++ b/application/bootstrap.php
@@ -72,6 +72,8 @@ function __autoload($class) {
include_once str_replace('_', '/', $class) . '.php';
}
+include ROOT_PATH . 'includes/constants.php';
+
Wootook_Core_Time::init();
Wootook_Core_ErrorProfiler::register();
Wootook_Core_Model_Config_Events::registerEvents();
@@ -89,7 +91,6 @@ 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);
diff --git a/application/code/core/Wootook.php b/application/code/core/Wootook.php
index 1e58ee0..1cee8bd 100644
--- a/application/code/core/Wootook.php
+++ b/application/code/core/Wootook.php
@@ -315,12 +315,12 @@ class Wootook
return $config;
}
- public static function setConfig($path = null, $value)
+ public static function setConfig($path, $value)
{
self::_loadConfig();
if ($path === null || !is_string($path)) {
- return self::$_config;
+ return self::$_config = $value;
}
$config = &self::$_config;
foreach (explode('/', $path) as $chunk) {
@@ -334,6 +334,12 @@ class Wootook
return true;
}
+ public static function writeConfig(Array $config)
+ {
+ file_put_contents(ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php',
+ '<' . '?p' . 'hp ' . var_export($config, true) . ';');
+ }
+
public static function getBaseUrl()
{
return self::getConfig('global/web/base_url');
diff --git a/application/code/core/Wootook/Core/Block/Html/Navigation.php b/application/code/core/Wootook/Core/Block/Html/Navigation.php
index acc05fe..64fb59b 100644
--- a/application/code/core/Wootook/Core/Block/Html/Navigation.php
+++ b/application/code/core/Wootook/Core/Block/Html/Navigation.php
@@ -17,7 +17,8 @@ class Wootook_Core_Block_Html_Navigation
),
'label' => $label,
'title' => $title,
- 'classes' => $classes
+ 'classes' => $classes,
+ 'attributes' => $attributes
));
$parent->setPartial($baseName, $child);
diff --git a/application/code/core/Wootook/Core/EntityInterface.php b/application/code/core/Wootook/Core/EntityInterface.php
index 9843e61..a26e219 100644
--- a/application/code/core/Wootook/Core/EntityInterface.php
+++ b/application/code/core/Wootook/Core/EntityInterface.php
@@ -1,5 +1,39 @@
+ * 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_EntityInterface
{
public function getId();
diff --git a/application/code/core/Wootook/Core/ErrorProfiler.php b/application/code/core/Wootook/Core/ErrorProfiler.php
index 7bc3047..8b3da28 100644
--- a/application/code/core/Wootook/Core/ErrorProfiler.php
+++ b/application/code/core/Wootook/Core/ErrorProfiler.php
@@ -14,6 +14,8 @@ class Wootook_Core_ErrorProfiler
private static $_listen = true;
+ private $_mute = false;
+
public static function getSingleton()
{
if (self::$_singleton === null) {
@@ -134,6 +136,10 @@ ERROR_EOF;
public function shutdownManager()
{
+ if ($this->_mute === true) {
+ return;
+ }
+
$index = 0;
echo '
';
echo '
Debug profiler
';
@@ -173,6 +179,8 @@ ERROR_EOF;
set_error_handler(array(self::getSingleton(), 'errorManager'));
set_exception_handler(array(self::getSingleton(), 'exceptionManager'));
+ self::getSingleton()->_mute = false;
+
if (self::$_isTraceRegistered === false && defined('DEBUG')) {
self::$_isTraceRegistered = true;
register_shutdown_function(array(self::getSingleton(), 'shutdownManager'));
@@ -184,8 +192,10 @@ ERROR_EOF;
restore_error_handler();
restore_exception_handler();
- if ((self::$_isTraceRegistered && defined('DEBUG')) || $force) {
- self::$_isTraceRegistered = false;
+ self::getSingleton()->_mute = true;
+
+ if ((self::$_isTraceRegistered === false && defined('DEBUG')) || $force) {
+ self::$_isTraceRegistered = true;
register_shutdown_function(array(self::getSingleton(), 'shutdownManager'));
}
}
diff --git a/application/code/core/Wootook/Core/Form.php b/application/code/core/Wootook/Core/Form.php
index 6c7aec1..25d30d7 100644
--- a/application/code/core/Wootook/Core/Form.php
+++ b/application/code/core/Wootook/Core/Form.php
@@ -59,8 +59,11 @@ class Wootook_Core_Form
public function validate()
{
foreach ($this->_fields as $field) {
- $field->validate();
+ if (!$field->validate()) {
+ return false;
+ }
}
+ return true;
}
/**
diff --git a/application/code/core/Wootook/Core/Layout.php b/application/code/core/Wootook/Core/Layout.php
index 15297d9..b1faff0 100644
--- a/application/code/core/Wootook/Core/Layout.php
+++ b/application/code/core/Wootook/Core/Layout.php
@@ -424,7 +424,7 @@ class Wootook_Core_Layout
*
* @return Wootook_Core_Block_Messages
*/
- public function getMessagesblock()
+ public function getMessagesBlock()
{
return $this->_messageBlock;
}
diff --git a/application/code/core/Wootook/Core/Model/Session.php b/application/code/core/Wootook/Core/Model/Session.php
index 62f0455..37f80ff 100644
--- a/application/code/core/Wootook/Core/Model/Session.php
+++ b/application/code/core/Wootook/Core/Model/Session.php
@@ -128,19 +128,26 @@ class Wootook_Core_Model_Session
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->setData('form_key', uniqid());
+ $this->initFormKey();
return $this->getData('form_key');
}
- $key = $this->getData('form_key');
- if ($reset !== true) {
- $this->setData('form_key', uniqid());
+ if ($reset === true) {
+ $this->initFormKey();
}
- return $key;
+ return $this->getData('form_key');
}
public function setFormData(Array $data = array())
diff --git a/application/code/core/Wootook/Core/Setup/Updater.php b/application/code/core/Wootook/Core/Setup/Updater.php
new file mode 100644
index 0000000..1f8a22a
--- /dev/null
+++ b/application/code/core/Wootook/Core/Setup/Updater.php
@@ -0,0 +1,106 @@
+_setupConnection = Wootook_Database::getConnection($connection);
+ } else {
+ $this->_setupConnection = $connection;
+ }
+
+ return $this;
+ }
+
+ /**
+ *
+ * Enter description here ...
+ * @return Wootook_Database
+ */
+ public function getSetupConnection()
+ {
+ if ($this->_setupConnection === null) {
+ return Wootook_Database::getSingleton();
+ }
+ return $this->_setupConnection;
+ }
+
+ public function getTable($tableName)
+ {
+ $this->getSetupConnection()->getTable($tableName);
+ }
+
+ public function grant($tableName, $connectionName, $perms = null)
+ {
+ $hostname = Wootook::getConfig("global/database/{$connectionName}/params/hostname");
+ $username = Wootook::getConfig("global/database/{$connectionName}/params/username");
+ $database = Wootook::getConfig("global/database/{$connectionName}/params/database");
+ $password = Wootook::getConfig("global/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("global/database/{$connectionName}/params/hostname");
+ $username = Wootook::getConfig("global/database/{$connectionName}/params/username");
+ $database = Wootook::getConfig("global/database/{$connectionName}/params/database");
+ $password = Wootook::getConfig("global/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 getGameConfig($path)
+ {
+ $config = Wootook_Core_Model_Config::getSingleton();
+
+ return $config->getData($path);
+ }
+}
diff --git a/application/code/core/Wootook/Core/View.php b/application/code/core/Wootook/Core/View.php
index 1c75663..cb036de 100644
--- a/application/code/core/Wootook/Core/View.php
+++ b/application/code/core/Wootook/Core/View.php
@@ -56,11 +56,16 @@ class Wootook_Core_View
}
}
- protected function escape($unescaped)
+ public 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();
diff --git a/application/code/core/Wootook/Core/install/mysql5/install-2011.1.0.php b/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php
similarity index 77%
rename from application/code/core/Wootook/Core/install/mysql5/install-2011.1.0.php
rename to application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php
index 51a956e..ba9fc80 100644
--- a/application/code/core/Wootook/Core/install/mysql5/install-2011.1.0.php
+++ b/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php
@@ -2,45 +2,33 @@
/**
* This file is part of Wootook
*
- * @license Modified BSD
- * @see https://github.com/gplanchat/one.platform
+ * @license http://www.gnu.org/licenses/agpl-3.0.txt
+ * @see http://www.wootook.com/
*
- * Copyright (c) 2009-2010, Grégory PLANCHAT
+ * Copyright (c) 2011-Present, Grégory PLANCHAT
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
+ * 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.
*
- * - Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
+ * 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 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.
+ * 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 One.Platform.
+ * documentation for further information about customizing Wootook.
*
*/
-$this->setSetupConnection('legacies_setup');
+$this->setSetupConnection('core_setup');
$sql = <<getTableName('legacies/aks')} (
@@ -59,12 +47,6 @@ 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('legacies/alliance')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -88,12 +70,6 @@ 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('legacies/annonce')} (
`id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -112,12 +88,6 @@ 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('legacies/banned')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -134,12 +104,6 @@ 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('legacies/buddy')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -153,12 +117,6 @@ 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('legacies/chat')} (
`messageid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -171,12 +129,6 @@ 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('legacies/config')} (
`config_name` VARCHAR(64) NOT NULL,
@@ -187,12 +139,6 @@ 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'),
@@ -206,7 +152,7 @@ INSERT INTO {$this->getTableName('legacies/config')} (`config_name`, `config_val
('game_disable', '1'),
('close_reason', 'Le jeu est clos pour le moment!'),
('metal_basic_income', '20'),
- ('crystal_basic_income', '10'),
+ ('cristal_basic_income', '10'),
('deuterium_basic_income', '0'),
('energy_basic_income', '0'),
('BuildLabWhileRun', '0'),
@@ -259,12 +205,6 @@ 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('legacies/errors')} (
`error_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -278,12 +218,6 @@ 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,
@@ -316,12 +250,6 @@ 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('legacies/galaxy')} (
`galaxy` TINYINT UNSIGNED NOT NULL,
@@ -341,12 +269,6 @@ 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('legacies/iraks')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -367,12 +289,6 @@ 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('legacies/lunas')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -393,12 +309,6 @@ 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('legacies/messages')} (
`message_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -415,12 +325,6 @@ 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('legacies/multi')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -433,12 +337,6 @@ 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('legacies/notes')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -453,12 +351,6 @@ 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('legacies/planets')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -489,16 +381,16 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/planets')} (
`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,
- `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,
+ `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,
`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,
- `crystal_mine` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
+ `cristal_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,
@@ -506,7 +398,7 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/planets')} (
`nano_factory` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`hangar` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`metal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
- `crystal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
+ `cristal_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,
@@ -540,7 +432,7 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/planets')} (
`interceptor_misil` SMALLINT NOT NULL DEFAULT 0,
`interplanetary_misil` SMALLINT NOT NULL DEFAULT 0,
`metal_mine_porcent` TINYINT NOT NULL DEFAULT 10,
- `crystal_mine_porcent` TINYINT NOT NULL DEFAULT 10,
+ `cristal_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,
@@ -552,12 +444,6 @@ 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('legacies/rw')} (
`id_owner1` BIGINT UNSIGNED NOT NULL,
@@ -574,12 +460,6 @@ 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('legacies/statpoints')} (
`id_owner` BIGINT UNSIGNED NOT NULL,
@@ -617,12 +497,6 @@ 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('legacies/users')} (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -736,57 +610,3 @@ SQL_EOF;
$this->query($sql);
-$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('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/application/code/core/Wootook/Core/install/mysql5/uninstall-2011.1.0.php b/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php
similarity index 100%
rename from application/code/core/Wootook/Core/install/mysql5/uninstall-2011.1.0.php
rename to application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php
diff --git a/application/code/core/Wootook/Database.php b/application/code/core/Wootook/Database.php
index 3ff35f0..2293bb0 100644
--- a/application/code/core/Wootook/Database.php
+++ b/application/code/core/Wootook/Database.php
@@ -3,9 +3,12 @@
class Wootook_Database
extends PDO
{
- protected static $_singleton = null;
+ const DEFAULT_CONNECTION_NAME = 'default';
- protected static $_prefix = null;
+ protected static $_connections = array();
+ protected static $_connectionAliases = array();
+
+ protected $_tablePrefix = null;
public static $options = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
@@ -13,39 +16,80 @@ class Wootook_Database
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;
+ return self::getConnection(self::DEFAULT_CONNECTION_NAME);
+ }
- if (isset($config['global']['database']['options']['port'])) {
- $port = $config['global']['database']['options']['port'];
+ public static function getConnection($connectionName)
+ {
+ if (empty($connectionName) || $connectionName === null) {
+ return null;
+ }
+
+ if (!isset(self::$_connections[$connectionName])) {
+ if (isset(self::$_connectionAliases[$connectionName])) {
+ return self::$_connectionAliases[$connectionName];
}
- $event = Wootook::dispatchEvent('database.prepare-options', array(
- 'options' => self::$options
- ));
+ if ($alias = Wootook::getConfig("global/database/{$connectionName}/use")) {
+ self::$_connectionAliases[$connectionName] = self::getConnection($alias);
+ }
- 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
- ));
+ self::$_connections[$connectionName] = self::_initConnection($connectionName);
}
- return self::$_singleton;
+
+ return self::$_connections[$connectionName];
+ }
+
+ private static function _initConnection($connectionName)
+ {
+ $hostname = Wootook::getConfig("global/database/{$connectionName}/params/hostname");
+ $username = Wootook::getConfig("global/database/{$connectionName}/params/username");
+ $password = Wootook::getConfig("global/database/{$connectionName}/params/password");
+ $database = Wootook::getConfig("global/database/{$connectionName}/params/database");
+
+ if (empty($hostname) || empty($username) || empty($database)) {
+ return null;
+ }
+
+ if (!($port = Wootook::getConfig("global/database/{$connectionName}/params/port")) || !is_numeric($port)) {
+ $port = 3306;
+ }
+
+ $event = Wootook::dispatchEvent('database.prepare-options', array(
+ 'name' => $connectionName,
+ 'options' => array_merge(self::$options, Wootook::getConfig("global/database/{$connectionName}/options"))
+ ));
+
+ $options = $event->getData('options');
+
+ $connection = new self("mysql:dbname={$database};host={$hostname};port={$port}", $username, $password, $options);
+
+ if (($prefix = Wootook::getConfig("global/database/{$connectionName}/table_prefix")) !== null) {
+ $connection->setTablePrefix($prefix);
+ }
+
+ Wootook::dispatchEvent('database.init', array(
+ 'name' => $connectionName,
+ 'handler' => $connection
+ ));
+
+ return $connection;
+ }
+
+ public function setTablePrefix($prefix)
+ {
+ $this->_tablePrefix = $prefix;
+
+ return $this;
+ }
+
+ public function getTablePrefix()
+ {
+ return $this->_tablePrefix;
}
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;
+ return $this->getTablePrefix() . $name;
}
}
\ No newline at end of file
diff --git a/application/code/core/Wootook/Empire/Model/Planet.php b/application/code/core/Wootook/Empire/Model/Planet.php
index 7cf15bb..7e06d19 100644
--- a/application/code/core/Wootook/Empire/Model/Planet.php
+++ b/application/code/core/Wootook/Empire/Model/Planet.php
@@ -429,7 +429,7 @@ class Wootook_Empire_Model_Planet
;
$options = array(
- 'galaxy' => $this->getSystem(),
+ 'galaxy' => $this->getGalaxy(),
'system' => $this->getSystem(),
'position' => $this->getPosition(),
'planet_type' => $this->getType()
diff --git a/application/code/test/LegaciesTest.php b/application/code/test/WootookTest.php
similarity index 99%
rename from application/code/test/LegaciesTest.php
rename to application/code/test/WootookTest.php
index d230e54..8962684 100644
--- a/application/code/test/LegaciesTest.php
+++ b/application/code/test/WootookTest.php
@@ -1,6 +1,6 @@
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',
- )
- )
+ 'template' => 'page/html/header.phtml'
),
'footer' => array(
'type' => 'core/template',
diff --git a/application/design/base/default/scripts/deprecated/alliance_admin_laws.tpl b/application/design/base/default/scripts/deprecated/alliance_admin_laws.tpl
index 2935d69..5a82f5a 100644
--- a/application/design/base/default/scripts/deprecated/alliance_admin_laws.tpl
+++ b/application/design/base/default/scripts/deprecated/alliance_admin_laws.tpl
@@ -8,63 +8,64 @@
-
-