Updated installer
Added Website and Game models Updted config loading Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
fcd1f5b740
commit
5393be4daf
39 changed files with 779 additions and 661 deletions
|
|
@ -129,211 +129,6 @@ SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_website')} (
|
|
||||||
`website_id` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`code` VARCHAR(64) NOT NULL,
|
|
||||||
`name` VARCHAR(255) NOT NULL,
|
|
||||||
`sort_order` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`default_group_id` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`is_default` BOOL NOT NULL,
|
|
||||||
`is_staging` BOOL NOT NULL,
|
|
||||||
`is_active` BOOL NOT NULL,
|
|
||||||
PRIMARY KEY (`webste_id`),
|
|
||||||
UNIQUE (`code`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game_group')} (
|
|
||||||
`group_id` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`website_id` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`code` VARCHAR(64) NOT NULL,
|
|
||||||
`name` VARCHAR(255) NOT NULL,
|
|
||||||
`sort_order` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`is_default` BOOL NOT NULL,
|
|
||||||
PRIMARY KEY (`group_id`),
|
|
||||||
INDEX (`webste_id`),
|
|
||||||
UNIQUE (`code`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game')} (
|
|
||||||
`game_id` SMALLINT UNSIGNED NOT NULL,
|
|
||||||
`group_id` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`website_id` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`code` VARCHAR(64) NOT NULL,
|
|
||||||
`name` VARCHAR(255) NOT NULL,
|
|
||||||
`sort_order` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`is_default` BOOL NOT NULL,
|
|
||||||
`is_staging` BOOL NOT NULL,
|
|
||||||
`is_active` BOOL NOT NULL,
|
|
||||||
PRIMARY KEY (`group_id`),
|
|
||||||
INDEX (`webste_id`),
|
|
||||||
UNIQUE (`code`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
INSERT INTO {$this->getTableName('core_website')} (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`, `is_staging`, `is_active`)
|
|
||||||
VALUES
|
|
||||||
(0, "admin", "Administration", 0, 0, 0, 0, 1),
|
|
||||||
(1, "default", "Default Website", 1, 1, 1, 0, 1);
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
INSERT INTO {$this->getTableName('core_game_group')} (`group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`)
|
|
||||||
VALUES
|
|
||||||
(0, 0, "admin", "Administration", 0, 0),
|
|
||||||
(1, 1, "default", "Default Group", 1, 1);
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
INSERT INTO {$this->getTableName('core_game')} (`game_id`, `group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`, `is_staging`, `is_active`)
|
|
||||||
VALUES
|
|
||||||
(0, 0, 0, "admin", "Administration", 0, 0, 0, 1),
|
|
||||||
(1, 1, 1, "default", "Default Game", 1, 1, 0, 1);
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_config')} (
|
|
||||||
`website_id` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`game_id` TINYINT UNSIGNED NOT NULL,
|
|
||||||
`config_path` VARCHAR(64) NOT NULL,
|
|
||||||
`config_value` VARCHAR(255) NOT NULL,
|
|
||||||
PRIMARY KEY (`website_id`, `game_id`, `config_path`),
|
|
||||||
INDEX (`website_id`),
|
|
||||||
INDEX (`game_id`),
|
|
||||||
INDEX (`config_path`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
INSERT IGNORE INTO {$this->getTableName('core_config')} (`webste_id`, `game_id`, `config_path`, `config_value`) VALUES
|
|
||||||
(1, 1, 'resource/base-income/metal', '20'),
|
|
||||||
(1, 1, 'resource/base-income/cristal', '10'),
|
|
||||||
(1, 1, 'resource/base-income/deuterium', '0'),
|
|
||||||
(1, 1, 'resource/base-income/energy', '0'),
|
|
||||||
|
|
||||||
(1, 1, 'resource/initial/fields', '163'),
|
|
||||||
(1, 1, 'resource/initial/metal', '500'),
|
|
||||||
(1, 1, 'resource/initial/cristal', '500'),
|
|
||||||
(1, 1, 'resource/initial/deuterium', '0'),
|
|
||||||
(1, 1, 'resource/initial/energy', '0'),
|
|
||||||
|
|
||||||
(1, 1, 'game/general/name', 'Wootook'),
|
|
||||||
(1, 1, 'game/general/boards-url', 'http://wootook.org/board/'),
|
|
||||||
(1, 1, 'game/general/extra-url-title', 'Wootook!'),
|
|
||||||
(1, 1, 'game/general/extra-url', 'http://wootook.org/'),
|
|
||||||
(1, 1, 'game/general/active', '1'),
|
|
||||||
(1, 1, 'game/general/closing-message', 'Le jeu est clos pour le moment.'),
|
|
||||||
(1, 1, 'game/general/locale', 'fr_FR'),
|
|
||||||
|
|
||||||
(1, 1, 'game/resource/multiplier', '1000'),
|
|
||||||
(1, 1, 'game/speed/general', '2500'),
|
|
||||||
(1, 1, 'game/speed/fleet', '2500'),
|
|
||||||
|
|
||||||
(1, 1, 'game/debris/metal-percent', '30'),
|
|
||||||
(1, 1, 'game/debris/cristal-percent', '30'),
|
|
||||||
(1, 1, 'game/debris/deuterium-percent', '0'),
|
|
||||||
(1, 1, 'game/debris/energy-percent', '0'),
|
|
||||||
|
|
||||||
(1, 1, 'game/debris/fleet', '1'),
|
|
||||||
(1, 1, 'game/debris/defense', '0'),
|
|
||||||
|
|
||||||
(1, 1, 'game/noob-protection/active', '0'),
|
|
||||||
(1, 1, 'game/noob-protection/points-cap', '5000'),
|
|
||||||
(1, 1, 'game/noob-protection/multiplier', '5'),
|
|
||||||
|
|
||||||
(0, 0, 'web/cookie/name', '__wtk'),
|
|
||||||
(0, 0, 'web/cookie/time', '2592000'),
|
|
||||||
(0, 0, 'web/cookie/domain', ''),
|
|
||||||
(0, 0, 'web/cookie/path', ''),
|
|
||||||
|
|
||||||
(0, 0, 'engine/options/bbcode', '1'),
|
|
||||||
(0, 0, 'engine/options/ga', '1'),
|
|
||||||
(0, 0, 'engine/options/announces', '0'),
|
|
||||||
(0, 0, 'engine/options/retailer', '0'),
|
|
||||||
(0, 0, 'engine/options/notes', '0'),
|
|
||||||
(0, 0, 'engine/options/chat', '0'),
|
|
||||||
(0, 0, 'engine/options/banner', '0'),
|
|
||||||
(0, 0, 'engine/options/vacation-min-time', '172800'),
|
|
||||||
|
|
||||||
(0, 0, 'game/news/active', '0'),
|
|
||||||
(0, 0, 'game/news/content', 'Bienvenue sur le nouveau serveur de jeu Wootook!'),
|
|
||||||
|
|
||||||
(0, 0, 'engine/ban/duration', '86400'),
|
|
||||||
|
|
||||||
(0, 0, 'engine/bot/active', '0'),
|
|
||||||
(0, 0, 'engine/bot/name', 'Woot'),
|
|
||||||
(0, 0, 'engine/bot/email', 'contact@wootook.org'),
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- (0, 0, 'game_speed', '2500'),
|
|
||||||
-- (0, 0, 'fleet_speed', '2500'),
|
|
||||||
-- (0, 0, 'resource_multiplier', '1000'),
|
|
||||||
|
|
||||||
-- (0, 0, 'metal_basic_income', '20'),
|
|
||||||
-- (0, 0, 'cristal_basic_income', '10'),
|
|
||||||
-- (0, 0, 'deuterium_basic_income', '0'),
|
|
||||||
-- (0, 0, 'energy_basic_income', '0'),
|
|
||||||
|
|
||||||
-- (0, 0, 'Fleet_Cdr', '30'),
|
|
||||||
-- (0, 0, 'Defs_Cdr', '30'),
|
|
||||||
-- (0, 0, 'initial_fields', '5000'),
|
|
||||||
-- (0, 0, 'COOKIE_NAME', 'wootook'),
|
|
||||||
-- (0, 0, 'game_name', 'Wootook'),
|
|
||||||
-- (0, 0, 'game_disable', '1'),
|
|
||||||
-- (0, 0, 'close_reason', 'Le jeu est clos pour le moment.'),
|
|
||||||
(0, 0, 'BuildLabWhileRun', '0'),
|
|
||||||
-- (0, 0, 'urlaubs_modus_erz', '1'),
|
|
||||||
-- (0, 0, 'noobprotection', '1'),
|
|
||||||
-- (0, 0, 'noobprotectiontime', '5000'),
|
|
||||||
-- (0, 0, 'noobprotectionmulti', '5'),
|
|
||||||
-- (0, 0, 'forum_url', 'http://wootook.org/board/'),
|
|
||||||
-- (0, 0, 'OverviewNewsFrame', '1'),
|
|
||||||
-- (0, 0, 'OverviewNewsTEXT', 'Bienvenue sur le nouveau serveur Wootook'),
|
|
||||||
-- (0, 0, 'OverviewExternChat', '0'),
|
|
||||||
-- (0, 0, 'OverviewExternChatCmd', ''),
|
|
||||||
-- (0, 0, 'OverviewBanner', '0'),
|
|
||||||
-- (0, 0, 'OverviewClickBanner', ''),
|
|
||||||
(0, 0, 'ExtCopyFrame', '0'),
|
|
||||||
(0, 0, 'ExtCopyOwner', ''),
|
|
||||||
(0, 0, 'ExtCopyFunct', ''),
|
|
||||||
-- (0, 0, 'ForumBannerFrame', '0'),
|
|
||||||
-- (0, 0, 'stat_settings', '1000'),
|
|
||||||
-- (0, 0, 'link_enable', '0'),
|
|
||||||
-- (0, 0, 'link_name', ''),
|
|
||||||
-- (0, 0, 'link_url', ''),
|
|
||||||
-- (0, 0, 'enable_announces', '1'),
|
|
||||||
-- (0, 0, 'enable_marchand', '1'),
|
|
||||||
-- (0, 0, 'enable_notes', '1'),
|
|
||||||
-- (0, 0, 'bot_name', 'Isaac'),
|
|
||||||
-- (0, 0, 'bot_adress', 'contact@wootook.org'),
|
|
||||||
-- (0, 0, 'banner_source_post', '../images/bann.png'),
|
|
||||||
-- (0, 0, 'ban_duration', '30'),
|
|
||||||
-- (0, 0, 'enable_bot', '0'),
|
|
||||||
-- (0, 0, 'enable_bbcode', '1');
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('declared')} (
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('declared')} (
|
||||||
`declarator` TEXT NOT NULL,
|
`declarator` TEXT NOT NULL,
|
||||||
|
|
@ -755,8 +550,8 @@ $this->query($sql);
|
||||||
/*
|
/*
|
||||||
* Galaxy positions generation
|
* Galaxy positions generation
|
||||||
*/
|
*/
|
||||||
$galaxyCount = Wootook::getConfig('default/engine/universe/galaxies');
|
$galaxyCount = Wootook::getConfig('engine/universe/galaxies');
|
||||||
$systemCount = Wootook::getConfig('default/engine/universe/systems');
|
$systemCount = Wootook::getConfig('engine/universe/systems');
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
INSERT INTO {$this->getTableName('galaxy')}
|
INSERT INTO {$this->getTableName('galaxy')}
|
||||||
|
|
|
||||||
|
|
@ -40,124 +40,118 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$this->setSetupConnection('legacies_setup');
|
$this->setSetupConnection('core_setup');
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/aks')};
|
DROP TABLE {$this->getTableName('aks')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/alliance')};
|
DROP TABLE {$this->getTableName('alliance')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/annonce')};
|
DROP TABLE {$this->getTableName('annonce')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/banned')};
|
DROP TABLE {$this->getTableName('banned')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/buddy')};
|
DROP TABLE {$this->getTableName('buddy')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/chat')};
|
DROP TABLE {$this->getTableName('chat')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/config')};
|
DROP TABLE {$this->getTableName('declared')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/declared')};
|
DROP TABLE {$this->getTableName('errors')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/errors')};
|
DROP TABLE {$this->getTableName('fleets')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/fleets')};
|
DROP TABLE {$this->getTableName('galaxy')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/galaxy')};
|
DROP TABLE {$this->getTableName('iraks')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/iraks')};
|
DROP TABLE {$this->getTableName('lunas')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/lunas')};
|
DROP TABLE {$this->getTableName('messages')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/messages')};
|
DROP TABLE {$this->getTableName('multi')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/multi')};
|
DROP TABLE {$this->getTableName('notes')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/notes')};
|
DROP TABLE {$this->getTableName('planets')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/planets')};
|
DROP TABLE {$this->getTableName('rw')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/rw')};
|
DROP TABLE {$this->getTableName('statpoints')};
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
DROP TABLE {$this->getTableName('legacies/statpoints')};
|
DROP TABLE {$this->getTableName('users')};
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$this->query($sql);
|
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
|
||||||
DROP TABLE {$this->getTableName('legacies/users')};
|
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,18 @@ class Wootook
|
||||||
*/
|
*/
|
||||||
protected static $_gameConfigs = array();
|
protected static $_gameConfigs = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter description here ...
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $_ignoreDatabaseConfig = false;
|
||||||
|
|
||||||
|
protected static $_websitesById = array();
|
||||||
|
protected static $_websitesByCode = array();
|
||||||
|
protected static $_gamesById = array();
|
||||||
|
protected static $_gamesByCode = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an event listener to be called later in the application.
|
* Registers an event listener to be called later in the application.
|
||||||
*
|
*
|
||||||
|
|
@ -200,9 +212,11 @@ class Wootook
|
||||||
|
|
||||||
public static function getLocale()
|
public static function getLocale()
|
||||||
{
|
{
|
||||||
$availableLocales = self::$_config->getConfig('global/locales');
|
$availableLocales = self::getWebsiteConfig('locales');
|
||||||
|
if ($availableLocales !== null) {
|
||||||
return self::getPreferredLocale($availableLocales);
|
return self::getPreferredLocale($availableLocales->toArray());
|
||||||
|
}
|
||||||
|
return self::getPreferredLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setDefaultLocale($locale)
|
public static function setDefaultLocale($locale)
|
||||||
|
|
@ -310,36 +324,52 @@ class Wootook
|
||||||
|
|
||||||
public static function loadConfig($filename = null)
|
public static function loadConfig($filename = null)
|
||||||
{
|
{
|
||||||
if ($filename === null) {
|
|
||||||
$filename = ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
self::$_config = new Wootook_Core_Config_Adapter_Array($filename);
|
|
||||||
|
|
||||||
self::$_globalConfig = clone self::$_config['default'];
|
|
||||||
self::$_globalConfig->merge(self::$_config['global']);
|
|
||||||
|
|
||||||
self::_appendDatabaseConfig(self::$_globalConfig);
|
|
||||||
|
|
||||||
self::$_websiteConfigs = array();
|
self::$_websiteConfigs = array();
|
||||||
self::$_gameConfigs = array();
|
self::$_gameConfigs = array();
|
||||||
|
|
||||||
|
self::$_config = new Wootook_Core_Config_Adapter_Array();
|
||||||
|
try {
|
||||||
|
if (!is_array($filename)) {
|
||||||
|
if ($filename === null) {
|
||||||
|
$filename = ROOT_PATH . 'config.php';
|
||||||
|
}
|
||||||
|
self::$_config->load($filename);
|
||||||
|
} else {
|
||||||
|
self::$_config->setData($filename);
|
||||||
|
}
|
||||||
|
} catch (Wootook_Core_Exception_DataAccessException $e) {
|
||||||
|
self::$_globalConfig = new Wootook_Core_Config_Node(array(), self::$_config);
|
||||||
|
self::$_ignoreDatabaseConfig = true;
|
||||||
|
return self::$_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$_globalConfig = clone self::$_config['default'];
|
||||||
|
if (isset(self::$_config['global'])) {
|
||||||
|
self::$_globalConfig->merge(self::$_config['global']);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::_appendDatabaseConfig(self::$_globalConfig);
|
||||||
|
|
||||||
return self::$_config;
|
return self::$_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function _appendDatabaseConfig(Wootook_Core_Config_Node $config, $type = 'global', $id = 0)
|
protected static function _appendDatabaseConfig(Wootook_Core_Config_Node $config, $type = 'global', $model = null)
|
||||||
{
|
{
|
||||||
|
if (self::$_ignoreDatabaseConfig) {
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
$collection = new Wootook_Core_Collection('core_config', 'Wootook_Core_Model_Config');
|
$collection = new Wootook_Core_Collection('core_config', 'Wootook_Core_Model_Config');
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'website':
|
case 'website':
|
||||||
$collection->where('website_id = :website_id');
|
$collection->where('website_id = :website_id');
|
||||||
$collection->load(array('website_id' => $id));
|
$collection->load(array('website_id' => $model->getId()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'game':
|
case 'game':
|
||||||
$collection->where('game_id = :game_id');
|
$collection->where('game_id = :game_id');
|
||||||
$collection->load(array('game_id' => $id));
|
$collection->load(array('game_id' => $model->getId()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -356,26 +386,126 @@ class Wootook
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getWebsite($websiteId)
|
||||||
|
{
|
||||||
|
if (is_numeric($websiteId)) {
|
||||||
|
if (isset(self::$_websitesById[$websiteId])) {
|
||||||
|
return self::$_websitesById[$websiteId];
|
||||||
|
}
|
||||||
|
$website = new Wootook_Core_Model_Website();
|
||||||
|
try {
|
||||||
|
$website->load($websiteId);
|
||||||
|
$websiteCode = $website->getData('code');
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $website;
|
||||||
|
} else {
|
||||||
|
if (isset(self::$_websitesByCode[$websiteId])) {
|
||||||
|
return self::$_websitesByCode[$websiteId];
|
||||||
|
}
|
||||||
|
$website = new Wootook_Core_Model_Website();
|
||||||
|
try {
|
||||||
|
$website->load($websiteId, 'code');
|
||||||
|
$websiteId = $website->getId();
|
||||||
|
$websiteCode = $website->getData('code');
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $website;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getGame($gameId)
|
||||||
|
{
|
||||||
|
if (is_numeric($gameId)) {
|
||||||
|
if (isset(self::$_gamesById[$gameId])) {
|
||||||
|
return self::$_gamesById[$gameId];
|
||||||
|
}
|
||||||
|
$game = new Wootook_Core_Model_Game();
|
||||||
|
try {
|
||||||
|
$game->load($gameId);
|
||||||
|
$gameCode = $game->getData('code');
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $game;
|
||||||
|
} else {
|
||||||
|
if (isset(self::$_gamesByCode[$gameId])) {
|
||||||
|
return self::$_gamesByCode[$gameId];
|
||||||
|
}
|
||||||
|
$game = new Wootook_Core_Model_Game();
|
||||||
|
try {
|
||||||
|
$game->load($gameId, 'code');
|
||||||
|
$gameId = $game->getId();
|
||||||
|
$gameCode = $game->getData('code');
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $game;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setWebsite($websiteId, $website)
|
||||||
|
{
|
||||||
|
$websiteKey = $website->getData('code');
|
||||||
|
self::$_websitesById[$websiteId] = $website;
|
||||||
|
self::$_websitesByCode[$websiteKey] = $website;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setGame($gameId, $game)
|
||||||
|
{
|
||||||
|
$gameKey = $game->getData('code');
|
||||||
|
self::$_gameById[$gameId] = $game;
|
||||||
|
self::$_gameByCode[$gameKey] = $game;
|
||||||
|
}
|
||||||
|
|
||||||
protected static function _initWebsiteConfig($websiteId)
|
protected static function _initWebsiteConfig($websiteId)
|
||||||
{
|
{
|
||||||
if (self::$_config === null) {
|
if (self::$_config === null) {
|
||||||
self::loadConfig();
|
self::loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
$websiteId = 1;
|
try {
|
||||||
|
$website = self::getWebsite($websiteId);
|
||||||
|
} catch (Wootook_Core_Exception_RuntimeException $e) {
|
||||||
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$websiteKey = $website->getData('code');
|
||||||
|
$websiteId = $website->getId();
|
||||||
|
|
||||||
if (!isset(self::$_websiteConfigs[$websiteId])) {
|
if (!isset(self::$_websiteConfigs[$websiteKey])) {
|
||||||
self::$_websiteConfigs[$websiteId] = clone self::$_globalConfig;
|
self::$_websiteConfigs[$websiteKey] = clone self::$_config['default'];
|
||||||
|
if (isset(self::$_config['frontend'])) {
|
||||||
$websiteConfig = self::$_config->getConfig("website/{$websiteId}");
|
self::$_websiteConfigs[$websiteKey]->merge(self::$_config['frontend']);
|
||||||
if ($websiteConfig !== null) {
|
|
||||||
self::$_websiteConfigs[$websiteId]->merge($websiteConfig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self::_appendDatabaseConfig(self::$_websiteConfigs[$websiteId], 'website', $websiteId);
|
$websiteConfig = self::$_config->getConfig("website/{$websiteKey}");
|
||||||
|
if ($websiteConfig !== null) {
|
||||||
|
self::$_websiteConfigs[$websiteKey]->merge($websiteConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::_appendDatabaseConfig(self::$_websiteConfigs[$websiteKey], 'website', $website);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$_websiteConfigs[$websiteId];
|
return self::$_websiteConfigs[$websiteKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function _initGameConfig($gameId)
|
protected static function _initGameConfig($gameId)
|
||||||
|
|
@ -384,23 +514,33 @@ class Wootook
|
||||||
self::loadConfig();
|
self::loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
$websiteId = 1;
|
try {
|
||||||
$gameId = 1;
|
$game = self::getGame($gameId);
|
||||||
|
} catch (Wootook_Core_Exception_RuntimeException $e) {
|
||||||
if (!isset(self::$_gameConfigs[$gameId])) {
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
self::_initWebsiteConfig($websiteId);
|
return null;
|
||||||
|
|
||||||
self::$_gameConfigs[$gameId] = clone self::$_websiteConfigs[$websiteId];
|
|
||||||
|
|
||||||
$gameConfig = self::$_config->getConfig("game/{$gameId}");
|
|
||||||
if ($gameConfig !== null) {
|
|
||||||
self::$_gameConfigs[$gameId]->merge($gameConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
self::_appendDatabaseConfig(self::$_gameConfigs[$gameId], 'game', $gameId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$_gameConfigs[$gameId];
|
$gameKey = $game->getData('code');
|
||||||
|
$gameId = $game->getId();
|
||||||
|
$websiteId = $game->getData('website_id');
|
||||||
|
|
||||||
|
if (!isset(self::$_gameConfigs[$gameKey])) {
|
||||||
|
$websiteConfig = self::_initWebsiteConfig($websiteId);
|
||||||
|
if ($websiteConfig === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
self::$_gameConfigs[$gameKey] = clone $websiteConfig;
|
||||||
|
|
||||||
|
$gameConfig = self::$_config->getConfig("game/{$gameKey}");
|
||||||
|
if ($gameConfig !== null) {
|
||||||
|
self::$_gameConfigs[$gameKey]->merge($gameConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::_appendDatabaseConfig(self::$_gameConfigs[$gameKey], 'game', $game);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$_gameConfigs[$gameKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getConfig($path = null)
|
public static function getConfig($path = null)
|
||||||
|
|
@ -415,36 +555,46 @@ class Wootook
|
||||||
return self::$_globalConfig;
|
return self::$_globalConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getWebsiteConfig($path = null, $websiteId = null)
|
public static function getWebsiteConfig($path = null, $websiteKey = null)
|
||||||
{
|
{
|
||||||
if (self::$_config === null) {
|
if (self::$_config === null) {
|
||||||
self::loadConfig();
|
self::loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
$websiteId = 1;
|
if ($websiteKey === null) {
|
||||||
|
$websiteKey = Wootook_Core_Model_Website::DEFAULT_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
self::_initWebsiteConfig($websiteId);
|
$config = self::_initWebsiteConfig($websiteKey);
|
||||||
|
if ($config === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($path !== null) {
|
if ($path !== null) {
|
||||||
return self::$_websiteConfigs[$websiteId]->getConfig($path);
|
return $config->getConfig($path);
|
||||||
}
|
}
|
||||||
return self::$_websiteConfigs[$websiteId];
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getGameConfig($path = null, $gameId = null)
|
public static function getGameConfig($path = null, $gameKey = null)
|
||||||
{
|
{
|
||||||
if (self::$_config === null) {
|
if (self::$_config === null) {
|
||||||
self::loadConfig();
|
self::loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
$gameId = 1;
|
if ($gameKey === null) {
|
||||||
|
$gameKey = Wootook_Core_Model_Game::DEFAULT_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
self::_initGameConfig($gameId);
|
$config = self::_initGameConfig($gameKey);
|
||||||
|
if ($config === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($path !== null) {
|
if ($path !== null) {
|
||||||
return self::$_gameConfigs[$gameId]->getConfig($path);
|
return $config->getConfig($path);
|
||||||
}
|
}
|
||||||
return self::$_gameConfigs[$gameId];
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setConfig($path, $value, $websiteId = null, $gameId = null)
|
public static function setConfig($path, $value, $websiteId = null, $gameId = null)
|
||||||
|
|
@ -453,12 +603,23 @@ class Wootook
|
||||||
self::loadConfig();
|
self::loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
$updater = new Wootook_Core_Model_Config();
|
if (!self::$_ignoreDatabaseConfig) {
|
||||||
$updater->setPath($path)->setValue($value);
|
$updater = new Wootook_Core_Model_Config();
|
||||||
if ($websiteId !== null) {
|
$updater->setPath($path)->setValue($value);
|
||||||
$updater->setWebsiteId($websiteId);
|
if ($websiteId !== null) {
|
||||||
|
$updater->setWebsiteId($websiteId);
|
||||||
|
if ($gameId !== null) {
|
||||||
|
$updater->setGameId($gameId);
|
||||||
|
self::$_gameConfigs[$gameId]->setConfig($path, $value);
|
||||||
|
} else {
|
||||||
|
self::$_websiteConfigs[$websiteId]->setConfig($path, $value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self::$_globalConfig->setConfig($path, $value);
|
||||||
|
}
|
||||||
|
$updater->save();
|
||||||
|
} else if ($websiteId !== null) {
|
||||||
if ($gameId !== null) {
|
if ($gameId !== null) {
|
||||||
$updater->setGameId($gameId);
|
|
||||||
self::$_gameConfigs[$gameId]->setConfig($path, $value);
|
self::$_gameConfigs[$gameId]->setConfig($path, $value);
|
||||||
} else {
|
} else {
|
||||||
self::$_websiteConfigs[$websiteId]->setConfig($path, $value);
|
self::$_websiteConfigs[$websiteId]->setConfig($path, $value);
|
||||||
|
|
@ -466,14 +627,13 @@ class Wootook
|
||||||
} else {
|
} else {
|
||||||
self::$_globalConfig->setConfig($path, $value);
|
self::$_globalConfig->setConfig($path, $value);
|
||||||
}
|
}
|
||||||
$updater->save();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getBaseUrl()
|
public static function getBaseUrl()
|
||||||
{
|
{
|
||||||
return self::$_config->getConfig('global/web/base_url');
|
return self::getConfig('web/base_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSkinUrl($package, $theme, $uri, Array $params = array())
|
public static function getSkinUrl($package, $theme, $uri, Array $params = array())
|
||||||
|
|
@ -504,13 +664,13 @@ class Wootook
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Wootook_Core_ErrorProfiler::sleep();
|
Wootook_Core_ErrorProfiler::getSingleton()->sleep();
|
||||||
if (($fp = @fopen($path, 'r', true)) === false) {
|
if (($fp = @fopen($path, 'r', true)) === false) {
|
||||||
Wootook_Core_ErrorProfiler::wakeup();
|
Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
Wootook_Core_ErrorProfiler::wakeup();
|
Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,14 +14,10 @@ class Wootook_Core_Block_Messages
|
||||||
{
|
{
|
||||||
$messages = array();
|
$messages = array();
|
||||||
|
|
||||||
var_dump($this->_storages);
|
|
||||||
foreach ($this->_storages as $namespace) {
|
foreach ($this->_storages as $namespace) {
|
||||||
$session = Wootook::getSession($namespace);
|
$session = Wootook::getSession($namespace);
|
||||||
var_dump($session);
|
|
||||||
|
|
||||||
foreach ($session->getMessages() as $messageLevel => $messageList) {
|
foreach ($session->getMessages() as $messageLevel => $messageList) {
|
||||||
var_dump(array($messageLevel => $messageList));
|
|
||||||
|
|
||||||
if (!isset($messages[$messageLevel])) {
|
if (!isset($messages[$messageLevel])) {
|
||||||
$messages[$messageLevel] = $messageList;
|
$messages[$messageLevel] = $messageList;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ class Wootook_Core_Config_Adapter_Array
|
||||||
$data = include $filename;
|
$data = include $filename;
|
||||||
|
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
throw new Wootook_Core_Exception_DataAccessException(
|
throw new Wootook_Core_Exception_DataAccessException('Configuration file could not be loaded.');
|
||||||
Wootook::__('Configuration file could not be loaded.'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_init($data);
|
$this->_init($data);
|
||||||
|
|
|
||||||
|
|
@ -47,21 +47,22 @@ class Wootook_Core_Config_Node
|
||||||
$length = count($explodedPath);
|
$length = count($explodedPath);
|
||||||
$currentNode = $this;
|
$currentNode = $this;
|
||||||
for ($i = 0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
if (!$currentNode->offsetExists($explodedPath[$i])) {
|
if ($i < ($length - 1)) {
|
||||||
$newNode = new Wootook_Core_Config_Node(array(), $currentNode);
|
if (!$currentNode->offsetExists($explodedPath[$i])) {
|
||||||
$currentNode->offsetSet($explodedPath[$i], $newNode);
|
$newNode = new Wootook_Core_Config_Node(array(), $currentNode);
|
||||||
|
$currentNode->offsetSet($explodedPath[$i], $newNode);
|
||||||
|
}
|
||||||
|
} else if (is_array($value)) {
|
||||||
|
$currentNode->offsetSet($explodedPath[$i], new self($value, $this));
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
$currentNode->offsetSet($explodedPath[$i], $value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$currentNode = $currentNode->offsetGet($explodedPath[$i]);
|
$currentNode = $currentNode->offsetGet($explodedPath[$i]);
|
||||||
|
|
||||||
if ($i >= ($length - 1)) {
|
if (!$currentNode instanceof Wootook_Core_Config_Node) {
|
||||||
if (is_array($value)) {
|
|
||||||
$currentNode->offsetSet($explodedPath[$i], new self($value, $this));
|
|
||||||
} else {
|
|
||||||
$currentNode->offsetSet($explodedPath[$i], $value);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} else if (!$currentNode instanceof Wootook_Core_Config_Node) {
|
|
||||||
throw new Wootook_Core_Exception_RuntimeException();
|
throw new Wootook_Core_Exception_RuntimeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,16 @@ abstract class Wootook_Core_Entity
|
||||||
{
|
{
|
||||||
$id = func_get_arg(0);
|
$id = func_get_arg(0);
|
||||||
|
|
||||||
$idFieldName = self::getIdFieldName();
|
if (func_num_args() >= 2) {
|
||||||
|
$idFieldName = func_get_arg(1);
|
||||||
|
} else {
|
||||||
|
$idFieldName = $this->getIdFieldName();
|
||||||
|
}
|
||||||
|
|
||||||
$database = $this->getReadConnection();
|
$database = $this->getReadConnection();
|
||||||
|
if ($database === null) {
|
||||||
|
throw new Wootook_Core_Exception_DataAccessException('Could not load data: no read connection configured.');
|
||||||
|
}
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
$sql =<<<SQL_EOF
|
||||||
SELECT * FROM {$database->getTable($this->getTableName())}
|
SELECT * FROM {$database->getTable($this->getTableName())}
|
||||||
|
|
@ -77,6 +85,10 @@ SQL_EOF;
|
||||||
$values[$idFieldName] = $this->getId();
|
$values[$idFieldName] = $this->getId();
|
||||||
|
|
||||||
$database = $this->getWriteConnection();
|
$database = $this->getWriteConnection();
|
||||||
|
if ($database === null) {
|
||||||
|
throw new Wootook_Core_Exception_DataAccessException('Could not load data: no write connection configured.');
|
||||||
|
}
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
$sql =<<<SQL_EOF
|
||||||
UPDATE {$database->getTable($this->getTableName())}
|
UPDATE {$database->getTable($this->getTableName())}
|
||||||
SET {$fieldsImploded}
|
SET {$fieldsImploded}
|
||||||
|
|
@ -101,6 +113,10 @@ SQL_EOF;
|
||||||
$tokensImploded = implode(', ', $tokens);
|
$tokensImploded = implode(', ', $tokens);
|
||||||
|
|
||||||
$database = $this->getWriteConnection();
|
$database = $this->getWriteConnection();
|
||||||
|
if ($database === null) {
|
||||||
|
throw new Wootook_Core_Exception_DataAccessException('Could not load data: no write connection configured.');
|
||||||
|
}
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
$sql =<<<SQL_EOF
|
||||||
INSERT INTO {$database->getTable($this->getTableName())} ($fieldsImploded)
|
INSERT INTO {$database->getTable($this->getTableName())} ($fieldsImploded)
|
||||||
VALUES ({$tokensImploded})
|
VALUES ({$tokensImploded})
|
||||||
|
|
@ -128,6 +144,10 @@ SQL_EOF;
|
||||||
$fieldsImploded = implod(', ', $fields);
|
$fieldsImploded = implod(', ', $fields);
|
||||||
$idFieldName = self::getIdFieldName();
|
$idFieldName = self::getIdFieldName();
|
||||||
$database = $this->getWriteConnection();
|
$database = $this->getWriteConnection();
|
||||||
|
if ($database === null) {
|
||||||
|
throw new Wootook_Core_Exception_DataAccessException('Could not load data: no write connection configured.');
|
||||||
|
}
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
$sql =<<<SQL_EOF
|
||||||
DELETE {$database->getTable($this->getTableName())}
|
DELETE {$database->getTable($this->getTableName())}
|
||||||
WHERE {$idFieldName}=:{$idFieldName}
|
WHERE {$idFieldName}=:{$idFieldName}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ class Wootook_Core_ErrorProfiler
|
||||||
|
|
||||||
private static $_isTraceRegistered = false;
|
private static $_isTraceRegistered = false;
|
||||||
|
|
||||||
private static $_listen = true;
|
private $_listen = true;
|
||||||
|
|
||||||
private $_mute = false;
|
private $_mute = false;
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ class Wootook_Core_ErrorProfiler
|
||||||
|
|
||||||
public function errorManager($errno, $errstr, $errfile = null, $errline = null, Array $errcontext = array())
|
public function errorManager($errno, $errstr, $errfile = null, $errline = null, Array $errcontext = array())
|
||||||
{
|
{
|
||||||
if (!self::$_listen) {
|
if (!$this->_listen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,10 +92,10 @@ class Wootook_Core_ErrorProfiler
|
||||||
|
|
||||||
public function exceptionManager($exception)
|
public function exceptionManager($exception)
|
||||||
{
|
{
|
||||||
if (!self::$_listen) {
|
if (!$this->_listen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->_exceptions[] = $exception;
|
$this->_exceptions[] = new Wootook_Core_Exception_Exception('Uncaught Exception: ' . $exception->getMessage(), null, $exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _renderError($id, $error)
|
protected function _renderError($id, $error)
|
||||||
|
|
@ -171,7 +171,19 @@ ERROR_EOF;
|
||||||
$index++;
|
$index++;
|
||||||
echo "Message #{$index}". PHP_EOL;
|
echo "Message #{$index}". PHP_EOL;
|
||||||
echo $exception->getMessage() . PHP_EOL;
|
echo $exception->getMessage() . PHP_EOL;
|
||||||
echo $exception->getTraceAsString();
|
echo $exception->getTraceAsString() . PHP_EOL;
|
||||||
|
echo PHP_EOL;
|
||||||
|
|
||||||
|
$child = 0;
|
||||||
|
$current = $exception;
|
||||||
|
while (($current = $current->getPrevious()) !== null) {
|
||||||
|
$child++;
|
||||||
|
echo " Child level #{$child}". PHP_EOL;
|
||||||
|
echo " " . $current->getMessage() . PHP_EOL;
|
||||||
|
echo $current->getTraceAsString() . PHP_EOL;
|
||||||
|
echo PHP_EOL;
|
||||||
|
}
|
||||||
|
echo PHP_EOL;
|
||||||
}
|
}
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
}
|
}
|
||||||
|
|
@ -204,13 +216,13 @@ ERROR_EOF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function sleep()
|
public function sleep()
|
||||||
{
|
{
|
||||||
self::$_listen = false;
|
$this->_listen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function wakeup()
|
public function wakeup()
|
||||||
{
|
{
|
||||||
self::$_listen = true;
|
$this->_listen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,22 @@ class Wootook_Core_Exception_Exception
|
||||||
extends Exception
|
extends Exception
|
||||||
implements Wootook_Core_Exception
|
implements Wootook_Core_Exception
|
||||||
{
|
{
|
||||||
|
protected $_previous = null;
|
||||||
|
|
||||||
|
public function __construct($message = null, $code = null, $previous = null)
|
||||||
|
{
|
||||||
|
if (PHP_VERSION_ID >= 50300) {
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
} else {
|
||||||
|
parent::__construct($message, $code);
|
||||||
|
$this->_previous = $previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __call($method, $params)
|
||||||
|
{
|
||||||
|
if (strtolower($method) == 'getprevious') {
|
||||||
|
return $this->_previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,4 +4,29 @@ class Wootook_Core_Exception_RuntimeException
|
||||||
extends RuntimeException
|
extends RuntimeException
|
||||||
implements Wootook_Core_Exception
|
implements Wootook_Core_Exception
|
||||||
{
|
{
|
||||||
|
protected $_previous = null;
|
||||||
|
|
||||||
|
public function __construct($message = null, $code = null, $previous = null)
|
||||||
|
{
|
||||||
|
if (PHP_VERSION_ID >= 50300) {
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
} else {
|
||||||
|
parent::__construct($message, $code);
|
||||||
|
$this->_previous = $previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __call($method, $params)
|
||||||
|
{
|
||||||
|
if (strtolower($method) == 'getprevious') {
|
||||||
|
return $this->_previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return <<<STRING_EOF
|
||||||
|
|
||||||
|
STRING_EOF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +33,10 @@ class Wootook_Core_Layout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileList = Wootook::getConfig('global/layout');
|
$fileList = Wootook::getConfig('layout');
|
||||||
|
if ($fileList instanceof Wootook_Core_Config_Node) {
|
||||||
|
$fileList = $fileList->toArray();
|
||||||
|
}
|
||||||
if (!is_array($fileList) || empty($fileList)) {
|
if (!is_array($fileList) || empty($fileList)) {
|
||||||
$fileList = $this->getAllDatas();
|
$fileList = $this->getAllDatas();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -41,8 +44,8 @@ class Wootook_Core_Layout
|
||||||
}
|
}
|
||||||
$this->_data = array();
|
$this->_data = array();
|
||||||
|
|
||||||
$this->setPackage(Wootook::getConfig('global/package'));
|
$this->setPackage(Wootook::getConfig('package'));
|
||||||
$this->setTheme(Wootook::getConfig('global/theme'));
|
$this->setTheme(Wootook::getConfig('theme'));
|
||||||
|
|
||||||
foreach ($fileList as $layoutFile) {
|
foreach ($fileList as $layoutFile) {
|
||||||
foreach (include $this->_getLayoutPath($layoutFile) as $layoutId => $layoutConfig) {
|
foreach (include $this->_getLayoutPath($layoutFile) as $layoutId => $layoutConfig) {
|
||||||
|
|
@ -186,12 +189,12 @@ class Wootook_Core_Layout
|
||||||
$className = $namespace . $block;
|
$className = $namespace . $block;
|
||||||
$fileName = $path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $block) . '.php';
|
$fileName = $path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $block) . '.php';
|
||||||
|
|
||||||
Wootook_Core_ErrorProfiler::sleep();
|
Wootook_Core_ErrorProfiler::getSingleton()->sleep();
|
||||||
if (!($fp = @fopen($fileName, 'r', true))) {
|
if (!($fp = @fopen($fileName, 'r', true))) {
|
||||||
Wootook_Core_ErrorProfiler::wakeup();
|
Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Wootook_Core_ErrorProfiler::wakeup();
|
Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
if (!class_exists($className, true)) {
|
if (!class_exists($className, true)) {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@
|
||||||
class Wootook_Core_Model_Config
|
class Wootook_Core_Model_Config
|
||||||
extends Wootook_Core_Entity_SubTable
|
extends Wootook_Core_Entity_SubTable
|
||||||
{
|
{
|
||||||
private static $_singleton = null;
|
|
||||||
|
|
||||||
protected $_eventPrefix = 'core.config';
|
protected $_eventPrefix = 'core.config';
|
||||||
protected $_eventObject = 'config';
|
protected $_eventObject = 'config';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,15 @@ abstract class Wootook_Core_Model_Config_Abstract
|
||||||
{
|
{
|
||||||
protected function _initData($filename)
|
protected function _initData($filename)
|
||||||
{
|
{
|
||||||
$config = Wootook::getConfig('global/storyline');
|
$config = Wootook::getConfig('storyline');
|
||||||
|
|
||||||
if ($config === null || empty($config)) {
|
if ($config === null) {
|
||||||
$config = array(
|
$config = array(
|
||||||
'universe' => 'default',
|
'universe' => 'default',
|
||||||
'episode' => 'default'
|
'episode' => 'default'
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$config = $config->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = 'gamedata' . DIRECTORY_SEPARATOR . $config['universe'] . DIRECTORY_SEPARATOR
|
$path = 'gamedata' . DIRECTORY_SEPARATOR . $config['universe'] . DIRECTORY_SEPARATOR
|
||||||
|
|
|
||||||
23
application/code/core/Wootook/Core/Model/Game.php
Normal file
23
application/code/core/Wootook/Core/Model/Game.php
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter description here ...
|
||||||
|
*
|
||||||
|
* @uses Wootook_Object
|
||||||
|
* @uses Legacies_Empire
|
||||||
|
*/
|
||||||
|
class Wootook_Core_Model_Game
|
||||||
|
extends Wootook_Core_Entity
|
||||||
|
{
|
||||||
|
const DEFAULT_CODE = 'default';
|
||||||
|
|
||||||
|
protected $_eventPrefix = 'core.game';
|
||||||
|
protected $_eventObject = 'game';
|
||||||
|
|
||||||
|
protected function _init()
|
||||||
|
{
|
||||||
|
$this->_tableName = 'core_game';
|
||||||
|
$this->_idFieldName = 'game_id';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -51,15 +51,16 @@ class Wootook_Core_Model_Session
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_data = &$_SESSION[$namespace];
|
$this->_data = &$_SESSION[$namespace];
|
||||||
$this->_data['messages'] = array();
|
if (!isset($this->_data['messages'])) {
|
||||||
|
$this->_data['messages'] = array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMessages($clear = true)
|
public function getMessages($clear = true)
|
||||||
{
|
{
|
||||||
$messages = $this->_data['messages'];
|
$messages = $this->_data['messages'];
|
||||||
if ($clear == true) {
|
if ($clear == true) {
|
||||||
var_dump($this->_data['messages']);
|
$this->_data['messages'] = array();
|
||||||
//$this->_data['messages'] = array();
|
|
||||||
}
|
}
|
||||||
return $messages;
|
return $messages;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
application/code/core/Wootook/Core/Model/Website.php
Normal file
23
application/code/core/Wootook/Core/Model/Website.php
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter description here ...
|
||||||
|
*
|
||||||
|
* @uses Wootook_Object
|
||||||
|
* @uses Legacies_Empire
|
||||||
|
*/
|
||||||
|
class Wootook_Core_Model_Website
|
||||||
|
extends Wootook_Core_Entity
|
||||||
|
{
|
||||||
|
const DEFAULT_CODE = 'default';
|
||||||
|
|
||||||
|
protected $_eventPrefix = 'core.website';
|
||||||
|
protected $_eventObject = 'website';
|
||||||
|
|
||||||
|
protected function _init()
|
||||||
|
{
|
||||||
|
$this->_tableName = 'core_website';
|
||||||
|
$this->_idFieldName = 'website_id';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -55,10 +55,10 @@ class Wootook_Core_Setup_Updater
|
||||||
|
|
||||||
public function grant($tableName, $connectionName, $perms = null)
|
public function grant($tableName, $connectionName, $perms = null)
|
||||||
{
|
{
|
||||||
$hostname = Wootook::getConfig("global/database/{$connectionName}/params/hostname");
|
$hostname = Wootook::getConfig("database/{$connectionName}/params/hostname");
|
||||||
$username = Wootook::getConfig("global/database/{$connectionName}/params/username");
|
$username = Wootook::getConfig("database/{$connectionName}/params/username");
|
||||||
$database = Wootook::getConfig("global/database/{$connectionName}/params/database");
|
$database = Wootook::getConfig("database/{$connectionName}/params/database");
|
||||||
$password = Wootook::getConfig("global/database/{$connectionName}/params/password");
|
$password = Wootook::getConfig("database/{$connectionName}/params/password");
|
||||||
|
|
||||||
if ($perms === null) {
|
if ($perms === null) {
|
||||||
$perms = 'ALL PRIVILEGES';
|
$perms = 'ALL PRIVILEGES';
|
||||||
|
|
@ -79,10 +79,10 @@ SQL_EOF;
|
||||||
|
|
||||||
public function revoke($tableName, $connectionName, $perms = null)
|
public function revoke($tableName, $connectionName, $perms = null)
|
||||||
{
|
{
|
||||||
$hostname = Wootook::getConfig("global/database/{$connectionName}/params/hostname");
|
$hostname = Wootook::getConfig("database/{$connectionName}/params/hostname");
|
||||||
$username = Wootook::getConfig("global/database/{$connectionName}/params/username");
|
$username = Wootook::getConfig("database/{$connectionName}/params/username");
|
||||||
$database = Wootook::getConfig("global/database/{$connectionName}/params/database");
|
$database = Wootook::getConfig("database/{$connectionName}/params/database");
|
||||||
$password = Wootook::getConfig("global/database/{$connectionName}/params/password");
|
$password = Wootook::getConfig("database/{$connectionName}/params/password");
|
||||||
|
|
||||||
if ($perms === null) {
|
if ($perms === null) {
|
||||||
$perms = 'ALL PRIVILEGES';
|
$perms = 'ALL PRIVILEGES';
|
||||||
|
|
@ -111,10 +111,13 @@ SQL_EOF;
|
||||||
return Wootook::getConfig($path);
|
return Wootook::getConfig($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGameConfig($path)
|
public function getWebsiteConfig($path = null, $websiteId = null)
|
||||||
{
|
{
|
||||||
$config = Wootook_Core_Model_Config::getSingleton();
|
return Wootook::getWebsiteConfig($path, $websiteId);
|
||||||
|
}
|
||||||
|
|
||||||
return $config->getData($path);
|
public function getGameConfig($path = null, $gameId = null)
|
||||||
|
{
|
||||||
|
return Wootook::getGameConfig($path, $gameId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class Wootook_Core_Time
|
||||||
public static function init($timezone = null)
|
public static function init($timezone = null)
|
||||||
{
|
{
|
||||||
if ($timezone === null) {
|
if ($timezone === null) {
|
||||||
$timezone = Wootook::getConfig('global/date/timezone');
|
$timezone = Wootook::getConfig('date/timezone');
|
||||||
}
|
}
|
||||||
if ($timezone === null) {
|
if ($timezone === null) {
|
||||||
$timezone = 'GMT';
|
$timezone = 'GMT';
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,195 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of Wootook
|
||||||
|
*
|
||||||
|
* @license http://www.gnu.org/licenses/agpl-3.0.txt
|
||||||
|
* @see http://www.wootook.com/
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* --> NOTICE <--
|
||||||
|
* This file is part of the core development branch, changing its contents will
|
||||||
|
* make you unable to use the automatic updates manager. Please refer to the
|
||||||
|
* documentation for further information about customizing Wootook.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->setSetupConnection('core_setup');
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_website')} (
|
||||||
|
`website_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`code` VARCHAR(64) NOT NULL,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`sort_order` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`default_group_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`is_default` BOOL NOT NULL,
|
||||||
|
`is_staging` BOOL NOT NULL,
|
||||||
|
`is_active` BOOL NOT NULL,
|
||||||
|
PRIMARY KEY (`website_id`),
|
||||||
|
UNIQUE (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game_group')} (
|
||||||
|
`group_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`website_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`code` VARCHAR(64) NOT NULL,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`sort_order` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`is_default` BOOL NOT NULL,
|
||||||
|
PRIMARY KEY (`group_id`),
|
||||||
|
INDEX (`website_id`),
|
||||||
|
UNIQUE (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game')} (
|
||||||
|
`game_id` SMALLINT UNSIGNED NOT NULL,
|
||||||
|
`group_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`website_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`code` VARCHAR(64) NOT NULL,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`sort_order` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`is_default` BOOL NOT NULL,
|
||||||
|
`is_staging` BOOL NOT NULL,
|
||||||
|
`is_active` BOOL NOT NULL,
|
||||||
|
PRIMARY KEY (`group_id`),
|
||||||
|
INDEX (`website_id`),
|
||||||
|
UNIQUE (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
INSERT INTO {$this->getTableName('core_website')} (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`, `is_staging`, `is_active`)
|
||||||
|
VALUES
|
||||||
|
(0, "admin", "Administration", 0, 0, 0, 0, 1),
|
||||||
|
(1, "default", "Default Website", 1, 1, 1, 0, 1);
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
INSERT INTO {$this->getTableName('core_game_group')} (`group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`)
|
||||||
|
VALUES
|
||||||
|
(0, 0, "admin", "Administration", 0, 0),
|
||||||
|
(1, 1, "default", "Default Group", 1, 1);
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
INSERT INTO {$this->getTableName('core_game')} (`game_id`, `group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`, `is_staging`, `is_active`)
|
||||||
|
VALUES
|
||||||
|
(0, 0, 0, "admin", "Administration", 0, 0, 0, 1),
|
||||||
|
(1, 1, 1, "default", "Default Game", 1, 1, 0, 1);
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_config')} (
|
||||||
|
`website_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`game_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`config_path` VARCHAR(64) NOT NULL,
|
||||||
|
`config_value` VARCHAR(255) NOT NULL,
|
||||||
|
PRIMARY KEY (`website_id`, `game_id`, `config_path`),
|
||||||
|
INDEX (`website_id`),
|
||||||
|
INDEX (`game_id`),
|
||||||
|
INDEX (`config_path`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
INSERT IGNORE INTO {$this->getTableName('core_config')} (`website_id`, `game_id`, `config_path`, `config_value`) VALUES
|
||||||
|
(1, 1, 'resource/base-income/metal', '20'),
|
||||||
|
(1, 1, 'resource/base-income/cristal', '10'),
|
||||||
|
(1, 1, 'resource/base-income/deuterium', '0'),
|
||||||
|
(1, 1, 'resource/base-income/energy', '0'),
|
||||||
|
|
||||||
|
(1, 1, 'resource/initial/fields', '163'),
|
||||||
|
(1, 1, 'resource/initial/metal', '500'),
|
||||||
|
(1, 1, 'resource/initial/cristal', '500'),
|
||||||
|
(1, 1, 'resource/initial/deuterium', '0'),
|
||||||
|
(1, 1, 'resource/initial/energy', '0'),
|
||||||
|
|
||||||
|
(1, 1, 'game/general/name', 'Wootook'),
|
||||||
|
(1, 1, 'game/general/boards-url', 'http://wootook.org/board/'),
|
||||||
|
(1, 1, 'game/general/extra-url-title', 'Wootook!'),
|
||||||
|
(1, 1, 'game/general/extra-url', 'http://wootook.org/'),
|
||||||
|
(1, 1, 'game/general/active', '1'),
|
||||||
|
(1, 1, 'game/general/closing-message', 'Le jeu est clos pour le moment.'),
|
||||||
|
(1, 1, 'game/general/locale', 'fr_FR'),
|
||||||
|
|
||||||
|
(1, 1, 'game/resource/multiplier', '1000'),
|
||||||
|
(1, 1, 'game/speed/general', '2500'),
|
||||||
|
(1, 1, 'game/speed/fleet', '2500'),
|
||||||
|
|
||||||
|
(1, 1, 'game/debris/metal-percent', '30'),
|
||||||
|
(1, 1, 'game/debris/cristal-percent', '30'),
|
||||||
|
(1, 1, 'game/debris/deuterium-percent', '0'),
|
||||||
|
(1, 1, 'game/debris/energy-percent', '0'),
|
||||||
|
|
||||||
|
(1, 1, 'game/debris/fleet', '1'),
|
||||||
|
(1, 1, 'game/debris/defense', '0'),
|
||||||
|
|
||||||
|
(1, 1, 'game/noob-protection/active', '0'),
|
||||||
|
(1, 1, 'game/noob-protection/points-cap', '5000'),
|
||||||
|
(1, 1, 'game/noob-protection/multiplier', '5'),
|
||||||
|
|
||||||
|
(0, 0, 'web/cookie/name', '__wtk'),
|
||||||
|
(0, 0, 'web/cookie/time', '2592000'),
|
||||||
|
(0, 0, 'web/cookie/domain', ''),
|
||||||
|
(0, 0, 'web/cookie/path', ''),
|
||||||
|
|
||||||
|
(0, 0, 'engine/options/bbcode', '1'),
|
||||||
|
(0, 0, 'engine/options/ga', '1'),
|
||||||
|
(0, 0, 'engine/options/announces', '0'),
|
||||||
|
(0, 0, 'engine/options/retailer', '0'),
|
||||||
|
(0, 0, 'engine/options/notes', '0'),
|
||||||
|
(0, 0, 'engine/options/chat', '0'),
|
||||||
|
(0, 0, 'engine/options/banner', '0'),
|
||||||
|
(0, 0, 'engine/options/vacation-min-time', '172800'),
|
||||||
|
|
||||||
|
(0, 0, 'game/news/active', '0'),
|
||||||
|
(0, 0, 'game/news/content', 'Bienvenue sur le nouveau serveur de jeu Wootook!'),
|
||||||
|
|
||||||
|
(0, 0, 'engine/ban/duration', '86400'),
|
||||||
|
|
||||||
|
(0, 0, 'engine/bot/active', '0'),
|
||||||
|
(0, 0, 'engine/bot/name', 'Woot'),
|
||||||
|
(0, 0, 'engine/bot/email', 'contact@wootook.org');
|
||||||
|
SQL_EOF;
|
||||||
|
/**
|
||||||
|
* TODO: change these paths
|
||||||
|
* (0, 0, 'BuildLabWhileRun', '0')
|
||||||
|
* (0, 0, 'ExtCopyFrame', '0')
|
||||||
|
* (0, 0, 'ExtCopyOwner', '')
|
||||||
|
* (0, 0, 'ExtCopyFunct', '')
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of Wootook
|
||||||
|
*
|
||||||
|
* @license Modified BSD
|
||||||
|
* @see https://github.com/gplanchat/one.platform
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2010, Grégory PLANCHAT <g.planchat at gmail.com>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
* are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* - Neither the name of Grégory PLANCHAT nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from this
|
||||||
|
* software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* --> NOTICE <--
|
||||||
|
* This file is part of the core development branch, changing its contents will
|
||||||
|
* make you unable to use the automatic updates manager. Please refer to the
|
||||||
|
* documentation for further information about customizing One.Platform.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->setSetupConnection('legacies_setup');
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
DROP TABLE {$this->getTableName('core_website')};
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
DROP TABLE {$this->getTableName('core_game_group')};
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
DROP TABLE {$this->getTableName('core_game')};
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
DROP TABLE {$this->getTableName('core_config')};
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
@ -4,4 +4,22 @@ class Wootook_Empire_Exception_Exception
|
||||||
extends Exception
|
extends Exception
|
||||||
implements Wootook_Empire_Exception
|
implements Wootook_Empire_Exception
|
||||||
{
|
{
|
||||||
|
protected $_previous = null;
|
||||||
|
|
||||||
|
public function __construct($message = null, $code = null, $previous = null)
|
||||||
|
{
|
||||||
|
if (PHP_VERSION_ID >= 50300) {
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
} else {
|
||||||
|
parent::__construct($message, $code);
|
||||||
|
$this->_previous = $previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __call($method, $params)
|
||||||
|
{
|
||||||
|
if (strtolower($method) == 'getprevious') {
|
||||||
|
return $this->_previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,4 +4,22 @@ class Wootook_Empire_Exception_RuntimeException
|
||||||
extends RuntimeException
|
extends RuntimeException
|
||||||
implements Wootook_Empire_Exception
|
implements Wootook_Empire_Exception
|
||||||
{
|
{
|
||||||
|
protected $_previous = null;
|
||||||
|
|
||||||
|
public function __construct($message = null, $code = null, $previous = null)
|
||||||
|
{
|
||||||
|
if (PHP_VERSION_ID >= 50300) {
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
} else {
|
||||||
|
parent::__construct($message, $code);
|
||||||
|
$this->_previous = $previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __call($method, $params)
|
||||||
|
{
|
||||||
|
if (strtolower($method) == 'getprevious') {
|
||||||
|
return $this->_previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -960,7 +960,7 @@ class Wootook_Empire_Model_Planet
|
||||||
$key = array_rand($positions, 1);
|
$key = array_rand($positions, 1);
|
||||||
$finalPosition = $positions[$key];
|
$finalPosition = $positions[$key];
|
||||||
|
|
||||||
$user->createNewPlanet(
|
$planet = $user->createNewPlanet(
|
||||||
$systemInfo->getData('galaxy'),
|
$systemInfo->getData('galaxy'),
|
||||||
$systemInfo->getData('system'),
|
$systemInfo->getData('system'),
|
||||||
$finalPosition,
|
$finalPosition,
|
||||||
|
|
@ -992,10 +992,8 @@ class Wootook_Empire_Model_Planet
|
||||||
->group('galaxy.system')
|
->group('galaxy.system')
|
||||||
;
|
;
|
||||||
|
|
||||||
$config = Wootook_Core_Model_Config::getSingleton();
|
if ($galaxyList === null && Wootook::getGameConfig('user/registration/galaxy_list')) {
|
||||||
|
$galaxyList = explode(',', Wootook::getGameConfig('user/registration/galaxy_list'));
|
||||||
if ($galaxyList === null && $config->hasData('user/registration/galaxy_list')) {
|
|
||||||
$galaxyList = explode(',', $config->getData('user/registration/galaxy_list'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($galaxyList !== null) {
|
if ($galaxyList !== null) {
|
||||||
|
|
@ -1003,8 +1001,8 @@ class Wootook_Empire_Model_Planet
|
||||||
$collection->where('galaxy.galaxy IN(' . implode(', ', $galaxyList) . ')');
|
$collection->where('galaxy.galaxy IN(' . implode(', ', $galaxyList) . ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($systemList === null && $config->hasData('user/registration/system_list')) {
|
if ($systemList === null && Wootook::getGameConfig('user/registration/system_list')) {
|
||||||
$systemList = explode(',', $config->getData('user/registration/system_list'));
|
$systemList = explode(',', Wootook::getGameConfig('user/registration/system_list'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($systemList !== null) {
|
if ($systemList !== null) {
|
||||||
|
|
|
||||||
|
|
@ -252,9 +252,9 @@ class Wootook_Empire_Model_User
|
||||||
$size = mt_rand(floor($factor / 10), ceil($factor * 5 / 4)) + mt_rand(0, $fuzz);
|
$size = mt_rand(floor($factor / 10), ceil($factor * 5 / 4)) + mt_rand(0, $fuzz);
|
||||||
}
|
}
|
||||||
|
|
||||||
$planet = new self();
|
$planet = new Wootook_Empire_Model_Planet();
|
||||||
$planet
|
$planet
|
||||||
->setData('id_owner', $user->getId())
|
->setData('id_owner', $this->getId())
|
||||||
->setData('name', $name)
|
->setData('name', $name)
|
||||||
->setData('galaxy', $galaxy)
|
->setData('galaxy', $galaxy)
|
||||||
->setData('system', $system)
|
->setData('system', $system)
|
||||||
|
|
@ -271,12 +271,19 @@ class Wootook_Empire_Model_User
|
||||||
$planet->setData($resourceData['production_field'], $resourceConfig[$resource]);
|
$planet->setData($resourceData['production_field'], $resourceConfig[$resource]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$planet->save();
|
||||||
|
|
||||||
|
var_dump($planet->getId());
|
||||||
|
die();
|
||||||
|
|
||||||
Wootook::dispatchEvent('planet.init', array(
|
Wootook::dispatchEvent('planet.init', array(
|
||||||
'planet' => $planet,
|
'planet' => $planet,
|
||||||
'user' => $user
|
'user' => $this
|
||||||
));
|
));
|
||||||
|
|
||||||
$planet->save();
|
$planet->save();
|
||||||
|
|
||||||
|
return $planet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,6 @@
|
||||||
'update' => '2columns-left',
|
'update' => '2columns-left',
|
||||||
'reference' => array(
|
'reference' => array(
|
||||||
'content' => array(
|
'content' => array(
|
||||||
'children' => array(
|
|
||||||
'navigation' => array(
|
|
||||||
'type' => 'core/html.navigation',
|
|
||||||
'template' => 'page/html/navigation.phtml',
|
|
||||||
'actions' => array()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'left' => array(
|
|
||||||
'children' => array(
|
'children' => array(
|
||||||
'status' => array(
|
'status' => array(
|
||||||
'type' => 'core/template',
|
'type' => 'core/template',
|
||||||
|
|
@ -39,7 +30,7 @@
|
||||||
'method' => 'setData',
|
'method' => 'setData',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'key' => 'step',
|
'key' => 'step',
|
||||||
'value' => 'intro'
|
'value' => 0
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -64,7 +55,7 @@
|
||||||
'method' => 'setData',
|
'method' => 'setData',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'key' => 'step',
|
'key' => 'step',
|
||||||
'value' => 'system'
|
'value' => 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -89,7 +80,7 @@
|
||||||
'method' => 'setData',
|
'method' => 'setData',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'key' => 'step',
|
'key' => 'step',
|
||||||
'value' => 'database'
|
'value' => 2
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -114,7 +105,7 @@
|
||||||
'method' => 'setData',
|
'method' => 'setData',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'key' => 'step',
|
'key' => 'step',
|
||||||
'value' => 'universe'
|
'value' => 3
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -139,7 +130,7 @@
|
||||||
'method' => 'setData',
|
'method' => 'setData',
|
||||||
'params' => array(
|
'params' => array(
|
||||||
'key' => 'step',
|
'key' => 'step',
|
||||||
'value' => 'profile'
|
'value' => 4
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th colspan="2">
|
|
||||||
<br><?php echo $this->getData('ins_tx_acc1')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_acc2')?><br><br>
|
|
||||||
<table width="270" border="0" align="center" cellpadding="0" cellspacing="0">
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_acc_user')?>:</td>
|
|
||||||
<td><input name="adm_user" size="20" maxlength="20" type="text" onKeypress="
|
|
||||||
if (event.keyCode==60 || event.keyCode==62) event.returnValue = false;
|
|
||||||
if (event.which==60 || event.which==62) return false;"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_acc_pass')?>:</td>
|
|
||||||
<td><input name="adm_pass" size="20" maxlength="20" type="password" onKeypress="
|
|
||||||
if (event.keyCode==60 || event.keyCode==62) event.returnValue = false;
|
|
||||||
if (event.which==60 || event.which==62) return false;"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_acc_email')?>:</td>
|
|
||||||
<td><input name="adm_email" size="20" maxlength="40" type="text" onKeypress="
|
|
||||||
if (event.keyCode==60 || event.keyCode==62) event.returnValue = false;
|
|
||||||
if (event.which==60 || event.which==62) return false;"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_acc_planet')?>:</td>
|
|
||||||
<td><input name="adm_planet" size="20" maxlength="20" type="text" onKeypress="
|
|
||||||
if (event.keyCode==60 || event.keyCode==62) event.returnValue = false;
|
|
||||||
if (event.which==60 || event.which==62) return false;"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_acc_sex')?>:</td>
|
|
||||||
<td><select name="adm_sex">
|
|
||||||
<option value=""><?php echo $this->getData('ins_acc_sex0')?></option>
|
|
||||||
<option value="M"><?php echo $this->getData('ins_acc_sex1')?></option>
|
|
||||||
<option value="F"><?php echo $this->getData('ins_acc_sex2')?></option>
|
|
||||||
</select></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<br>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><input type="button" name="next" onclick="submit();" value="<?php echo $this->getData('ins_btn_creat')?>" ></th>
|
|
||||||
</tr>
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th colspan="2">
|
|
||||||
<br><?php echo $this->getData('ins_tx_done2')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_done3')?><br><br>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><input type="button" name="next" onclick="self.location.href='../'" value="<?php echo $this->getData('ins_btn_login')?>" ></th>
|
|
||||||
</tr>
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
<br><br>
|
|
||||||
<table width="700">
|
|
||||||
<tbody><tr>
|
|
||||||
<td width="120px" class="c" align="left"><font size="2px"><?php echo $this->getData('ins_appname')?></font></td>
|
|
||||||
<td width="580px" rowspan="2" class="c" align="right"><font size="2px"><?php echo $this->getData('ins_tx_sys')?></font><br /><?php echo $this->getData('ins_tx_state')?> <?php echo $this->getData('ins_state')?></td>
|
|
||||||
</tr><tr>
|
|
||||||
<th rowspan="4"><table border="0" align="center" cellpadding="0" cellspacing="0">
|
|
||||||
<tr>
|
|
||||||
<td width="124" align="center"><a href="index.php?mode=intro" accesskey="i"><?php echo $this->getData('ins_mnu_intro')?></a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="center"><a href="index.php?mode=ins&page=1" accesskey="i"><?php echo $this->getData('ins_mnu_inst')?></a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="center"><a href="index.php?mode=goto&page=1" accesskey="b"><?php echo $this->getData('ins_mnu_goto')?></a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="center"><a href="index.php?mode=upg" accesskey="u"><?php echo $this->getData('ins_mnu_upgr')?></a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="center"><a href="index.php?mode=bye" accesskey="b"><?php echo $this->getData('ins_mnu_quit')?></a></td>
|
|
||||||
</tr>
|
|
||||||
</table></th>
|
|
||||||
</tr>
|
|
||||||
<form action="<?php echo $this->getData('dis_ins_btn')?>" method="post">
|
|
||||||
<?php echo $this->getData('ins_page')?>
|
|
||||||
</form>
|
|
||||||
</table>
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th colspan="2">
|
|
||||||
<br><?php echo $this->getData('ins_tx_inst1')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_inst2')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_inst3')?><br><br>
|
|
||||||
<table width="270" border="0" align="center" cellpadding="0" cellspacing="0">
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_server')?>:</td>
|
|
||||||
<td><input type="text" name="host" value="localhost" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_db')?>:</td>
|
|
||||||
<td><input type="text" name="db" value="" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_prefix')?>:</td>
|
|
||||||
<td><input type="text" name="prefix" value="game_" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_login')?>:</td>
|
|
||||||
<td><input type="text" name="user" value="" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_pass')?>:</td>
|
|
||||||
<td><input type="password" name="passwort" value="" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<br>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><input type="button" name="next" onclick="submit();" value="<?php echo $this->getData('ins_btn_inst')?>" ></th>
|
|
||||||
</tr>
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th colspan="2">
|
|
||||||
<br><br><?php echo $this->getData('ins_tx_done1')?><br><br>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><input type="button" name="next" onclick="submit();" value="<?php echo $this->getData('ins_btn_next')?>" ></th>
|
|
||||||
</tr>
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th colspan="2">
|
|
||||||
<br><?php echo $this->getData('ins_tx_done4')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_done3')?><br><br>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><input type="button" name="next" onclick="self.location.href='../'" value="<?php echo $this->getData('ins_btn_login')?>" ></th>
|
|
||||||
</tr>
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th colspan="2">
|
|
||||||
<br><?php echo $this->getData('ins_tx_inst1')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_goto4')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_goto5')?><br><br>
|
|
||||||
<table width="270" border="0" align="center" cellpadding="0" cellspacing="0">
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_server')?>:</td>
|
|
||||||
<td><input type="text" name="host" value="localhost" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_db')?>:</td>
|
|
||||||
<td><input type="text" name="db" value="" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_prefix')?>:</td>
|
|
||||||
<td><input type="text" name="prefix" value="game_" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_login')?>:</td>
|
|
||||||
<td><input type="text" name="user" value="" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo $this->getData('ins_form_pass')?>:</td>
|
|
||||||
<td><input type="password" name="passwort" value="" size="20"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<br>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><input type="button" name="next" onclick="submit();" value="<?php echo $this->getData('ins_btn_inst')?>" ></th>
|
|
||||||
</tr>
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th colspan="2">
|
|
||||||
<br><?php echo $this->getData('ins_tx_goto1')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_goto2')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_goto3')?><br><br>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><input type="button" name="next" onclick="submit();" value="<?php echo $this->getData('ins_btn_next')?>" ></th>
|
|
||||||
</tr>
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<tr>
|
|
||||||
<th colspan="2">
|
|
||||||
<br><?php echo $this->getData('ins_tx_welco')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_intr1')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_intr2')?><br>
|
|
||||||
<?php echo $this->getData('ins_tx_intr3')?><br><br>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><input type="button" name="next" onclick="self.location.href='index.php?mode=ins&page=1'" value="<?php echo $this->getData('ins_btn_next')?>" ></th>
|
|
||||||
</tr>
|
|
||||||
8
application/design/install/default/scripts/status.phtml
Normal file
8
application/design/install/default/scripts/status.phtml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<div class="status">
|
||||||
|
<?php $status = $this->getData('step')?>
|
||||||
|
<p class="item intro<?php if ($status == 0):?> active<?php elseif ($status >= 1):?> cleared<?php endif?>"><?php echo $this->__('Welcome')?></p>
|
||||||
|
<p class="item system<?php if ($status == 1):?> active<?php elseif ($status >= 2):?> cleared<?php endif?>"><?php echo $this->__('System')?></p>
|
||||||
|
<p class="item database<?php if ($status == 2):?> active<?php elseif ($status >= 3):?> cleared<?php endif?>"><?php echo $this->__('Database')?></p>
|
||||||
|
<p class="item profile<?php if ($status == 3):?> active<?php elseif ($status >= 4):?> cleared<?php endif?>"><?php echo $this->__('Admin profile')?></p>
|
||||||
|
<p class="item summary<?php if ($status == 4):?> active<?php elseif ($status >= 5):?> cleared<?php endif?>"><?php echo $this->__('Summary')?></p>
|
||||||
|
</div>
|
||||||
82
config.php
82
config.php
|
|
@ -1,82 +0,0 @@
|
||||||
<?php array (
|
|
||||||
'global' =>
|
|
||||||
array (
|
|
||||||
'storyline' =>
|
|
||||||
array (
|
|
||||||
'universe' => 'legacies',
|
|
||||||
'episode' => 'default',
|
|
||||||
),
|
|
||||||
'web' =>
|
|
||||||
array (
|
|
||||||
'base_url' => 'http://localhost/projects/wootook-1.5/',
|
|
||||||
),
|
|
||||||
'date' =>
|
|
||||||
array (
|
|
||||||
'timezone' => 'Europe/Paris',
|
|
||||||
),
|
|
||||||
'layout' =>
|
|
||||||
array (
|
|
||||||
'page' => 'page.php',
|
|
||||||
'admin' => 'admin.php',
|
|
||||||
'empire' => 'empire.php',
|
|
||||||
),
|
|
||||||
'locales' =>
|
|
||||||
array (
|
|
||||||
'fr' => 'fr_FR',
|
|
||||||
'fr_FR' => 'fr_FR',
|
|
||||||
'en' => 'en_US',
|
|
||||||
'en_US' => 'en_US',
|
|
||||||
),
|
|
||||||
'database' =>
|
|
||||||
array (
|
|
||||||
'default' =>
|
|
||||||
array (
|
|
||||||
'engine' => 'mysql',
|
|
||||||
'options' =>
|
|
||||||
array (
|
|
||||||
),
|
|
||||||
'params' =>
|
|
||||||
array (
|
|
||||||
'hostname' => 'localhost',
|
|
||||||
'username' => 'root',
|
|
||||||
'password' => '%J4mzdo69$',
|
|
||||||
'database' => 'db_xnova',
|
|
||||||
'port' => '3306',
|
|
||||||
),
|
|
||||||
'table_prefix' => 'wtk_',
|
|
||||||
),
|
|
||||||
'core_setup' =>
|
|
||||||
array (
|
|
||||||
'use' => 'default',
|
|
||||||
),
|
|
||||||
'core_read' =>
|
|
||||||
array (
|
|
||||||
'use' => 'default',
|
|
||||||
),
|
|
||||||
'core_write' =>
|
|
||||||
array (
|
|
||||||
'use' => 'default',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'default' =>
|
|
||||||
array (
|
|
||||||
'engine' =>
|
|
||||||
array (
|
|
||||||
'core' =>
|
|
||||||
array (
|
|
||||||
'use_large_numbers' => false,
|
|
||||||
),
|
|
||||||
'universe' =>
|
|
||||||
array (
|
|
||||||
'galaxies' => NULL,
|
|
||||||
'systems' => NULL,
|
|
||||||
'positions' => NULL,
|
|
||||||
),
|
|
||||||
'combat' =>
|
|
||||||
array (
|
|
||||||
'allow_spy_drone_attacks' => false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
@ -45,15 +45,6 @@ $step = isset($_GET['step']) ? intval($_GET['step']) : 1;
|
||||||
$prevStep = $step - 1;
|
$prevStep = $step - 1;
|
||||||
$nextStep = $step + 1;
|
$nextStep = $step + 1;
|
||||||
|
|
||||||
$modules = array(
|
|
||||||
'Wootook_Core',
|
|
||||||
'Wootook_Empire',
|
|
||||||
'Legacies_Empire',
|
|
||||||
'Legacies_Officers'
|
|
||||||
);
|
|
||||||
|
|
||||||
includeLang('install/install');
|
|
||||||
|
|
||||||
$baseUrl = (isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) == "on" ? 'https://' : 'http://')
|
$baseUrl = (isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) == "on" ? 'https://' : 'http://')
|
||||||
. $_SERVER["SERVER_NAME"] . ($_SERVER["SERVER_PORT"] != "80" ? ":{$_SERVER["SERVER_PORT"]}" : '');
|
. $_SERVER["SERVER_NAME"] . ($_SERVER["SERVER_PORT"] != "80" ? ":{$_SERVER["SERVER_PORT"]}" : '');
|
||||||
if (isset($_SERVER['REQUEST_URI'])) {
|
if (isset($_SERVER['REQUEST_URI'])) {
|
||||||
|
|
@ -63,17 +54,40 @@ if (isset($_SERVER['REQUEST_URI'])) {
|
||||||
$baseUrl .= dirname(dirname($_SERVER['REQUEST_URI'])) . '/';
|
$baseUrl .= dirname(dirname($_SERVER['REQUEST_URI'])) . '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Wootook::setConfig('global/web/base_url', $baseUrl);
|
|
||||||
|
|
||||||
Wootook::setConfig('global/package', 'install');
|
|
||||||
Wootook::setConfig('global/theme', 'default');
|
|
||||||
Wootook::setconfig('global/layout', array(
|
|
||||||
'page' => 'page.php',
|
|
||||||
'install' => 'install.php'
|
|
||||||
));
|
|
||||||
|
|
||||||
$session = Wootook::getSession('install');
|
$session = Wootook::getSession('install');
|
||||||
|
|
||||||
|
$website = new Wootook_Core_Model_Website();
|
||||||
|
$website->setId(0)->setData('code', Wootook_Core_Model_Website::DEFAULT_CODE);
|
||||||
|
Wootook::setWebsite(0, $website);
|
||||||
|
|
||||||
|
$game = new Wootook_Core_Model_Game();
|
||||||
|
$game->setId(0)->setData('code', Wootook_Core_Model_Game::DEFAULT_CODE);
|
||||||
|
Wootook::setWebsite(0, $game);
|
||||||
|
|
||||||
|
$configRewrites = array(
|
||||||
|
'default' => array(
|
||||||
|
'web' => array(
|
||||||
|
'base_url' => $baseUrl
|
||||||
|
),
|
||||||
|
'package' => 'install',
|
||||||
|
'theme' => 'default',
|
||||||
|
'layout' => array(
|
||||||
|
'page' => 'page.php',
|
||||||
|
'install' => 'install.php'
|
||||||
|
),
|
||||||
|
'storyline' => array(
|
||||||
|
'universe' => 'legacies',
|
||||||
|
'episode' => 'default',
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$config = unserialize($session->getData('config'));
|
||||||
|
if (!is_array($config)) {
|
||||||
|
$config = array();
|
||||||
|
}
|
||||||
|
Wootook::loadConfig(array_merge_recursive($config, $configRewrites));
|
||||||
|
|
||||||
$layout = new Wootook_Core_Layout();
|
$layout = new Wootook_Core_Layout();
|
||||||
$request = new Wootook_Core_Controller_Request_Http();
|
$request = new Wootook_Core_Controller_Request_Http();
|
||||||
$response = new Wootook_Core_Controller_Response_Http();
|
$response = new Wootook_Core_Controller_Response_Http();
|
||||||
|
|
@ -284,10 +298,18 @@ case 'install':
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Wootook::writeConfig($config);
|
$session->setData('config', serialize($config));
|
||||||
|
$writer = new Wootook_Core_Config_Adapter_Array();
|
||||||
|
$writer->setData($config);
|
||||||
|
$writer->save(ROOT_PATH . 'config.php');
|
||||||
|
|
||||||
|
Wootook::loadConfig(array_merge_recursive($writer->toArray(), $configRewrites));
|
||||||
|
|
||||||
|
$galaxyCount = Wootook::getConfig('engine/universe/galaxies');
|
||||||
|
$systemCount = Wootook::getConfig('engine/universe/systems');
|
||||||
|
|
||||||
$gameplays = include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'gameplays.php';
|
$gameplays = include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'gameplays.php';
|
||||||
$gameplayKey = $config['global']['storyline']['universe'];
|
$gameplayKey = Wootook::getConfig('storyline/universe');
|
||||||
if (!isset($gameplays[$gameplayKey])) {
|
if (!isset($gameplays[$gameplayKey])) {
|
||||||
$gameplayKey = key($gameplays);
|
$gameplayKey = key($gameplays);
|
||||||
}
|
}
|
||||||
|
|
@ -313,28 +335,18 @@ case 'install':
|
||||||
}
|
}
|
||||||
} catch (Wootook_Core_Setup_Exception_VersionStageError $e) {
|
} catch (Wootook_Core_Setup_Exception_VersionStageError $e) {
|
||||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
|
|
||||||
$session->addError($e->getMessage());
|
|
||||||
$session->setData('step', STEP_UNIVERSE);
|
|
||||||
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE)));
|
|
||||||
$response->sendHeaders();
|
|
||||||
continue;
|
continue;
|
||||||
} catch (Wootook_Core_Setup_Exception_VersionValueError $e) {
|
} catch (Wootook_Core_Setup_Exception_VersionValueError $e) {
|
||||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
|
|
||||||
$session->addError($e->getMessage());
|
|
||||||
$session->setData('step', STEP_UNIVERSE);
|
|
||||||
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE)));
|
|
||||||
$response->sendHeaders();
|
|
||||||
continue;
|
continue;
|
||||||
} catch (Wootook_Core_Setup_Exception_RuntimeException $e) {
|
} catch (Wootook_Core_Setup_Exception_RuntimeException $e) {
|
||||||
|
$session->addError($e->getMessage());
|
||||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
|
|
||||||
$session->addError($e->getMessage());
|
|
||||||
$session->setData('step', STEP_UNIVERSE);
|
|
||||||
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE)));
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE)));
|
||||||
$response->sendHeaders();
|
$response->sendHeaders();
|
||||||
continue;
|
exit(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$path = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'gamedata' . DIRECTORY_SEPARATOR
|
$path = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'gamedata' . DIRECTORY_SEPARATOR
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,9 @@ LEFT JOIN {{table}}planets AS planets ON planets.id_owner=users.id
|
||||||
WHERE users.id={$id}
|
WHERE users.id={$id}
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
$config = Wootook_Core_Model_Config::getSingleton();
|
|
||||||
|
|
||||||
$data = array_merge(
|
$data = array_merge(
|
||||||
array(
|
array(
|
||||||
'game_name' => $config['game_name'],
|
'game_name' => Wootook::getGameConfig('game/general/name'),
|
||||||
'date' => date('d M Y')
|
'date' => date('d M Y')
|
||||||
),
|
),
|
||||||
doquery($sql, '', true)
|
doquery($sql, '', true)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue