Updated install and fixed bugs

Added session messages display
Fixed field and validator loading.
Updated form validation
Updated root config management
Muted error reporting in file evaluation
Added menu updates
Fixed galaxy data access error
Fixed config bug
Added HTTP request method checks
Added Form manager
Fixed core bugs

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2011-11-08 08:56:53 +01:00
commit 9636b4bb00
69 changed files with 2434 additions and 789 deletions

View file

@ -28,10 +28,6 @@
*
*/
defined('BCNUMBERS') || define('BCNUMBERS', true);
defined('DEPRECATION') || define('DEPRECATION', true);
defined('DEBUG') || define('DEBUG', true);
if (!defined('DEBUG') && ($env = getenv('DEBUG')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) {
define('DEBUG', true);
} else if (!defined('DEBUG') && isset($_SERVER['DEBUG']) && in_array(strtolower($_SERVER['DEBUG']), array('1', 'on', 'true'))) {
@ -62,7 +58,7 @@ defined('APPLICATION_PATH') || define('APPLICATION_PATH', dirname(__FILE__) . DI
defined('PHPEXT') || define('PHPEXT', 'php');
defined('VERSION') || define('VERSION', '2011.1');
defined('VERSION') || define('VERSION', '1.5.0-beta2');
set_include_path(implode(PATH_SEPARATOR, array(
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'libraries',
@ -80,7 +76,8 @@ Wootook_Core_Time::init();
Wootook_Core_ErrorProfiler::register();
Wootook_Core_Model_Config_Events::registerEvents();
if (0 === filesize(ROOT_PATH . 'config.php')) {
if (!defined('IN_INSTALL') && 0 === filesize(ROOT_PATH . 'config.php')) {
header('HTTP/1.1 307 Temporary Redirect');
header('Location: install/');
die();
}
@ -100,43 +97,46 @@ include(ROOT_PATH . 'language/' . DEFAULT_LANG . '/lang_info.cfg');
include(ROOT_PATH . 'includes/vars.' . PHPEXT);
include(ROOT_PATH . 'includes/strings.' . PHPEXT);
$gameConfig = Wootook_Core_Model_Config::getSingleton();
if (isset($gameConfig['cookie_name']) && !empty($gameConfig['cookie_name'])) {
Wootook_Empire_Model_User::setCookieName($gameConfig['cookie_name']);
}
$user = Wootook_Empire_Model_User::getSingleton();
if (!defined('IN_INSTALL')) {
if (!defined('DISABLE_IDENTITY_CHECK')) {
if (($user === null || !$user->getId())) {
header('Location: login.php');
exit(0);
$gameConfig = Wootook_Core_Model_Config::getSingleton();
if (isset($gameConfig['cookie_name']) && !empty($gameConfig['cookie_name'])) {
Wootook_Empire_Model_User::setCookieName($gameConfig['cookie_name']);
}
$user = Wootook_Empire_Model_User::getSingleton();
if (!defined('DISABLE_IDENTITY_CHECK')) {
if (($user === null || !$user->getId())) {
header('Location: login.php');
exit(0);
}
if ($gameConfig->isEnabled() && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) {
message(stripslashes($gameConfig->getData('close_reason')), $gameConfig->getData('game_name'));
exit(0);
}
}
if ($gameConfig->isEnabled() && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) {
message(stripslashes($gameConfig->getData('close_reason')), $gameConfig->getData('game_name'));
exit(0);
includeLang('system');
includeLang('tech');
if (($user !== null && $user->getId())) {
if (isset($_GET['cp']) && !empty($_GET['cp'])) {
$user->updateCurrentPlanet((int) $_GET['cp']);
}
$planet = $user->getCurrentPlanet();
foreach ($user->getPlanetCollection() as $userPlanet) {
FlyingFleetHandler($userPlanet); // TODO: implement logic into a refactored model
}
/*
* Update planet resources and constructions
*/
Wootook::dispatchEvent('planet.update', array(
'planet' => $planet
));
$planet->save();
}
}
includeLang('system');
includeLang('tech');
if (($user !== null && $user->getId())) {
if (isset($_GET['cp']) && !empty($_GET['cp'])) {
$user->updateCurrentPlanet((int) $_GET['cp']);
}
$planet = $user->getCurrentPlanet();
foreach ($user->getPlanetCollection() as $userPlanet) {
FlyingFleetHandler($userPlanet); // TODO: implement logic into a refactored model
}
/*
* Update planet resources and constructions
*/
Wootook::dispatchEvent('planet.update', array(
'planet' => $planet
));
$planet->save();
}

View file

@ -197,7 +197,7 @@ class Wootook
return self::$_defaultLocale;
}
public function getPreferredLocale($availableLocales = array())
public static function getPreferredLocale($availableLocales = array())
{
if (empty($availableLocales)) {
return self::getDefaultLocale();
@ -255,6 +255,9 @@ class Wootook
return self::$_now;
}
/**
* @return Wootook_Core_Controller_Request_Http
*/
public static function getRequest()
{
if (self::$_request === null) {
@ -268,6 +271,9 @@ class Wootook
self::$_request = $request;
}
/**
* @return Wootook_Core_Controller_Response_Http
*/
public static function getResponse()
{
if (self::$_response === null) {
@ -281,11 +287,20 @@ class Wootook
self::$_response = $response;
}
public static function getConfig($path = null)
private static function _loadConfig()
{
if (self::$_config === null) {
self::$_config = include ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php';
if (!is_array(self::$_config)) {
self::$_config = array();
}
}
}
public static function getConfig($path = null)
{
self::_loadConfig();
if ($path === null || !is_string($path)) {
return self::$_config;
@ -300,6 +315,25 @@ class Wootook
return $config;
}
public static function setConfig($path = null, $value)
{
self::_loadConfig();
if ($path === null || !is_string($path)) {
return self::$_config;
}
$config = &self::$_config;
foreach (explode('/', $path) as $chunk) {
if (!isset($config[$chunk])) {
$config[$chunk] = array();
}
$config = &$config[$chunk];
}
$config = $value;
return true;
}
public static function getBaseUrl()
{
return self::getConfig('global/web/base_url');
@ -333,10 +367,13 @@ class Wootook
return false;
}
Wootook_Core_ErrorProfiler::sleep();
if (($fp = @fopen($path, 'r', true)) === false) {
Wootook_Core_ErrorProfiler::wakeup();
return false;
}
fclose($fp);
Wootook_Core_ErrorProfiler::wakeup();
return true;
}
}

View file

@ -0,0 +1,43 @@
<?php
class Wootook_Core_Block_Messages
extends Wootook_Core_Block_Template
{
protected $_storages = array();
public function prepareMessages($namespace)
{
$this->_storages[] = $namespace;
}
public function renderGroupedHtml()
{
$messages = array();
foreach ($this->_storages as $namespace) {
$session = Wootook::getSession($namespace);
foreach ($session->getData('messages') as $messageLevel => $messageList) {
if (!isset($messages[$messageLevel])) {
$messages[$messageLevel] = $messageList;
} else {
$messages[$messageLevel] += $messageList;
}
}
}
rsort($messages, SORT_NUMERIC);
$output = '<div class="messages">';
foreach ($messages as $messageLevel => $messageList) {
$output .= "<ul class=\"{$messageLevel}\">";
foreach ($messageList as $message) {
$output .= "<li>{$message}</li>";
}
$output .= '</ul>';
}
$output .= '</div>';
return $output;
}
}

View file

@ -84,6 +84,40 @@ class Wootook_Core_Controller_Request_Http
return $_SERVER[$key];
}
public function getAllQueryData()
{
return $_GET;
}
public function getAllFilesData()
{
return $_FILES;
}
public function getAllCookieData()
{
$data = array();
foreach ($_COOKIE as $key => $value) {
$data[$key] = unserialize(stripslashes($value));
}
return $data;
}
public function getAllRawCookieData()
{
return $_COOKIE;
}
public function getAllPostData()
{
return $_POST;
}
public function getAllServerData()
{
return $_SERVER;
}
public function isPost()
{
if (strtoupper($this->getServer('REQUEST_METHOD')) == 'POST') {
@ -92,6 +126,22 @@ class Wootook_Core_Controller_Request_Http
return false;
}
public function isPut()
{
if (strtoupper($this->getServer('REQUEST_METHOD')) == 'PUT') {
return true;
}
return false;
}
public function isHead()
{
if (strtoupper($this->getServer('REQUEST_METHOD')) == 'HEAD') {
return true;
}
return false;
}
public function isGet()
{
if (strtoupper($this->getServer('REQUEST_METHOD')) == 'GET') {

View file

@ -81,7 +81,7 @@ class Wootook_Core_Controller_Response_Http
return $this;
}
public function setRawHeader($name, $value)
public function setRawHeader($value)
{
if (!isset($this->_data['raw_headers']) || !is_array($this->_data['raw_headers'])) {
$this->clearRawHeaders();

View file

@ -0,0 +1,175 @@
<?php
class Wootook_Core_Form
{
protected $_fields = array();
protected $_request = null;
/**
*
* Field class loader
* @var Wootook_Core_Form_FieldLoader
*/
protected $_fieldLoader = null;
/**
*
* Validator class loader
* @var Wootook_Core_Form_ValidatorLoader
*/
protected $_validatorLoader = null;
/**
*
* Enter description here ...
* @var Wootook_Core_Model_Session
*/
protected $_session = null;
public function __construct(Wootook_Core_Model_Session $session, Array $fields = array())
{
$this->_session = $session;
$this->_fieldLoader = new Wootook_Core_Form_FieldLoader($this, array(
'Wootook_Core_Form_Field_' => 'Wootook/Core/Form/Field'
));
$this->_validatorLoader = new Wootook_Core_Form_ValidatorLoader($this, array(
'Wootook_Core_Form_Validator_' => 'Wootook/Core/Form/Validator'
));
$this->addField('__formkey', 'text', array('form_key' => 'formKey'));
foreach ($fields as $fieldName => $fieldConfig) {
if (is_string($fieldConfig)) {
$this->addField($fieldName, $fieldConfig);
} else if ($fieldConfig instanceof Wootook_Core_Form_FieldAbstract) {
$this->addField($fieldName, $fieldConfig);
} else {
if (isset($fieldConfig['validators'])) {
$this->addField($fieldName, $fieldConfig['type'], $fieldConfig['validators']);
} else {
$this->addField($fieldName, $fieldConfig['type']);
}
}
}
}
public function validate()
{
foreach ($this->_fields as $field) {
$field->validate();
}
}
/**
*
* Enter description here ...
* @param string $name
* @param string|Wootook_Core_Form_FieldAbstract $type
* @return Wootook_Core_Form
*/
public function addField($name, $type = 'text', Array $validators = array())
{
if ($type instanceof Wootook_Core_Form_FieldAbstract) {
$this->_fields[$name] = $name;
$this->_fields[$name]->setForm($this);
} else {
$field = $this->_fieldLoader->load($type);
if ($field === null) {
trigger_error(sprintf('Field %1$s (type: %2$s) could not be created.', $name, $type), E_USER_WARNING);
return $this;
}
$this->_fields[$name] = $field;
}
$this->_fields[$name]->setName($name);
foreach ($validators as $validatorName => $validatorType) {
if ($validatorType instanceof Wootook_Core_Form_FieldAbstract) {
$this->_fields[$name]->addValidator($validatorType, $validatorName);
} else {
$validator = $this->_validatorLoader->load($validatorType);
if ($validator === null) {
trigger_error(sprintf('Validator %1$s (type: %2$s) could not be created.', $validatorName, $validatorType), E_USER_WARNING);
return $this;
}
$this->_fields[$name]->addValidator($validator, $validatorName);
}
}
return $this;
}
/**
*
* Enter description here ...
* @param string $name
* @return Wootook_Core_Form_FieldAbstract
*/
public function getField($name)
{
if (!isset($this->_fields[$name])) {
return null;
}
return $this->_fields[$name];
}
/**
*
* Enter description here ...
* @param string $name
* @return Wootook_Core_Model_Session
*/
public function getSession()
{
return $this->_session;
}
public function setRequest(Wootook_Core_Controller_Request_Http $request)
{
$this->_request = $request;
return $this;
}
/**
*
* Enter description here ...
* @return Wootook_Core_Controller_Request_Http
*/
public function getRequest()
{
return $this->_request;
}
public function getData()
{
$request = $this->getRequest();
if ($request === null) {
return array();
}
if ($request->isPost()) {
return $request->getAllPostData();
}
return $request->getAllQueryData();
}
public function populate(Array $datas = array())
{
$request = $this->getRequest();
foreach ($this->_fields as $fieldName => $field) {
if (isset($datas[$fieldName])) {
$field->populate($datas[$fieldName]);
} else if ($request->isPost()) {
$field->populate($request->getPost($fieldName));
} else {
$field->populate($request->getQuery($fieldName));
}
}
}
}

View file

@ -0,0 +1,11 @@
<?php
class Wootook_Core_Form_Field_Text
extends Wootook_Core_Form_FieldAbstract
{
public function getType()
{
return 'text';
}
}

View file

@ -0,0 +1,104 @@
<?php
abstract class Wootook_Core_Form_FieldAbstract
{
protected $_name = null;
protected $_form = null;
protected $_value = null;
protected $_validators = array();
public function __construct(Wootook_Core_Form $form = null)
{
if ($form !== null) {
$this->setForm($form);
}
}
abstract public function getType();
public function validate()
{
$data = $this->getData();
foreach ($this->_validators as $validator) {
if (!$validator->validate($this, $data)) {
return false;
}
}
return true;
}
public function setName($name)
{
$this->_name = $name;
return $this;
}
public function getName()
{
return $this->_name;
}
public function setForm(Wootook_Core_Form $form)
{
$this->_form = $form;
return $this;
}
public function getForm()
{
return $this->_form;
}
public function getData()
{
return $this->_value;
}
public function populate($value)
{
$this->_value = $value;
return $this;
}
public function addValidator(Wootook_Core_Form_ValidatorAbstract $validator, $name = null)
{
if ($name === null) {
$this->_validators = array();
$name = 'default';
}
$this->_validators[$name] = $validator;
return $this;
}
public function getValidator($name)
{
if (!isset($this->_validators[$name])) {
return null;
}
return $this->_validators[$name];
}
public function clearValidator($name)
{
if (isset($this->_validators[$name])) {
unset($this->_validators[$name]);
}
return $this;
}
public function clearAllValidators()
{
$this->_validators = array();
return $this;
}
}

View file

@ -0,0 +1,36 @@
<?php
class Wootook_Core_Form_FieldLoader
extends Wootook_Core_Plugin_LoaderAbstract
{
protected $_form = null;
public function __construct(Wootook_Core_Form $form, Array $namespaces = array())
{
$this->_form = $form;
foreach ($namespaces as $namespace => $path) {
if (is_int($namespace)) {
$this->registerNamespace($path);
} else {
$this->registerNamespace($namespace, $path);
}
}
}
protected function _load($className, $useSingleton)
{
$reflection = new ReflectionClass($className);
if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) {
$method = $reflection->getMethod('getSingleton');
return $method->invoke(null);
}
try {
return $reflection->newInstance($this->_form);
} catch (ReflectionException $e) {
trigger_error($e->getMessage(), E_USER_WARNING);
return null;
}
}
}

View file

@ -0,0 +1,22 @@
<?php
class Wootook_Core_Form_Validator_Alnum
extends Wootook_Core_Form_Validator_Regex
{
public function __construct()
{
parent::__construct('#[^[:alnum:]]#');
}
public function validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
if ($this->_validate($field, $data)) {
$this->_getSession($field)
->addError('Field "%s" should only contain alphanumeric characters.', $field->getName());
return false;
}
return true;
}
}

View file

@ -0,0 +1,22 @@
<?php
class Wootook_Core_Form_Validator_Alnum
extends Wootook_Core_Form_Validator_Regex
{
public function __construct()
{
parent::__construct('#[^[:alpha:]]#');
}
public function validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
if ($this->_validate($field, $data)) {
$this->_getSession($field)
->addError('Field "%s" should only contain alphabetic characters.', $field->getName());
return false;
}
return true;
}
}

View file

@ -0,0 +1,21 @@
<?php
class Wootook_Core_Form_Validator_Email
extends Wootook_Core_Form_Validator_Regex
{
public function __construct()
{
parent::__construct('#^[[:alnum:]\._\-]@[[:alnum:]\._\-]\.[a-z]{2,}$#');
}
public function validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
if (!$this->_validate($field, $data)) {
$this->_getSession($field)
->addError('Field "%s" should contain an email.', $field->getName());
return false;
}
return true;
}
}

View file

@ -0,0 +1,20 @@
<?php
class Wootook_Core_Form_Validator_FormKey
extends Wootook_Core_Form_ValidatorAbstract
{
public function validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
$form = $field->getForm();
$session = $form->getSession();
if ($session->getFormKey(false) == $data) {
return true;
}
$this->_getSession($field)
->addError('CSRF token failure.', $field->getName());
return false;
}
}

View file

@ -0,0 +1,22 @@
<?php
class Wootook_Core_Form_Validator_Hex
extends Wootook_Core_Form_Validator_Regex
{
public function __construct()
{
parent::__construct('#(?:0x)?[^0-9a-f]#i');
}
public function validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
if ($this->_validate($field, $data)) {
$this->_getSession($field)
->addError('Field "%s" should only contain numeric characters.', $field->getName());
return false;
}
return true;
}
}

View file

@ -0,0 +1,21 @@
<?php
class Wootook_Core_Form_Validator_Email
extends Wootook_Core_Form_Validator_Regex
{
public function __construct()
{
parent::__construct('#^[[:alnum:]\._\-]\.[a-z]{2,}$#');
}
public function validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
if (!$this->_validate($field, $data)) {
$this->_getSession($field)
->addError('Field "%s" should contain a host name.', $field->getName());
return false;
}
return true;
}
}

View file

@ -0,0 +1,22 @@
<?php
class Wootook_Core_Form_Validator_Numeric
extends Wootook_Core_Form_Validator_Regex
{
public function __construct()
{
parent::__construct('#[^[:digit:]]#');
}
public function validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
if ($this->_validate($field, $data)) {
$this->_getSession($field)
->addError('Field "%s" should only contain numeric characters.', $field->getName());
return false;
}
return true;
}
}

View file

@ -0,0 +1,28 @@
<?php
class Wootook_Core_Form_Validator_Regex
extends Wootook_Core_Form_ValidatorAbstract
{
protected $_expression = null;
public function __construct($expression)
{
$this->_expression = $expression;
}
public function validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
if (!$this->_validate($field, $data)) {
$this->_getSession($field)
->addError('Field "%s" does not match the validation pattern.', $field->getName());
return false;
}
return true;
}
protected function _validate(Wootook_Core_Form_FieldAbstract $field, $data)
{
return preg_match($this->_expression, $data);
}
}

View file

@ -0,0 +1,15 @@
<?php
abstract class Wootook_Core_Form_ValidatorAbstract
{
abstract public function validate(Wootook_Core_Form_FieldAbstract $field, $data);
protected function _getSession(Wootook_Core_Form_FieldAbstract $field)
{
$form = $field->getForm();
if (!$form instanceof Wootook_Core_Form) {
return null;
}
return $form->getSession();
}
}

View file

@ -0,0 +1,36 @@
<?php
class Wootook_Core_Form_ValidatorLoader
extends Wootook_Core_Plugin_LoaderAbstract
{
protected $_form = null;
public function __construct(Wootook_Core_Form $form, Array $namespaces = array())
{
$this->_form = $form;
foreach ($namespaces as $namespace => $path) {
if (is_int($namespace)) {
$this->registerNamespace($path);
} else {
$this->registerNamespace($namespace, $path);
}
}
}
protected function _load($className, $useSingleton)
{
$reflection = new ReflectionClass($className);
if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) {
$method = $reflection->getMethod('getSingleton');
return $method->invoke(null);
}
try {
return $reflection->newInstance();
} catch (ReflectionException $e) {
trigger_error($e->getMessage(), E_USER_WARNING);
return null;
}
}
}

View file

@ -8,6 +8,8 @@ class Wootook_Core_Layout
protected $_blocks = array();
protected $_messageBlock = null;
protected $_view = null;
protected $_eventPrefix = 'layout';
protected $_eventObject = 'layout';
@ -31,19 +33,16 @@ class Wootook_Core_Layout
}
}
$config = include ROOT_PATH . 'config.php';
$fileList = array();
if (isset($config['global'])) {
if (isset($config['global']['layout'])) {
$fileList = $config['global']['layout'];
}
if (isset($config['global']['package'])) {
$this->setPackage($config['global']['package']);
}
if (isset($config['global']['theme'])) {
$this->setTheme($config['global']['theme']);
}
$fileList = Wootook::getConfig('global/layout');
if (!is_array($fileList) || empty($fileList)) {
$fileList = $this->getAllDatas();
} else {
$fileList = array_merge($fileList, $this->getAllDatas());
}
$this->_data = array();
$this->setPackage(Wootook::getConfig('global/package'));
$this->setTheme(Wootook::getConfig('global/theme'));
foreach ($fileList as $layoutFile) {
foreach (include $this->_getLayoutPath($layoutFile) as $layoutId => $layoutConfig) {
@ -57,6 +56,8 @@ class Wootook_Core_Layout
}
}
$this->_messageBlock = $this->createBlock('core/messages', 'messages');
return $this;
}
@ -86,6 +87,9 @@ class Wootook_Core_Layout
$layoutUpdates = array();
$layoutConfig = array();
foreach (array_reverse($layoutConfigs) as $config) {
if (!is_array($config)) {
continue;
}
$layoutConfig = array_merge($layoutConfig, $config);
if (isset($layoutConfig['reference'])) {
@ -374,6 +378,10 @@ class Wootook_Core_Layout
public function render()
{
if (!$this->_view instanceof Wootook_Core_View) {
throw new Wootook_Core_Exception_RuntimeException(Wootook::__('No root view declared.'));
}
$scriptPath = $this->getScriptPath();
foreach ($this->_blocks as $block) {
if ($block instanceof Wootook_Core_Block_Template) {
@ -407,8 +415,17 @@ class Wootook_Core_Layout
return $path;
}
trigger_error(Legacies::__("Layout file '%s' does not exist.", $file), E_USER_NOTICE);
trigger_error(Wootook::__("Layout file '%s' does not exist.", $file), E_USER_NOTICE);
return null;
}
/**
*
* @return Wootook_Core_Block_Messages
*/
public function getMessagesblock()
{
return $this->_messageBlock;
}
}

View file

@ -8,6 +8,13 @@ abstract class Wootook_Core_Model_Config_Abstract
{
$config = Wootook::getConfig('global/storyline');
if ($config === null || empty($config)) {
$config = array(
'universe' => 'default',
'episode' => 'default'
);
}
$path = 'gamedata' . DIRECTORY_SEPARATOR . $config['universe'] . DIRECTORY_SEPARATOR
. $config['episode'] . DIRECTORY_SEPARATOR . $filename . '.php';

View file

@ -128,7 +128,7 @@ class Wootook_Core_Model_Session
return $this->addMessage(vsprintf($message, $args), self::DEBUG);
}
public function getFormKey($reset = false)
public function getFormKey($reset = true)
{
if (!$this->getData('form_key')) {
$this->setData('form_key', uniqid());
@ -136,10 +136,32 @@ class Wootook_Core_Model_Session
}
$key = $this->getData('form_key');
if ($reset == true) {
if ($reset !== true) {
$this->setData('form_key', uniqid());
}
return $key;
}
public function setFormData(Array $data = array())
{
if (isset($data['__formkey'])) {
unset($data['__formkey']);
}
$this->setData('form_data', $data);
return $this;
}
public function getFormData($key = null, $default = null)
{
$data = $this->getData('form_data');
if ($key === null) {
return $data;
} else if (isset($data[$key])) {
return $data[$key];
}
return $default;
}
}

View file

@ -15,7 +15,7 @@ abstract class Wootook_Core_Plugin_LoaderAbstract
$className = $namespace . ucfirst($pluginName);
$fileName = $path . DIRECTORY_SEPARATOR . ucfirst($pluginName) . '.php';
if (!file_exists($fileName)) {
if (!Wootook::fileExists($fileName)) {
continue;
}
@ -26,7 +26,7 @@ abstract class Wootook_Core_Plugin_LoaderAbstract
return $this->_load($className, $useSingleton);
}
return $this;
return null;
}
public function registerNamespace($namespace, $path = null)
@ -48,7 +48,7 @@ abstract class Wootook_Core_Plugin_LoaderAbstract
return $this;
}
abstract protected function _load($className);
abstract protected function _load($className, $useSingleton);
public function getPlugin($pluginName)
{

View file

@ -3,10 +3,14 @@
class Wootook_Core_Time
{
public static function init()
public static function init($timezone = null)
{
$config = include ROOT_PATH . 'config.php';
$timezone = $config['global']['date']['timezone'];
if ($timezone === null) {
$timezone = Wootook::getConfig('global/date/timezone');
}
if ($timezone === null) {
$timezone = 'GMT';
}
date_default_timezone_set($timezone);
}

View file

@ -142,7 +142,16 @@ class Wootook_Core_View
$theme = Wootook_Core_Layout::DEFAULT_THEME;
}
return Wootook::getSkinUrl($package, $theme, $uri, $params);
$pattern = ROOT_PATH . DIRECTORY_SEPARATOR . 'skin/%s/%s/{$uri}';
if (Wootook::fileExists(sprintf($pattern, $package, $theme))) {
return Wootook::getSkinUrl($package, $theme, $uri, $params);
}
if (Wootook::fileExists(sprintf($pattern, $package, Wootook_Core_Layout::DEFAULT_THEME))) {
return Wootook::getSkinUrl($package, Wootook_Core_Layout::DEFAULT_THEME, $uri, $params);
}
return Wootook::getSkinUrl(Wootook_Core_Layout::DEFAULT_PACKAGE, Wootook_Core_Layout::DEFAULT_THEME, $uri, $params);
}
public function setPartial($name, $content)

View file

@ -26,6 +26,11 @@ class Wootook_Empire_Model_Planet
*/
protected $_moon = null;
/**
* @var Wootook_Empire_Model_Planet
*/
protected $_planet = null;
/**
* @var Wootook_Empire_Model_Planet_Builder
*/
@ -175,10 +180,14 @@ class Wootook_Empire_Model_Planet
public function getGalaxyData()
{
$entity = new Wootook_Empire_Model_Galaxy_Position();
$entity->load(array('id_planet' => $this->getId()));
if ($this->isPlanet()) {
$entity = new Wootook_Empire_Model_Galaxy_Position();
$entity->load(array('id_planet' => $this->getId()));
return $entity;
return $entity;
}
return $this->getPlanet()->getGalaxyData();
}
public function updateStorages($time = null)
@ -533,10 +542,62 @@ class Wootook_Empire_Model_Planet
));
$this->_moon = $statement->current();
if ($this->_moon !== null && $this->_moon instanceof self) {
$this->_moon->setPlanet($this);
}
}
return $this->_moon;
}
public function setMoon(Wootook_Empire_Model_Planet $moon)
{
$this->_moon = $moon;
return $this;
}
public function getPlanet()
{
static $statement = null;
if ($this->isPlanet()) {
return null;
}
if ($this->_planet === null) {
if ($statement === null) {
$statement = new Wootook_Core_Collection(array('planet' => 'planets'), get_class($this));
$statement
->where('galaxy=:galaxy')
->where('system=:system')
->where('planet=:position')
->where('planet_type=' . strval(self::TYPE_PLANET))
;
}
$statement->load(array(
'galaxy' => $this->getGalaxy(),
'system' => $this->getSystem(),
'position' => $this->getPosition()
));
$this->_planet = $statement->current();
if ($this->_planet !== null && $this->_planet instanceof self) {
$this->_planet->setMoon($this);
}
}
return $this->_planet;
}
public function setPlanet(Wootook_Empire_Model_Planet $planet)
{
$this->_planet = $planet;
return $this;
}
public function setGalaxy($galaxy)
{
$this->setData('galaxy', $galaxy);

View file

@ -555,6 +555,10 @@ class Wootook_Empire_Model_User
$layout = $eventData['layout'];
$navigation = $layout->getBlock('navigation');
$navigation->addLink('tools/admin', 'Admin Panel', 'Admin Panel', 'admin/index.php', array(), array('admin'));
if (!defined('IN_ADMIN')) {
$navigation->addLink('tools/admin', 'Admin Panel', 'Admin Panel', 'admin/overview.php', array(), array('admin'));
} else {
$navigation->addLink('tools/back', 'Go back to the game', 'Go back to the game', 'overview.php', array(), array('admin'));
}
}
}

