diff --git a/ainfo.php b/ainfo.php
deleted file mode 100644
index 59081a9..0000000
--- a/ainfo.php
+++ /dev/null
@@ -1,70 +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';
-
-$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=".intval($_GET["a"]),"alliance",true);
-
-if(!$allyrow){ message("Alliance non trouvée","Erreur");}
-
-$count = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE ally_id=".intval($_GET["a"]).";","users",true);
-$ally_member_scount = $count[0];
-
-$page .="
Informations sur l'alliance ";
-
- if($allyrow["ally_image"] != ""){
- $page .= " ";
- }
-
- $page .= "Tag ".$allyrow["ally_tag"]." Nom ".$allyrow["ally_name"]." Membres $ally_member_scount ";
-
- if($allyrow["ally_description"] != ""){
- $page .= "".$allyrow["ally_description"]." ";
- }
-
-
- if($allyrow["ally_web"] != ""){
- $page .="
- Site internet
- ".$allyrow["ally_web"]."
- ";
- }
- $page .= "
";
-
- display($page,"Information sur l'alliance [".$allyrow["ally_name"]."]",false);
-
-?>
\ No newline at end of file
diff --git a/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php b/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php
index b350548..d5d27d6 100644
--- a/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php
+++ b/application/code/core/Legacies/Empire/install/mysql5/install-1.5.0.php
@@ -142,19 +142,6 @@ 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);
-
$sql = <<getTableName('fleets')} (
`fleet_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
diff --git a/application/code/core/Legacies/Empire/install/mysql5/uninstall-1.5.0.php b/application/code/core/Legacies/Empire/install/mysql5/uninstall-1.5.0.php
index a4010e5..040f676 100644
--- a/application/code/core/Legacies/Empire/install/mysql5/uninstall-1.5.0.php
+++ b/application/code/core/Legacies/Empire/install/mysql5/uninstall-1.5.0.php
@@ -84,12 +84,6 @@ SQL_EOF;
$this->query($sql);
-$sql = <<getTableName('errors')};
-SQL_EOF;
-
-$this->query($sql);
-
$sql = <<getTableName('fleets')};
SQL_EOF;
diff --git a/application/code/core/Wootook.php b/application/code/core/Wootook.php
index c0cb5c2..6703a42 100644
--- a/application/code/core/Wootook.php
+++ b/application/code/core/Wootook.php
@@ -400,7 +400,7 @@ class Wootook
self::$_websitesById[$websiteId] = $website;
self::$_websitesByCode[$websiteCode] = $website;
} catch (Wootook_Core_Exception_DataAccessException $e) {
- throw new Wootook_Core_Exception_RuntimeException('Could not load website entity.', null, $e);
+ throw new Wootook_Core_Exception_WebsiteError('Could not load website entity.', null, $e);
}
return $website;
@@ -417,7 +417,7 @@ class Wootook
self::$_websitesById[$websiteId] = $website;
self::$_websitesByCode[$websiteCode] = $website;
} catch (Wootook_Core_Exception_DataAccessException $e) {
- throw new Wootook_Core_Exception_RuntimeException('Could not load website entity.', null, $e);
+ throw new Wootook_Core_Exception_WebsiteError('Could not load website entity.', null, $e);
}
return $website;
@@ -438,7 +438,7 @@ class Wootook
self::$_gamesById[$gameId] = $game;
self::$_gamesByCode[$gameCode] = $game;
} catch (Wootook_Core_Exception_DataAccessException $e) {
- throw new Wootook_Core_Exception_RuntimeException('Could not load game entity.', null, $e);
+ throw new Wootook_Core_Exception_GameError('Could not load game entity.', null, $e);
}
return $game;
@@ -455,7 +455,7 @@ class Wootook
self::$_gamesById[$gameId] = $game;
self::$_gamesByCode[$gameCode] = $game;
} catch (Wootook_Core_Exception_DataAccessException $e) {
- throw new Wootook_Core_Exception_RuntimeException('Could not load game entity.', null, $e);
+ throw new Wootook_Core_Exception_GameError('Could not load game entity.', null, $e);
}
return $game;
@@ -472,8 +472,8 @@ class Wootook
public static function setGame($gameId, $game)
{
$gameKey = $game->getData('code');
- self::$_gameById[$gameId] = $game;
- self::$_gameByCode[$gameKey] = $game;
+ self::$_gamesById[$gameId] = $game;
+ self::$_gamesByCode[$gameKey] = $game;
}
protected static function _initWebsiteConfig($websiteId)
diff --git a/application/code/core/Wootook/Core/Entity.php b/application/code/core/Wootook/Core/Entity.php
index 0f2e90b..5f7ca7d 100644
--- a/application/code/core/Wootook/Core/Entity.php
+++ b/application/code/core/Wootook/Core/Entity.php
@@ -69,6 +69,8 @@ SQL_EOF;
protected function _save()
{
+ $database = $this->getWriteConnection();
+
if ($this->getId() !== null) {
$fields = array();
$values = array();
@@ -76,7 +78,7 @@ SQL_EOF;
if ($field == self::getIdFieldName()) {
continue;
}
- $fields[] = "{$field}=:{$field}";
+ $fields[] = "{$database->quoteIdentifier($field)}=:{$field}";
$values[$field] = $value;
}
@@ -84,7 +86,6 @@ SQL_EOF;
$idFieldName = self::getIdFieldName();
$values[$idFieldName] = $this->getId();
- $database = $this->getWriteConnection();
if ($database === null) {
throw new Wootook_Core_Exception_DataAccessException('Could not load data: no write connection configured.');
}
@@ -99,8 +100,8 @@ SQL_EOF;
$statement->execute($values);
} else {
$datas = $this->getAllDatas();
- $fieldsImploded = implode(', ', array_keys($datas));
+ $fields = array();
$tokens = array();
$values = array();
foreach ($datas as $field => $value) {
@@ -108,24 +109,27 @@ SQL_EOF;
continue;
}
$tokens[] = ":{$field}";
- $values[$field] = $value;
+ $fields[] = $database->quoteIdentifier($field);
+ $values[$field] = strval($value);
}
$tokensImploded = implode(', ', $tokens);
+ $fieldsImploded = implode(', ', $fields);
- $database = $this->getWriteConnection();
if ($database === null) {
throw new Wootook_Core_Exception_DataAccessException('Could not load data: no write connection configured.');
}
+ $table = $database->getTable($this->getTableName());
$sql =<<getTable($this->getTableName())} ($fieldsImploded)
- VALUES ({$tokensImploded})
+INSERT INTO {$database->quoteIdentifier($table)} ({$database->quoteIdentifier($this->getIdFieldName())}, $fieldsImploded)
+ VALUES (NULL, {$tokensImploded})
SQL_EOF;
$statement = $database->prepare($sql);
$statement->execute($values);
- $this->setId($database->lastInsertId());
+ $id = $database->lastInsertId($table);
+ $this->setId($id);
}
return $this;
diff --git a/application/code/core/Wootook/Core/ErrorProfiler.php b/application/code/core/Wootook/Core/ErrorProfiler.php
index ba64222..91698fe 100644
--- a/application/code/core/Wootook/Core/ErrorProfiler.php
+++ b/application/code/core/Wootook/Core/ErrorProfiler.php
@@ -90,6 +90,11 @@ class Wootook_Core_ErrorProfiler
return true;
}
+ public function addException($exception)
+ {
+ $this->_exceptions[] = $exception;
+ }
+
public function exceptionManager($exception)
{
if (!$this->_listen) {
diff --git a/application/code/core/Wootook/Core/Exception/Deprecated.php b/application/code/core/Wootook/Core/Exception/Deprecated.php
new file mode 100644
index 0000000..75cbf77
--- /dev/null
+++ b/application/code/core/Wootook/Core/Exception/Deprecated.php
@@ -0,0 +1,7 @@
+getCookieLifetime(), $this->getCookiePath(), $this->getCookieDomain(), false, true);
session_start();
}
@@ -56,6 +61,26 @@ class Wootook_Core_Model_Session
}
}
+ public function getCookieLifetime()
+ {
+ $lifetime = Wootook::getWebsiteConfig(self::COOKIE_LIFETIME_CONFIG_KEY);
+ if ($lifetime <= 0) {
+ return 900;
+ }
+
+ return $lifetime;
+ }
+
+ public function getCookieDomain()
+ {
+ return Wootook::getWebsiteConfig(self::COOKIE_DOMAIN_CONFIG_KEY);
+ }
+
+ public function getCookiePath()
+ {
+ return Wootook::getWebsiteConfig(self::COOKIE_PATH_CONFIG_KEY);
+ }
+
public function getMessages($clear = true)
{
$messages = $this->_data['messages'];
diff --git a/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php b/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php
index 19ff1ce..5e922c1 100644
--- a/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php
+++ b/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php
@@ -166,6 +166,12 @@ INSERT IGNORE INTO {$this->getTableName('core_config')} (`website_id`, `game_id`
(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'),
@@ -184,12 +190,18 @@ INSERT IGNORE INTO {$this->getTableName('core_config')} (`website_id`, `game_id`
(0, 0, 'engine/bot/name', 'Woot'),
(0, 0, 'engine/bot/email', 'contact@wootook.org');
SQL_EOF;
-/**
- * TODO: change these paths
- * (0, 0, 'BuildLabWhileRun', '0')
- * (0, 0, 'ExtCopyFrame', '0')
- * (0, 0, 'ExtCopyOwner', '')
- * (0, 0, 'ExtCopyFunct', '')
- */
+
+$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/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php b/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php
index 571d2fb..2b0aad2 100644
--- a/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php
+++ b/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php
@@ -40,7 +40,7 @@
*
*/
-$this->setSetupConnection('legacies_setup');
+$this->setSetupConnection('core_setup');
$sql = <<getTableName('core_website')};
@@ -65,3 +65,9 @@ DROP TABLE {$this->getTableName('core_config')};
SQL_EOF;
$this->query($sql);
+
+$sql = <<getTableName('errors')};
+SQL_EOF;
+
+$this->query($sql);
diff --git a/application/code/core/Wootook/Database.php b/application/code/core/Wootook/Database.php
index 735f669..75f7c0d 100644
--- a/application/code/core/Wootook/Database.php
+++ b/application/code/core/Wootook/Database.php
@@ -22,6 +22,11 @@ class Wootook_Database
return self::getConnection(self::DEFAULT_CONNECTION_NAME);
}
+ public function quoteIdentifier($identifier)
+ {
+ return "`$identifier`";
+ }
+
public static function getConnection($connectionName)
{
if (empty($connectionName) || $connectionName === null) {
diff --git a/application/code/core/Wootook/Empire/Model/Planet.php b/application/code/core/Wootook/Empire/Model/Planet.php
index 494b714..3b56f85 100644
--- a/application/code/core/Wootook/Empire/Model/Planet.php
+++ b/application/code/core/Wootook/Empire/Model/Planet.php
@@ -918,67 +918,6 @@ 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];
-
- $planet = $user->createNewPlanet(
- $systemInfo->getData('galaxy'),
- $systemInfo->getData('system'),
- $finalPosition,
- Wootook_Empire_Model_Planet::TYPE_PLANET,
- Wootook::getRequest()->getParam('planet'),
- Wootook::getGameConfig('resource/initial/fields')
- );
-
- $user
- ->setData('id_planet', $planet->getId())
- ->setData('current_planet', $planet->getId())
- ->setData('galaxy', $planet->getGalaxy())
- ->setData('system', $planet->getSystem())
- ->setData('planet', $planet->getPosition())
- ;
- }
- }
-
public static function searchMostFreeSystems($galaxyList = null, $systemList = null)
{
$collection = new Wootook_Core_Collection(array('galaxy' => 'galaxy'));
@@ -1011,15 +950,15 @@ class Wootook_Empire_Model_Planet
}
$orders = array(
- "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))",
+ "COUNT(*) / {$collection->quote(Wootook::getGameConfig('engine/universe/positions'))}",
+ "1 + ABS(galaxy.galaxy - CEIL({$collection->quote(Wootook::getGameConfig('engine/universe/galaxies'))} / 2))",
+ "1 + 2 * ABS(galaxy.system - CEIL({$collection->quote(Wootook::getGameConfig('engine/universe/systems'))} / 2))",
"RAND() / 1000",
);
$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("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')
//->order("1.5 / COUNT(*)", 'ASC')
->order('RAND()', 'ASC');
diff --git a/application/code/core/Wootook/Empire/Model/User.php b/application/code/core/Wootook/Empire/Model/User.php
index 91ea368..e66482b 100644
--- a/application/code/core/Wootook/Empire/Model/User.php
+++ b/application/code/core/Wootook/Empire/Model/User.php
@@ -23,18 +23,48 @@ class Wootook_Empire_Model_User
protected $_currentPlanet = null;
const SESSION_KEY = 'user';
- const COOKIE_NAME = 'Wootook';
+ const COOKIE_NAME = '__wtk';
const COOKIE_LIFETIME = 2592000;
+ const COOKIE_NAME_CONFIG_KEY = 'web/cookie/name';
+ const COOKIE_LIFETIME_CONFIG_KEY = 'web/cookie/time';
+ const COOKIE_DOMAIN_CONFIG_KEY = 'web/cookie/domain';
+ const COOKIE_PATH_CONFIG_KEY = 'web/cookie/path';
+
const PLANET_SORT_DATE = 0;
const PLANET_SORT_POSITION = 1;
const PLANET_SORT_NAME = 2;
- protected static $_cookieName = self::COOKIE_NAME;
-
- public static function setCookieName($name)
+ public static function getCookieName()
{
- self::$_cookieName = $name;
+ $cookieName = Wootook::getWebsiteConfig(self::COOKIE_NAME_CONFIG_KEY);
+
+ if (is_null($cookieName)) {
+ return self::COOKIE_NAME;
+ }
+
+ return $cookieName;
+ }
+
+ public static function getCookieLifetime()
+ {
+ $cookieLifetime = Wootook::getWebsiteConfig(self::COOKIE_LIFETIME_CONFIG_KEY);
+
+ if (is_null($cookieLifetime)) {
+ return self::COOKIE_LIFETIME;
+ }
+
+ return $cookieLifetime;
+ }
+
+ public static function getCookieDomain()
+ {
+ return Wootook::getWebsiteConfig(self::COOKIE_DOMAIN_CONFIG_KEY);
+ }
+
+ public static function getCookiePath()
+ {
+ return Wootook::getWebsiteConfig(self::COOKIE_PATH_CONFIG_KEY);
}
public static function factory($id)
@@ -64,8 +94,7 @@ class Wootook_Empire_Model_User
$session = Wootook::getSession(self::SESSION_KEY);
if ($session->hasData('user_id')) {
$id = intval($session->getData('user_id'));
- } else if (Wootook::getRequest() !== null && ($cookieData = Wootook::getRequest()->getCookie(self::$_cookieName)) !== null) {
- //$cookieData = unserialize(stripslashes($cookie));
+ } else if (Wootook::getRequest() !== null && ($cookieData = Wootook::getRequest()->getCookie(self::getCookieName())) !== null) {
if (is_array($cookieData)) {
$collection = new Wootook_Core_Collection(array('user' => 'users'));
$cookieData = array(
@@ -86,6 +115,9 @@ class Wootook_Empire_Model_User
$session->addError('Your session has expired, please login.');
return null;
}
+ } else {
+ $session->addError('Your session has expired, please login.');
+ return null;
}
} else {
$session->addError('Your session has expired, please login.');
@@ -132,7 +164,7 @@ class Wootook_Empire_Model_User
public function logout()
{
- Wootook::getResponse()->unsetCookie(self::$_cookieName);
+ Wootook::getResponse()->unsetCookie(self::getCookieName());
Wootook_Core_Model_Session::destroy();
}
@@ -184,7 +216,13 @@ class Wootook_Empire_Model_User
}
if (isset($_POST["rememberme"]) && Wootook::getResponse() !== null) {
- Wootook::getResponse()->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
+ Wootook::getResponse()->setCookie(
+ self::getCookieName(),
+ array('id' => $login['id'], 'key' => $login['login_rememberme']),
+ self::getCookieLifetime(),
+ self::getCookiePath(),
+ self::getCookieDomain()
+ );
}
return self::setLoggedIn(self::factory($login['id']));
@@ -223,20 +261,81 @@ class Wootook_Empire_Model_User
'user_agent' => $request->getServer('HTTP_USER_AGENT')
));
+ $user->getWriteConnection()->beginTransaction();
+
$user->save();
+ $collection = Wootook_Empire_Model_Planet::searchMostFreeSystems();
+ $collection->limit(1)->load();
+
+ if ($collection->count() == 0) {
+ throw new Wootook_Empire_Exception_RuntimeException('No more planet to colonize!'); // Oops, no more free place
+ }
+
+ $systemInfo = $collection->current();
+ if ($systemInfo->getData('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_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, 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 = $user->createNewPlanet(
+ $systemInfo->getData('galaxy'),
+ $systemInfo->getData('system'),
+ $finalPosition,
+ Wootook_Empire_Model_Planet::TYPE_PLANET,
+ Wootook::getRequest()->getParam('planet'),
+ Wootook::getGameConfig('resource/initial/fields')
+ );
+
+ $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('user.init', array(
'user' => $user
));
$user->save();
} catch (Wootook_Core_Exception_DataAccessException $e) {
+ $user->getWriteConnection()->rollback();
+ $session = Wootook_Core_Model_Session::factory(Wootook_Empire_Model_User::SESSION_KEY);
+
+ Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
+ $session->addError($e->getMessage());
+ return null;
+ } catch (Wootook_Empire_Exception_RuntimeException $e) {
+ $user->getWriteConnection()->rollback();
$session = Wootook_Core_Model_Session::factory(Wootook_Empire_Model_User::SESSION_KEY);
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
$session->addError($e->getMessage());
return null;
}
+ $user->getWriteConnection()->commit();
return $user;
}
@@ -265,17 +364,18 @@ class Wootook_Empire_Model_User
->setData('field_current', 0)
;
- $resourceConfig = Wootook::getGameConfig('resource/initial');
$resourceList = Wootook_Empire_Model_Game_Resources::getSingleton();
+ $resourceConfig = Wootook::getGameConfig('resource/initial');
+ foreach ($resourceList as $resource => $resourceData) {
+ $planet->setData($resourceData['storage_field'], $resourceConfig[$resource]);
+ }
+ $resourceConfig = Wootook::getGameConfig('resource/base-income');
foreach ($resourceList as $resource => $resourceData) {
$planet->setData($resourceData['production_field'], $resourceConfig[$resource]);
}
$planet->save();
- var_dump($planet->getId());
- die();
-
Wootook::dispatchEvent('planet.init', array(
'planet' => $planet,
'user' => $this
@@ -608,6 +708,10 @@ class Wootook_Empire_Model_User
$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 {
diff --git a/application/design/base/default/scripts/deprecated/agreement.tpl b/application/design/base/default/scripts/deprecated/agreement.tpl
deleted file mode 100644
index 44c2012..0000000
--- a/application/design/base/default/scripts/deprecated/agreement.tpl
+++ /dev/null
@@ -1 +0,0 @@
-N/A
\ No newline at end of file
diff --git a/application/design/base/default/scripts/deprecated/credit_body.tpl b/application/design/base/default/scripts/deprecated/credit_body.tpl
index 77c7886..a88e8c9 100644
--- a/application/design/base/default/scripts/deprecated/credit_body.tpl
+++ b/application/design/base/default/scripts/deprecated/credit_body.tpl
@@ -18,5 +18,4 @@
UGamela Britania
getData('cred_based')?> getData('cred_start')?>
-getData('ExtCopyFrame')?>
\ No newline at end of file
diff --git a/application/gamedata/legacies/default/events.php b/application/gamedata/legacies/default/events.php
index 085569f..23bdedb 100644
--- a/application/gamedata/legacies/default/events.php
+++ b/application/gamedata/legacies/default/events.php
@@ -8,17 +8,13 @@
'logout.success' => array(),
'register.before' => array(),
'register.failure' => array(),
- 'register.success' => array(
- array('Wootook_Empire_Model_Planet', 'registrationListener')
- ),
+ 'register.success' => array(),
'planet.update' => array(
array('Wootook_Empire_Model_Planet', 'planetUpdateListener'),
array('Legacies_Empire_Model_Planet_Building_Shipyard', 'planetUpdateListener'),
array('Legacies_Officers_Model_Observer', 'planetUpdateListener')
),
- 'user.init' => array(
- array('Wootook_Empire_Model_Planet', 'registrationListener')
- ),
+ 'user.init' => array(),
'planet.init' => array(
array('Wootook_Empire_Model_Galaxy_Position', 'initPlanetListerner')
),
diff --git a/application/test/bootstrap.php b/application/test/bootstrap.php
index 19dfeed..a51c644 100644
--- a/application/test/bootstrap.php
+++ b/application/test/bootstrap.php
@@ -13,12 +13,12 @@ if (!defined('DEBUG')) {
@error_reporting(E_ALL | E_STRICT);
}
-defined('ROOT_PATH') || define('ROOT_PATH', dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR);
-defined('APPLICATION_PATH') || define('APPLICATION_PATH', ROOT_PATH . 'includes' . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR);
+defined('ROOT_PATH') || define('ROOT_PATH', dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR);
+defined('APPLICATION_PATH') || define('APPLICATION_PATH', ROOT_PATH . 'application' . DIRECTORY_SEPARATOR);
-defined('PHPEXT') || define('PHPEXT', require ROOT_PATH . 'extension.inc');
+defined('PHPEXT') || define('PHPEXT', 'php');
-defined('VERSION') || define('VERSION', '2009.5');
+defined('VERSION') || define('VERSION', '1.5');
set_include_path(implode(PATH_SEPARATOR, array(
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'core',
diff --git a/application/test/registration.php b/application/test/registration.php
index e02fbe7..e7015ab 100644
--- a/application/test/registration.php
+++ b/application/test/registration.php
@@ -2,42 +2,8 @@
include './bootstrap.php';
+$username = uniqid();
+$email = $username . '@wootook.org';
+$password = substr(sha1(uniqid()), mt_rand(0, 32), 8);
-header('Content-Type: text/csv');
-header('Content-Disposition: attachment; filename="test.csv"');
-
-/*
-$datas = array(
- 'galaxy' => 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
+Wootook_Empire_Model_User::register($username, $email, $password);
\ No newline at end of file
diff --git a/fleet.php b/fleet.php
index 8ed31d9..4f72f44 100644
--- a/fleet.php
+++ b/fleet.php
@@ -73,13 +73,13 @@ $planet = $user->getCurrentPlanet();
$MaxFlyingFleets = $user->getFleetCount();
-if ($galaxy <= 0 || $galaxy > MAX_GALAXY_IN_WORLD) {
+if ($galaxy <= 0 || $galaxy > Wootook::getGameConfig('engine/universe/galaxies')) {
$galaxy = $planet['galaxy'];
}
-if ($system <= 0 || $system > MAX_SYSTEM_IN_GALAXY) {
+if ($system <= 0 || $system > Wootook::getGameConfig('engine/universe/systems')) {
$system = $planet['system'];
}
-if ($position <= 0 || $position > MAX_PLANET_IN_SYSTEM) {
+if ($position <= 0 || $position > Wootook::getGameConfig('engine/universe/positions')) {
$position = $planet['planet'];
}
diff --git a/fleetshortcut.php b/fleetshortcut.php
index 73e5325..44248f3 100644
--- a/fleetshortcut.php
+++ b/fleetshortcut.php
@@ -64,9 +64,9 @@ if ($mode) {
$r = array();
$r[0] = preg_replace('#[^[:alnum:]\s\-\_\']#', '', $name);
- $r[1] = (isset($_POST['g']) && intval($_POST['g']) > 0 && intval($_POST['g']) <= MAX_GALAXY_IN_WORLD) ? intval($_POST['g']) : '1';
- $r[2] = (isset($_POST['s']) && intval($_POST['s']) > 0 && intval($_POST['s']) <= MAX_SYSTEM_IN_GALAXY) ? intval($_POST['s']) : '1';
- $r[3] = (isset($_POST['p']) && intval($_POST['p']) > 0 && intval($_POST['p']) <= MAX_PLANET_IN_SYSTEM) ? intval($_POST['p']) : '1';
+ $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);
@@ -123,9 +123,9 @@ if ($mode) {
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']) <= MAX_GALAXY_IN_WORLD) ? intval($_POST['g']) : $r[1];
- $r[2] = (isset($_POST['s']) && intval($_POST['s']) > 0 && intval($_POST['s']) <= MAX_SYSTEM_IN_GALAXY) ? intval($_POST['s']) : $r[2];
- $r[3] = (isset($_POST['p']) && intval($_POST['p']) > 0 && intval($_POST['p']) <= MAX_PLANET_IN_SYSTEM) ? intval($_POST['p']) : $r[3];
+ $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);
diff --git a/floten1.php b/floten1.php
index 42bb9c7..1f627ef 100644
--- a/floten1.php
+++ b/floten1.php
@@ -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 > MAX_GALAXY_IN_WORLD) {
+if ($g <= 0 || $g > Wootook::getGameConfig('engine/universe/galaxies')) {
$g = $planetrow['galaxy'];
}
-if ($s <= 0 || $s > MAX_SYSTEM_IN_GALAXY) {
+if ($s <= 0 || $s > Wootook::getGameConfig('engine/universe/systems')) {
$s = $planetrow['system'];
}
-if ($p <= 0 || $p > MAX_PLANET_IN_SYSTEM) {
+if ($p <= 0 || $p > Wootook::getGameConfig('engine/universe/positions')) {
$p = $planetrow['planet'];
}
$allowedPlanetTypes = array(
diff --git a/floten2.php b/floten2.php
index 367df96..e092f3a 100644
--- a/floten2.php
+++ b/floten2.php
@@ -66,7 +66,7 @@ $fleetArray = $session['fleet'];
$missionTypes = array();
// Determinons les type de missions possibles par rapport a la planete cible
-if ($position == (MAX_PLANET_IN_SYSTEM + 1)) {
+if ($position == (Wootook::getGameConfig('engine/universe/positions') + 1)) {
$missionTypes[Legacies_Empire::ID_MISSION_EXPEDITION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION];
} else {
if ($planettype == Wootook_Empire_Model_Planet::TYPE_DEBRIS) {
@@ -98,7 +98,7 @@ if ($position == (MAX_PLANET_IN_SYSTEM + 1)) {
(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 && ALLOW_SPY_DRONE_ATTACKS) ||
+ (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) ||
@@ -144,7 +144,7 @@ $session['type'] = $planettype;
$MissionSelector = "";
if (count($missionTypes) > 0) {
- if ($planet == (MAX_PLANET_IN_SYSTEM + 1)) {
+ if ($planet == (Wootook::getGameConfig('engine/universe/positions') + 1)) {
$MissionSelector .= "";
$MissionSelector .= "";
$MissionSelector .= " ". $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION] ." ";
@@ -265,7 +265,7 @@ $page .= " ". $lang['fl_a
$page .= " \n";
$page .= " \n";
$page .= " \n";
-if ($planet == (MAX_PLANET_IN_SYSTEM + 1)) {
+if ($planet == (Wootook::getGameConfig('engine/universe/positions') + 1)) {
$page .= "";
$page .= "". $lang['fl_expe_staytime'] ." ";
$page .= " ";
diff --git a/floten3.php b/floten3.php
index dee1a08..d3173fc 100644
--- a/floten3.php
+++ b/floten3.php
@@ -136,7 +136,7 @@ if ($destination->getUserId() == $user['id']) {
$missionTypes = array();
// Determinons les type de missions possibles par rapport a la planete cible
-if ($position == (MAX_PLANET_IN_SYSTEM + 1)) {
+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) {
@@ -168,7 +168,7 @@ if ($position == (MAX_PLANET_IN_SYSTEM + 1)) {
(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 && ALLOW_SPY_DRONE_ATTACKS) ||
+ (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) ||
@@ -295,15 +295,15 @@ if (!in_array($speed, $possibleSpeeds)) {
$error = 0;
$errorlist = "";
-if ($galaxy > MAX_GALAXY_IN_WORLD || $galaxy < 1) {
+if ($galaxy > Wootook::getGameConfig('engine/universe/galaxies') || $galaxy < 1) {
$error++;
$errorlist .= $lang['fl_limit_galaxy'];
}
-if ($system > MAX_SYSTEM_IN_GALAXY || $system < 1) {
+if ($system > Wootook::getGameConfig('engine/universe/systems') || $system < 1) {
$error++;
$errorlist .= $lang['fl_limit_system'];
}
-if ($position > (MAX_PLANET_IN_SYSTEM + 1) || $position < 1) {
+if ($position > (Wootook::getGameConfig('engine/universe/positions') + 1) || $position < 1) {
$error++;
$errorlist .= $lang['fl_limit_planet'];
}
diff --git a/galaxy.php b/galaxy.php
index e0e45cf..b93a201 100644
--- a/galaxy.php
+++ b/galaxy.php
@@ -69,36 +69,36 @@ if ($mode == 0) {
$system = $CurrentSystem;
} elseif ($mode == 1 || $mode == 3) {
if (isset($_POST["galaxyLeft"])) {
- if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 1 || $_POST["galaxy"] > MAX_GALAXY_IN_WORLD) {
+ 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"] >= MAX_GALAXY_IN_WORLD) {
- $galaxy = MAX_GALAXY_IN_WORLD;
+ 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"] > MAX_GALAXY_IN_WORLD) {
+ } 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"] > MAX_SYSTEM_IN_GALAXY) {
+ 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"] >= MAX_SYSTEM_IN_GALAXY) {
- $system = MAX_SYSTEM_IN_GALAXY;
+ 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"] > MAX_SYSTEM_IN_GALAXY) {
+ } else if (!isset($_POST["system"]) || $_POST["system"] <= 1 || $_POST["system"] > Wootook::getGameConfig('engine/universe/systems')) {
$system = 1;
} else {
$system = intval($_POST["system"]);
@@ -106,24 +106,24 @@ if ($mode == 0) {
} elseif ($mode == 2) {
if (!isset($_POST["galaxy"]) || $_POST["galaxy"] <= 0) {
$galaxy = 1;
- } else if ($_POST["galaxy"] >= MAX_GALAXY_IN_WORLD) {
- $galaxy = MAX_GALAXY_IN_WORLD;
+ } else 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"] >= MAX_SYSTEM_IN_GALAXY) {
- $system = MAX_SYSTEM_IN_GALAXY;
+ } 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"] >= MAX_PLANET_IN_SYSTEM) {
- $planet = MAX_PLANET_IN_SYSTEM;
+ } else if ($_POST["planet"] >= Wootook::getGameConfig('engine/universe/positions')) {
+ $planet = Wootook::getGameConfig('engine/universe/positions');
} else {
$planet = intval($_POST["planet"]) + 1;
}
diff --git a/includes/constants.php b/includes/constants.php
index 75980b1..3178c8d 100644
--- a/includes/constants.php
+++ b/includes/constants.php
@@ -32,12 +32,7 @@ defined('E_USER_DEPRECATED') || define('E_USER_DEPRECATED', E_USER_WARNING); //
define('ADMINEMAIL', "no-reply@wootook.org");
-// Definition du monde connu !
-defined('MAX_GALAXY_IN_WORLD') || define('MAX_GALAXY_IN_WORLD', Wootook::getGameConfig('engine/universe/galaxies'));
-defined('MAX_SYSTEM_IN_GALAXY') || define('MAX_SYSTEM_IN_GALAXY', Wootook::getGameConfig('engine/universe/systems'));
-defined('MAX_PLANET_IN_SYSTEM') || define('MAX_PLANET_IN_SYSTEM', Wootook::getGameConfig('engine/universe/positions'));
-
-defined('BCNUMBERS') || define('BCNUMBERS', Wootook::getConfig('default/engine/core/use_large_numbers'));
+defined('BCNUMBERS') || define('BCNUMBERS', Wootook::getGameConfig('engine/core/use_large_numbers'));
/**
* User level constants
@@ -51,8 +46,6 @@ define('LEVEL_PLAYER', 0);
* }}}
*/
-define('ALLOW_SPY_DRONE_ATTACKS', Wootook::getConfig('default/engine/combat/allow_spy_drone_attacks'));
-
// Nombre de colones pour les rapports d'espionnage
define('SPY_REPORT_ROW', 2);
@@ -76,9 +69,6 @@ define('SHOW_ADMIN_IN_RECORDS', false);
// Valeurs de bases pour les colonies ou planetes fraichement crées
define('BASE_STORAGE_SIZE', 100000);
-define('BUILD_METAL', 500);
-define('BUILD_CRISTAL', 500);
-define('BUILD_DEUTERIUM', 0);
// Chemin vers le skin de base
define('DEFAULT_SKINPATH', 'skin/base/default/');
diff --git a/includes/deprecated.php b/includes/deprecated.php
index 7e60e09..92693cd 100644
--- a/includes/deprecated.php
+++ b/includes/deprecated.php
@@ -39,7 +39,7 @@
*/
function AddBuildingToQueue($currentPlanet, $currentUser, $buildingId, $AddMode = true)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -59,7 +59,7 @@ function AddBuildingToQueue($currentPlanet, $currentUser, $buildingId, $AddMode
*/
function BuildingSavePlanetRecord($currentPlanet)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -77,7 +77,7 @@ function BuildingSavePlanetRecord($currentPlanet)
*/
function BuildingSaveUserRecord($currentUser)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentUser instanceof Wootook_Empire_Model_User) {
trigger_error('$currentUser should be an instance of Wootook_Empire_Model_User', E_USER_WARNING);
@@ -94,7 +94,7 @@ function BuildingSaveUserRecord($currentUser)
*/
function CheckPlanetBuildingQueue($currentPlanet, $currentUser)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -116,7 +116,7 @@ function CheckPlanetBuildingQueue($currentPlanet, $currentUser)
*/
function CheckPlanetUsedFields($currentPlanet)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -137,7 +137,7 @@ function CheckPlanetUsedFields($currentPlanet)
*/
function GetBuildingPrice($currentUser, $currentPlanet, $buildingId, $incremental = true, $destroy = false)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -190,7 +190,7 @@ function GetBuildingPrice($currentUser, $currentPlanet, $buildingId, $incrementa
*/
function GetBuildingTime($currentUser, $currentPlanet, $buildingId)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -225,7 +225,7 @@ function GetBuildingTime($currentUser, $currentPlanet, $buildingId)
*/
function GetBuildingTimeLevel($currentUser, $currentPlanet, $buildingId, $level)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -260,7 +260,7 @@ function GetBuildingTimeLevel($currentUser, $currentPlanet, $buildingId, $level)
*/
function GetElementPrice($currentUser, $currentPlanet, $buildingId, $userfactor = true)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -318,7 +318,7 @@ function GetElementPrice($currentUser, $currentPlanet, $buildingId, $userfactor
*/
function GetElementRessources($elementId, $count)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
$currentUser = Wootook_Empire_Model_User::getSingleton();
$currentPlanet = $currentUser->getCurrentPlanet();
@@ -337,7 +337,7 @@ function GetElementRessources($elementId, $count)
*/
function HandleElementBuildingQueue($currentUser, $currentPlanet, $productionTime)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
return array();
}
@@ -351,7 +351,7 @@ function HandleElementBuildingQueue($currentUser, $currentPlanet, $productionTim
*/
function CheckCookies($isUserChecked)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
$user = Wootook_Empire_Model_User::getSingleton();
@@ -377,7 +377,7 @@ function CheckCookies($isUserChecked)
*/
function CheckTheUser($isUserChecked)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
$result = CheckCookies($isUserChecked);
@@ -398,7 +398,7 @@ function CheckTheUser($isUserChecked)
*/
function UpdatePlanetBatimentQueueList($currentPlanet, $currentUser)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -417,7 +417,7 @@ function UpdatePlanetBatimentQueueList($currentPlanet, $currentUser)
*/
function CalculateMaxPlanetFields($currentPlanet)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -436,7 +436,7 @@ function CalculateMaxPlanetFields($currentPlanet)
*/
function AbandonColony($currentUser, $currentPlanet)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -459,7 +459,7 @@ function AbandonColony($currentUser, $currentPlanet)
*/
function CheckFleets($currentPlanet)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -477,7 +477,7 @@ function CheckFleets($currentPlanet)
*/
function CancelBuildingFromQueue($currentPlanet, $currentUser)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
@@ -529,7 +529,7 @@ class Deprecated
*/
function display($page, $title = '', $topnav = true, $metatags = '', $adminPage = false)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
// TODO: implement extra meta tags
$layout = Deprecated::getLayout($adminPage);
@@ -563,7 +563,7 @@ function display($page, $title = '', $topnav = true, $metatags = '', $adminPage
*/
function parsetemplate($template, $array)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
static $baseUrl = null;
if ($baseUrl === null) {
@@ -589,7 +589,7 @@ function parsetemplate($template, $array)
*/
function ReadFromFile($filename)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
return file_get_contents($filename);
}
@@ -603,7 +603,7 @@ function ReadFromFile($filename)
*/
function saveToFile($filename, $content)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
file_put_contents($filename, $content);
}
@@ -616,7 +616,7 @@ function saveToFile($filename, $content)
*/
function getTemplate($templateName)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
return $templateName;
}
@@ -632,7 +632,7 @@ function getTemplate($templateName)
*/
function doquery($query, $table, $fetch = false)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
/**
* @var Wootook_Database $database
@@ -666,7 +666,7 @@ function doquery($query, $table, $fetch = false)
*/
function ResetThisFuckingCheater($userId)
{
- defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
$user = Wootook_Empire_Model_User::factory($userId);
$username = $user->getData('username');
diff --git a/includes/functions/ShowGalaxyRows.php b/includes/functions/ShowGalaxyRows.php
index 695d92e..41ec7b1 100644
--- a/includes/functions/ShowGalaxyRows.php
+++ b/includes/functions/ShowGalaxyRows.php
@@ -38,7 +38,7 @@ function ShowGalaxyRows ($Galaxy, $System) {
global $lang, $planetcount, $CurrentRC, $dpath, $user;
$Result = "";
- for ($Planet = 1; $Planet <= MAX_PLANET_IN_SYSTEM; $Planet++) {
+ for ($Planet = 1; $Planet <= Wootook::getGameConfig('engine/universe/positions'); $Planet++) {
$GalaxyRowPlanet = array();
$GalaxyRowMoon = array();
diff --git a/includes/functions/ShowGalaxySelector.php b/includes/functions/ShowGalaxySelector.php
index e43553f..fc1cc62 100644
--- a/includes/functions/ShowGalaxySelector.php
+++ b/includes/functions/ShowGalaxySelector.php
@@ -37,14 +37,14 @@
function ShowGalaxySelector ( $Galaxy, $System ) {
global $lang;
- if ($Galaxy > MAX_GALAXY_IN_WORLD) {
- $Galaxy = MAX_GALAXY_IN_WORLD;
+ if ($Galaxy > Wootook::getGameConfig('engine/universe/galaxies')) {
+ $Galaxy = Wootook::getGameConfig('engine/universe/galaxies');
}
if ($Galaxy < 1) {
$Galaxy = 1;
}
- if ($System > MAX_SYSTEM_IN_GALAXY) {
- $System = MAX_SYSTEM_IN_GALAXY;
+ if ($System > Wootook::getGameConfig('engine/universe/systems')) {
+ $System = Wootook::getGameConfig('engine/universe/systems');
}
if ($System < 1) {
$System = 1;
diff --git a/install/index.php b/install/index.php
index 23a77a4..ef6df1f 100644
--- a/install/index.php
+++ b/install/index.php
@@ -28,17 +28,69 @@
*
*/
-define('INSIDE' , true);
-define('INSTALL', false);
-define('IN_INSTALL', true);
-
define('STEP_SYSTEM', 1);
define('STEP_DATABASE', 2);
define('STEP_UNIVERSE', 3);
define('STEP_PROFILE', 4);
define('STEP_CONFIG', 5);
-require_once dirname(dirname(__FILE__)) . '/application/bootstrap.php';
+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';
+}
+
+$website = new Wootook_Core_Model_Website();
+$website->setId(1)->setData('code', Wootook_Core_Model_Website::DEFAULT_CODE);
+Wootook::setWebsite(1, $website);
+
+$game = new Wootook_Core_Model_Game();
+$game->setId(1)->setData('website_id', $website->getId())->setData('code', Wootook_Core_Model_Game::DEFAULT_CODE);
+Wootook::setGame(1, $game);
+
+include ROOT_PATH . 'includes' . DIRECTORY_SEPARATOR . 'constants.php';
+
+Wootook_Core_Time::init();
+Wootook_Core_ErrorProfiler::register();
+Wootook_Core_Model_Config_Events::registerEvents();
$mode = isset($_GET['mode']) ? strval($_GET['mode']) : 'intro';
$step = isset($_GET['step']) ? intval($_GET['step']) : 1;
@@ -86,6 +138,7 @@ $config = unserialize($session->getData('config'));
if (!is_array($config)) {
$config = array();
}
+
Wootook::loadConfig(array_merge_recursive($config, $configRewrites));
$layout = new Wootook_Core_Layout();
@@ -419,6 +472,8 @@ case 'install':
Wootook_Empire_Model_User::setLoggedIn($user);
$user->setData('authlevel', LEVEL_ADMIN)->save();
+
+ $user->getHomePlanet()->setName(Wootook::__('Planet'))->save();
}
$session->setData('step', STEP_CONFIG);
diff --git a/install/injection-galaxy.txt b/install/injection-galaxy.txt
deleted file mode 100644
index 00cee53..0000000
--- a/install/injection-galaxy.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-INSERT INTO `game_galaxy` (`galaxy`, `system`, `planet`, `id_planet`, `metal`, `crystal`, `id_luna`, `luna`)
- SELECT _increment.galaxy, _increment.system, 0, 0, 0, 0, 0, 0
- FROM (
- SELECT _galaxy.galaxy, (1 + _10e0.system + _10e1.system + _10e2.system) 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
- ) _10e0
- CROSS JOIN (
- SELECT 0 AS system
- UNION ALL
- SELECT 10 AS system
- UNION ALL
- SELECT 20 AS system
- UNION ALL
- SELECT 30 AS system
- UNION ALL
- SELECT 40 AS system
- UNION ALL
- SELECT 50 AS system
- UNION ALL
- SELECT 60 AS system
- UNION ALL
- SELECT 70 AS system
- UNION ALL
- SELECT 80 AS system
- UNION ALL
- SELECT 90 AS system
- ) _10e1
- CROSS JOIN (
- SELECT 0 AS system
- UNION ALL
- SELECT 100 AS system
- UNION ALL
- SELECT 200 AS system
- UNION ALL
- SELECT 300 AS system
- UNION ALL
- SELECT 400 AS system
- UNION ALL
- SELECT 500 AS system
- UNION ALL
- SELECT 600 AS system
- UNION ALL
- SELECT 700 AS system
- UNION ALL
- SELECT 800 AS system
- UNION ALL
- SELECT 900 AS system
- ) _10e2
- CROSS JOIN (
- SELECT 1 AS galaxy
- UNION ALL
- SELECT 2 AS galaxy
- UNION ALL
- SELECT 3 AS galaxy
- UNION ALL
- SELECT 4 AS galaxy
- UNION ALL
- SELECT 5 AS galaxy
- UNION ALL
- SELECT 6 AS galaxy
- UNION ALL
- SELECT 7 AS galaxy
- UNION ALL
- SELECT 8 AS galaxy
- UNION ALL
- SELECT 9 AS galaxy
- ) _galaxy
- ) _increment
-
- WHERE _increment.galaxy<=3
- AND _increment.system<=100
\ No newline at end of file
diff --git a/install/upgrade-galaxy.php b/install/upgrade-galaxy.php
deleted file mode 100644
index 4a7f26c..0000000
--- a/install/upgrade-galaxy.php
+++ /dev/null
@@ -1,98 +0,0 @@
-isPost() && $request->getPost('username') !== null && $request->getPost('password') !== null) {
+ $user = Wootook_Empire_Model_User::login($request->getPost('username'), $request->getPost('password'), (bool) $request->getPost('rememberme'));
$session = Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY);
if ($user !== null && $user->getId()) {
@@ -70,6 +72,7 @@ $onlinePlayersStatement->execute();
$onlinePlayers = $onlinePlayersStatement->fetch(Wootook_Database::FETCH_COLUMN, 0);
$layout = new Wootook_Core_Layout();
+$layout->getMessagesBlock()->prepareMessages(Wootook_Empire_Model_User::SESSION_KEY)
$layout->load('login');
$block = $layout->getBlock('login');