View file

@ -0,0 +1,243 @@
<?php return array(
'admin' => array(
'update' => '1column',
'reference' => array(
'content' => array(
'children' => array(
'navigation' => array(
'type' => 'core/html.navigation',
'template' => 'page/html/navigation.phtml',
'actions' => array(
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'system',
'title' => 'System'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'system/overview',
'label' => 'Overview',
'title' => 'Overview',
'uri' => 'admin/overview.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'system/settings',
'label' => 'Settings',
'title' => 'Settings',
'uri' => 'admin/settings.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'system/reset-universe',
'label' => 'Reset Universe',
'title' => 'Reset Universe',
'uri' => 'admin/XNovaResetUnivers.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'players',
'title' => 'Player Accounts'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/list',
'label' => 'List',
'title' => 'List',
'uri' => 'admin/userlist.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/password-recovery',
'label' => 'Change a password',
'title' => 'Change a password',
'uri' => 'admin/md5changepass.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/search',
'label' => 'Search',
'title' => 'Search',
'uri' => 'admin/paneladmina.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/multi-account-alerts',
'label' => 'Multi account alerts',
'title' => 'Multi account alerts',
'uri' => 'admin/multi.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/declared-multi-account',
'label' => 'Declared multi accounts',
'title' => 'Declared multi accounts',
'uri' => 'admin/declare_list.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/add-resources',
'label' => 'Add Resources',
'title' => 'Add Resources',
'uri' => 'admin/add_money.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/messages',
'label' => 'Private messages management',
'title' => 'Private messages management',
'uri' => 'admin/messagelist.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/chat',
'label' => 'Manage Chat',
'title' => 'Manage Chat',
'uri' => 'chat.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/ban',
'label' => 'Ban Player',
'title' => 'Ban Player',
'uri' => 'admin/banned.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'players/unban',
'label' => 'Unban Player',
'title' => 'Unban Player',
'uri' => 'admin/unbanned.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'empire',
'title' => 'Empires'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'empire/planet-list',
'label' => 'Planet List',
'title' => 'Planet List',
'uri' => 'admin/planetlist.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'empire/moon-list',
'label' => 'Moon List',
'title' => 'Moon List',
'uri' => 'admin/moonlist.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'empire/add-moon',
'label' => 'Add a moon',
'title' => 'Add a moon',
'uri' => 'admin/add_moon.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'empire/planet-activity',
'label' => 'Planet Activity',
'title' => 'Planet Activity',
'uri' => 'admin/activeplanet.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'empire/fleet-list',
'label' => 'Fleet list',
'title' => 'Fleet list',
'uri' => 'admin/ShowFlyingFleets.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'tools',
'title' => 'Tools'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/phpinfo',
'label' => 'PHP Info',
'title' => 'PHP Info',
'uri' => 'variables.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/stats',
'label' => 'Stats updater',
'title' => 'Stats updater',
'uri' => 'statbuilder.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/errors',
'label' => 'Error reporting',
'title' => 'Error reporting',
'uri' => 'errors.php'
)
),
array(
'method' => 'addExternalLink',
'params' => array(
'name' => 'tools/help',
'label' => 'Need help?',
'title' => 'Need help?',
'url' => 'http://wootook.org/board/'
)
)
)
)
)
)
)
)
);

View file

@ -2,287 +2,293 @@
'empire' => array(
'update' => '1column',
'reference' => array(
'navigation' => array(
'actions' => array(
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'development',
'title' => 'Development'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/overview',
'label' => 'Overview',
'title' => 'Overview',
'uri' => 'overview.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/buildings',
'label' => 'Buildings',
'title' => 'Buildings',
'uri' => 'buildings.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/research-lab',
'label' => 'Research Lab',
'title' => 'Research Lab',
'uri' => 'buildings.php',
'params' => array(
'mode' => 'research'
'content' => array(
'children' => array(
'navigation' => array(
'type' => 'core/html.navigation',
'template' => 'page/html/navigation.phtml',
'actions' => array(
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'development',
'title' => 'Development'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/overview',
'label' => 'Overview',
'title' => 'Overview',
'uri' => 'overview.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/buildings',
'label' => 'Buildings',
'title' => 'Buildings',
'uri' => 'buildings.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/research-lab',
'label' => 'Research Lab',
'title' => 'Research Lab',
'uri' => 'buildings.php',
'params' => array(
'mode' => 'research'
)
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/shipyard',
'label' => 'Shipyard',
'title' => 'Shipyard',
'uri' => 'buildings.php',
'params' => array(
'mode' => 'fleet'
)
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/defenses',
'label' => 'Defenses',
'title' => 'Defenses',
'uri' => 'buildings.php',
'params' => array(
'mode' => 'defense'
)
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/officers',
'label' => 'Officers',
'title' => 'Officers',
'uri' => 'officier.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'navigation',
'title' => 'Navigation'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/alliance',
'label' => 'Alliance',
'title' => 'Alliance',
'uri' => 'alliance.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/fleet',
'label' => 'Fleet',
'title' => 'Fleet',
'uri' => 'fleet.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/galaxy',
'label' => 'Galaxy',
'title' => 'Galaxy',
'uri' => 'galaxy.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/empire',
'label' => 'Empire',
'title' => 'Empire',
'uri' => 'imperium.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/resources',
'label' => 'Resources Production',
'title' => 'Resources Production',
'uri' => 'resources.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/retailer',
'label' => 'Retailer',
'title' => 'Retailer',
'uri' => 'marchand.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/tech-tree',
'label' => 'Technology Tree',
'title' => 'Technology Tree',
'uri' => 'techtree.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'tools',
'title' => 'Tools'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/messages',
'label' => 'Messages',
'title' => 'Messages',
'uri' => 'messages.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/records',
'label' => 'Records',
'title' => 'Records',
'uri' => 'records.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/statistics',
'label' => 'Stats',
'title' => 'Stats',
'uri' => 'stat.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/banned',
'label' => 'Banned Players',
'title' => 'Banned Players',
'uri' => 'banned.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/announcement',
'label' => 'Announcements',
'title' => 'Announcements',
'uri' => 'annonce.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/notes',
'label' => 'Note Pad',
'title' => 'Note Pad',
'uri' => 'notes.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/options',
'label' => 'Account Options',
'title' => 'Account Options',
'uri' => 'options.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/logout',
'label' => 'Log Out',
'title' => 'Log Out',
'uri' => 'logout.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'community',
'title' => 'Community'
)
),
array(
'method' => 'addExternalLink',
'params' => array(
'name' => 'community/board',
'label' => 'Forum board',
'title' => 'Forum board',
'url' => 'http://www.wootook.org/'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/search-player',
'label' => 'Search Player',
'title' => 'Search Player',
'uri' => 'search.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/chat',
'label' => 'Chat',
'title' => 'Chat',
'uri' => 'chat.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/multi',
'label' => 'Declare Multi-account',
'title' => 'Declare Multi-account',
'uri' => 'delclare_multi.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/rules',
'label' => 'Rules',
'title' => 'Rules',
'uri' => 'rules.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/contact',
'label' => 'Contact Admin',
'title' => 'Contact Admin',
'uri' => 'contact.php'
)
)
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/shipyard',
'label' => 'Shipyard',
'title' => 'Shipyard',
'uri' => 'buildings.php',
'params' => array(
'mode' => 'fleet'
)
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/defenses',
'label' => 'Defenses',
'title' => 'Defenses',
'uri' => 'buildings.php',
'params' => array(
'mode' => 'defense'
)
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/officers',
'label' => 'Officers',
'title' => 'Officers',
'uri' => 'officers.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'navigation',
'title' => 'Navigation'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/alliance',
'label' => 'Alliance',
'title' => 'Alliance',
'uri' => 'alliance.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/fleet',
'label' => 'Fleet',
'title' => 'Fleet',
'uri' => 'fleet.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/galaxy',
'label' => 'Galaxy',
'title' => 'Galaxy',
'uri' => 'galaxy.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/empire',
'label' => 'Empire',
'title' => 'Empire',
'uri' => 'imperium.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/resources',
'label' => 'Resources Production',
'title' => 'Resources Production',
'uri' => 'resources.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'development/retailer',
'label' => 'Retailer',
'title' => 'Retailer',
'uri' => 'marchand.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'navigation/tech-tree',
'label' => 'Technology Tree',
'title' => 'Technology Tree',
'uri' => 'techtree.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'tools',
'title' => 'Tools'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/messages',
'label' => 'Messages',
'title' => 'Messages',
'uri' => 'messages.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/records',
'label' => 'Records',
'title' => 'Records',
'uri' => 'records.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/statistics',
'label' => 'Stats',
'title' => 'Stats',
'uri' => 'stat.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/banned',
'label' => 'Banned Players',
'title' => 'Banned Players',
'uri' => 'banned.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/announcement',
'label' => 'Announcements',
'title' => 'Announcements',
'uri' => 'annonce.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/notes',
'label' => 'Note Pad',
'title' => 'Note Pad',
'uri' => 'notes.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/options',
'label' => 'Account Options',
'title' => 'Account Options',
'uri' => 'options.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'tools/logout',
'label' => 'Log Out',
'title' => 'Log Out',
'uri' => 'logout.php'
)
),
array(
'method' => 'setNodeTitle',
'params' => array(
'path' => 'community',
'title' => 'Community'
)
),
array(
'method' => 'addExternalLink',
'params' => array(
'name' => 'community/board',
'label' => 'Forum board',
'title' => 'Forum board',
'url' => 'http://www.wootook.org/'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/search-player',
'label' => 'Search Player',
'title' => 'Search Player',
'uri' => 'search.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/chat',
'label' => 'Chat',
'title' => 'Chat',
'uri' => 'chat.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/multi',
'label' => 'Declare Multi-account',
'title' => 'Declare Multi-account',
'uri' => 'delclare_multi.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/rules',
'label' => 'Rules',
'title' => 'Rules',
'uri' => 'rules.php'
)
),
array(
'method' => 'addLink',
'params' => array(
'name' => 'community/contact',
'label' => 'Contact Admin',
'title' => 'Contact Admin',
'uri' => 'contact.php'
)
)
)
)

View file

@ -1,16 +1,6 @@
<?php return array(
'1column' => array(
'update' => 'default',
'reference' => array(
'content' => array(
'children' => array(
'navigation' => array(
'type' => 'core/html.navigation',
'template' => 'page/html/navigation.phtml'
)
)
)
)
'update' => 'default'
),
'2columns-left' => array(
@ -20,13 +10,7 @@
'root' => array(
'children' => array(
'left' => array(
'type' => 'core/concat',
'children' => array(
'navigation' => array(
'type' => 'core/html.navigation',
'template' => 'page/html/navigation.phtml'
)
)
'type' => 'core/concat'
)
)
)

View file

@ -1,10 +1,16 @@
<form name="rename-planet" id="overview:rename-planet" method="post" action="">
<form name="rename-planet" class="form rename-planet" id="overview:rename-planet" method="post" action="">
<fieldset>
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey()?>" />
<label for="overview:rename-planet:password"><?php echo $this->__('Password:')?></label>
<input id="overview:rename-planet:password" type="password" name="password" />
<label for="overview:rename-planet:name"><?php echo $this->__('New name:')?></label>
<input id="overview:rename-planet:name" type="text" name="name" />
<input type="submit" />
<p>
<label for="overview:rename-planet:name"><?php echo $this->__('New name:')?></label>
<input id="overview:rename-planet:name" type="text" name="name" />
</p>
<p>
<label for="overview:rename-planet:password"><?php echo $this->__('Password:')?></label>
<input id="overview:rename-planet:password" type="password" name="password" />
</p>
<p>
<input type="submit" />
</p>
</fieldset>
</form>

View file

@ -1,4 +1,4 @@
<form action="reg.php" method="post" class="registration">
<form action="reg.php" method="post" class="form registration">
<h1>Wootook!</h1>
<fieldset>
<legend><?php echo $this->__('User data:')?></legend>

View file

@ -0,0 +1,84 @@
<?php return array(
'install' => array(
'update' => '2columns-left',
'reference' => array(
'messages' => array(
'actions' => array(
array(
'method' => 'prepareMessages',
'params' => array(
'namespace' => 'install'
)
)
)
),
'content' => array(
'children' => array(
'navigation' => array(
'type' => 'core/html.navigation',
'template' => 'page/html/navigation.phtml',
'actions' => array()
)
)
),
'left' => array(
'children' => array(
'status' => array(
'type' => 'core/template',
'template' => 'status.phtml'
)
)
)
)
),
'install.intro' => array(
'update' => 'install',
'reference' => array(
'content' => array(
'children' => array(
'overview' => array(
'type' => 'core/template',
'template' => 'intro.phtml'
),
)
),
'status' => array(
'actions' => array(
array(
'method' => 'setData',
'params' => array(
'key' => 'step',
'value' => 'intro'
)
)
)
)
)
),
'install.step.system' => array(
'update' => 'install',
'reference' => array(
'content' => array(
'children' => array(
'overview' => array(
'type' => 'core/template',
'template' => 'step/system.phtml'
),
)
),
'status' => array(
'actions' => array(
array(
'method' => 'setData',
'params' => array(
'key' => 'step',
'value' => 'system'
)
)
)
)
)
)
);

View file

@ -0,0 +1,44 @@
<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>

View file

@ -0,0 +1,9 @@
<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>

View file

@ -0,0 +1,28 @@
<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>

View file

@ -0,0 +1,33 @@
<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>

View file

@ -0,0 +1,8 @@
<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>

View file

@ -0,0 +1,9 @@
<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>

View file

@ -0,0 +1,33 @@
<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>

View file

@ -0,0 +1,10 @@
<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>

View file

@ -0,0 +1,11 @@
<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>

View file

@ -0,0 +1,7 @@
<div class="install">
<h1><?php echo $this->__('Welcome to the Wootook! installer')?></h1>
<?php echo $this->getLayout()->getMessagesblock()->renderGroupedHtml()?>
<p><?php echo $this->__('This page will guide you through the installation proces of Wootook! the MMO game engine platform.')?></p>
<p><?php echo $this->__('Feel free to ask for help at any time at <a href="%s">wootook.org</a>.', 'http://wootook.org/board/')?></p>
<p><button onclick="document.location.href='?mode=install&step=1'"><?php echo $this->__('Next step')?></button></p>
</div>

View file

@ -0,0 +1,13 @@
<?php $session = Wootook::getSession('install')?>
<div class="install">
<h1><?php echo $this->__('Welcome to the Wootook! installer')?></h1>
<h2><?php echo $this->__('System Config')?></h2>
<?php echo $this->getLayout()->getMessagesblock()->renderGroupedHtml()?>
<form method="post" action="?mode=install&step=1">
<p>
<label for="system:url_path"><?php echo $this->__('Base URL path for the game:')?></label>
<input type="text" id="system:url_path" name="url_path" value="<?php echo $session->getFormData('url_path', Wootook::getBaseUrl())?>" />
</p>
<p><input type="submit" value="<?php echo $this->__('Next step')?>" /></p>
</form>
</div>

View file

@ -0,0 +1 @@
<?php return array();

View file

@ -0,0 +1,2 @@
<?php return array(
);

View file

@ -0,0 +1 @@
<?php return array();

View file

@ -0,0 +1,6 @@
<?php return array(
'block' => array(
'core' => array('Wootook_Core_Block_' => 'Wootook/Core/Block'),
'empire' => array('Wootook_Empire_Block_' => 'Wootook/Empire/Block')
)
);

View file

@ -0,0 +1,2 @@
<?php return array(
);

View file

@ -0,0 +1 @@
<?php return array();

View file

@ -0,0 +1 @@
<?php return array();

View file

@ -0,0 +1 @@
<?php return array();

View file

@ -0,0 +1 @@
<?php return array();

View file

@ -0,0 +1,39 @@
"Your session has expired, please login.","Votre session a expiré, veuillez vous reconnecter."
"Your username or credential is invalid, please check your input.","Votre nom d'utilisateur ou votre mot de passe n'est pas valide, veuillez vérifier votre saisie."
"No such user.","Cet utilisateur n'existe pas."
"You were banned, please contact admin for more information.","Vous ont été banni, veuillez contacter l'admin pour plus d'informations."
"You have 1 unread message.","Vous avez un message non lu."
"You have 1 new message.","Vous avez un nouveau message."
"You have no new message.","Vous n'avez pas de nouveau message."
"You have %1$d new messages","Vous avez %1$d nouveaux messages"
"You have %1$d unread messages.","Vous avez %1$d messages non lus."
"You have ""%1$d"" unread messages.","Vous avez ""%1$d"" messages non lus."
"No message.","Aucun message"
"1 messages.","Un message"
"%1$d messages.","%1$d messages."
"instantaneous","instantanné"
"Attack","Attaquer"
"Transport","Transporter"
"Station","Stationner"
"Settle","Coloniser"
"Recycle","Recycler"
"Destroy","Détruire"
"Missiles Launch","Attaque de missiles"
"Expedition","Expédition"
"Unknown","Inconnu"
"Planet is already destroyed","La planète est déjà détruite"
"Password:","Mot de passe :"
"I want to destroy this planet","Je confirme vouloir détruire cette planète"
"New name","Nouveau nom"
"Idle.","Inactif."
"Cancel","Annuler"
"Work in progress","Travail en cours"
"Buildings","Bâtiments"
"Research Laboratory","Laboratoire de recherches"
"Shipyard","Chantier spatial"
"Build","Construire"
"Metal","Métal"
"Cristal","Cristal"
"Deuterium","Deutérium"
"Energy","Energie"
"Messages","Messages"
Can't render this file because it contains an unexpected character in line 13 and column 33.

View file

@ -37,10 +37,6 @@ if (0 === filesize(ROOT_PATH . 'config.php')) {
die();
}
foreach (include ROOT_PATH . 'includes/data/events.php' as $event => $listenerList) {
foreach ($listenerList as $listener) {
Wootook::registerListener($event, $listener);
}
}
Wootook_Core_Model_Config_Events::registerEvents();
include ROOT_PATH . 'includes/constants.php';