diff --git a/admin.php b/admin.php deleted file mode 100644 index 74128f2..0000000 --- a/admin.php +++ /dev/null @@ -1,93 +0,0 @@ - - * All rights reserved. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * --> NOTICE <-- - * This file is part of the core development branch, changing its contents will - * make you unable to use the automatic updates manager. Please refer to the - * documentation for further information about customizing Wootook. - * - */ -define('DISABLE_IDENTITY_CHECK', true); -define('IN_ADMIN', true); -require_once dirname(__FILE__) .'/application/bootstrap.php'; - -$moduleList = array( - 'admin' => array( - 'Wootook_Admin_' => 'Wootook/Admin' - ), - 'core' => array( - 'Wootook_Core_' => 'Wootook/Core' - ) - ); - -$request = Wootook::getRequest(); -$response = Wootook::getResponse(); - -$request->setModuleName('admin'); - -$dispatchCount = 0; -$classReflector = array(); -$instances = array(); -while (true) { - $module = $request->getModuleName(); - $controller = $request->getControllerName(); - $action = $request->getActionName(); - - if ($dispatchCount >= 100) { - throw new Wootook_Core_Exception_RuntimeException(sprintf('Maximum of %d dispatched actions reached.', $dispatchCount)); - } - - $controllerClassSuffix = str_replace(' ', '', ucwords(str_replace('-', ' ', $controller))) . 'Controller'; - - $moduleConfig = $moduleList[$module]; - $controllerFile = current($moduleConfig) . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR . $controllerClassSuffix . '.php'; - $controllerClass = key($moduleConfig) . $controllerClassSuffix; - $actionMethod = str_replace(' ', '', ucwords(str_replace('-', ' ', $action))) . 'Action'; - - if (!class_exists($controllerClass, false)) { - if (!Wootook::fileExists($controllerFile)) { - $request->setModuleName('core') - ->setControllerName('error') - ->setActionName('error'); - continue; - } - include $controllerFile; - } - - if (!isset($classReflector[$controllerClass])) { - $classReflector[$controllerClass] = new ReflectionClass($controllerClass); - } - - $instance = $classReflector[$controllerClass]->newInstance($request, $response); - $instance->init(); - - $request->setIsDispatched(true); - $instance->preDispatch(); - $reflector = $instance->$actionMethod(); - $instance->postDispatch(); - - if ($request->isDispatched()) { - echo $response->sendHeaders()->sendBody(); - break; - } -} diff --git a/application/code/core/Wootook/Core/Config/Node.php b/application/code/core/Wootook/Core/Config/Node.php index 0b25dbd..77d2210 100644 --- a/application/code/core/Wootook/Core/Config/Node.php +++ b/application/code/core/Wootook/Core/Config/Node.php @@ -40,6 +40,11 @@ class Wootook_Core_Config_Node return $this; } + public function getParent() + { + return $this->_parent; + } + public function setConfig($path, $value) { $explodedPath = explode('/', $path); @@ -131,6 +136,9 @@ class Wootook_Core_Config_Node private function _resolveAttributeName($key) { + if (is_numeric($key)) { + return $key; + } if (!isset(self::$_attributeNameCache[$key])) { self::$_attributeNameCache[$key] = str_replace(' ', '-', strtolower(preg_replace('#[A-Z]#', ' \\1', $key))); } @@ -183,7 +191,11 @@ class Wootook_Core_Config_Node public function offsetSet($offset, $value) { - $this->_children[$offset] = $value; + if ($offset === null) { + $this->_children[] = $value; + } else { + $this->_children[$offset] = $value; + } return $value; } diff --git a/application/code/core/Wootook/Core/Form.php b/application/code/core/Wootook/Core/Form.php index 3a853e1..e124e1a 100644 --- a/application/code/core/Wootook/Core/Form.php +++ b/application/code/core/Wootook/Core/Form.php @@ -76,15 +76,17 @@ class Wootook_Core_Form public function addElement($name, $type = 'text', Array $validators = array()) { if ($type instanceof Wootook_Core_Form_ElementAbstract) { - $this->_elements[$name] = $name; + $this->_elements[$name] = $type; $this->_elements[$name]->setForm($this); } else { $element = $this->_elementLoader->load($type); if ($element === null) { - trigger_error(sprintf('Element %1$s (type: %2$s) could not be created.', $name, $type), E_USER_WARNING); + Wootook_Core_ErrorProfiler::getSingleton() + ->addException(new Wootook_Core_Exception_RuntimeException(sprintf('Element %1$s (type: %2$s) could not be created.', $name, $type))); return $this; } + $element->setForm($this); $this->_elements[$name] = $element; } $this->_elements[$name]->setName($name); diff --git a/application/code/core/Wootook/Core/Form/ElementAbstract.php b/application/code/core/Wootook/Core/Form/ElementAbstract.php index 2ad2713..40d9860 100644 --- a/application/code/core/Wootook/Core/Form/ElementAbstract.php +++ b/application/code/core/Wootook/Core/Form/ElementAbstract.php @@ -17,7 +17,7 @@ abstract class Wootook_Core_Form_ElementAbstract } $this->setName($name); - $this->setParams($params); + $this->setAllParams($params); } abstract public function getType(); diff --git a/application/code/core/Wootook/Core/Form/Validator/Alnum.php b/application/code/core/Wootook/Core/Form/Validator/Alnum.php index 6b6515b..cdacc4f 100644 --- a/application/code/core/Wootook/Core/Form/Validator/Alnum.php +++ b/application/code/core/Wootook/Core/Form/Validator/Alnum.php @@ -3,17 +3,16 @@ 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) + public function validate(Wootook_Core_Form_ElementAbstract $element, $data) { - if ($this->_validate($field, $data)) { - $this->_getSession($field) - ->addError('Field "%s" should only contain alphanumeric characters.', $field->getName()); + if ($this->_validate($element, $data)) { + $this->_getSession($element) + ->addError('Field "%s" should only contain alphanumeric characters.', $element->getName()); return false; } diff --git a/application/code/core/Wootook/Core/Form/Validator/Alpha.php b/application/code/core/Wootook/Core/Form/Validator/Alpha.php index 1e0920b..fb091ce 100644 --- a/application/code/core/Wootook/Core/Form/Validator/Alpha.php +++ b/application/code/core/Wootook/Core/Form/Validator/Alpha.php @@ -3,17 +3,16 @@ 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) + public function validate(Wootook_Core_Form_ElementAbstract $element, $data) { - if ($this->_validate($field, $data)) { - $this->_getSession($field) - ->addError('Field "%s" should only contain alphabetic characters.', $field->getName()); + if ($this->_validate($element, $data)) { + $this->_getSession($element) + ->addError('Field "%s" should only contain alphabetic characters.', $element->getName()); return false; } diff --git a/application/code/core/Wootook/Core/Form/Validator/Email.php b/application/code/core/Wootook/Core/Form/Validator/Email.php index 7dbb232..3ec8e21 100644 --- a/application/code/core/Wootook/Core/Form/Validator/Email.php +++ b/application/code/core/Wootook/Core/Form/Validator/Email.php @@ -8,11 +8,11 @@ class Wootook_Core_Form_Validator_Email parent::__construct('#^[[:alnum:]\._\-]@[[:alnum:]\._\-]\.[a-z]{2,}$#'); } - public function validate(Wootook_Core_Form_FieldAbstract $field, $data) + public function validate(Wootook_Core_Form_ElementAbstract $element, $data) { - if (!$this->_validate($field, $data)) { - $this->_getSession($field) - ->addError('Field "%s" should contain an email.', $field->getName()); + if (!$this->_validate($element, $data)) { + $this->_getSession($element) + ->addError('Field "%s" should contain an email.', $element->getName()); return false; } diff --git a/application/code/core/Wootook/Core/Form/Validator/FormKey.php b/application/code/core/Wootook/Core/Form/Validator/FormKey.php index 0d3c0ff..11f49d0 100644 --- a/application/code/core/Wootook/Core/Form/Validator/FormKey.php +++ b/application/code/core/Wootook/Core/Form/Validator/FormKey.php @@ -3,9 +3,9 @@ class Wootook_Core_Form_Validator_FormKey extends Wootook_Core_Form_ValidatorAbstract { - public function validate(Wootook_Core_Form_FieldAbstract $field, $data) + public function validate(Wootook_Core_Form_ElementAbstract $element, $data) { - $form = $field->getForm(); + $form = $element->getForm(); $session = $form->getSession(); if ($session->getFormKey(false) == $data) { diff --git a/application/code/core/Wootook/Core/Form/Validator/Hex.php b/application/code/core/Wootook/Core/Form/Validator/Hex.php index 9025b70..cbb2913 100644 --- a/application/code/core/Wootook/Core/Form/Validator/Hex.php +++ b/application/code/core/Wootook/Core/Form/Validator/Hex.php @@ -9,11 +9,11 @@ class Wootook_Core_Form_Validator_Hex parent::__construct('#(?:0x)?[^0-9a-f]#i'); } - public function validate(Wootook_Core_Form_FieldAbstract $field, $data) + public function validate(Wootook_Core_Form_ElementAbstract $element, $data) { - if ($this->_validate($field, $data)) { - $this->_getSession($field) - ->addError('Field "%s" should only contain numeric characters.', $field->getName()); + if ($this->_validate($element, $data)) { + $this->_getSession($element) + ->addError('Field "%s" should only contain numeric characters.', $element->getName()); return false; } diff --git a/application/code/core/Wootook/Core/Form/Validator/Host.php b/application/code/core/Wootook/Core/Form/Validator/Host.php index 270124e..4d1f7f5 100644 --- a/application/code/core/Wootook/Core/Form/Validator/Host.php +++ b/application/code/core/Wootook/Core/Form/Validator/Host.php @@ -8,11 +8,11 @@ class Wootook_Core_Form_Validator_Email parent::__construct('#^[[:alnum:]\._\-]\.[a-z]{2,}$#'); } - public function validate(Wootook_Core_Form_FieldAbstract $field, $data) + public function validate(Wootook_Core_Form_ElementAbstract $element, $data) { - if (!$this->_validate($field, $data)) { - $this->_getSession($field) - ->addError('Field "%s" should contain a host name.', $field->getName()); + if (!$this->_validate($element, $data)) { + $this->_getSession($element) + ->addError('Field "%s" should contain a host name.', $element->getName()); return false; } diff --git a/application/code/core/Wootook/Core/Form/Validator/Numeric.php b/application/code/core/Wootook/Core/Form/Validator/Numeric.php index cd2fd56..35f275d 100644 --- a/application/code/core/Wootook/Core/Form/Validator/Numeric.php +++ b/application/code/core/Wootook/Core/Form/Validator/Numeric.php @@ -9,11 +9,11 @@ class Wootook_Core_Form_Validator_Numeric parent::__construct('#[^[:digit:]]#'); } - public function validate(Wootook_Core_Form_FieldAbstract $field, $data) + public function validate(Wootook_Core_Form_ElementAbstract $element, $data) { - if ($this->_validate($field, $data)) { - $this->_getSession($field) - ->addError('Field "%s" should only contain numeric characters.', $field->getName()); + if ($this->_validate($element, $data)) { + $this->_getSession($element) + ->addError('Field "%s" should only contain numeric characters.', $element->getName()); return false; } diff --git a/application/code/core/Wootook/Core/Form/Validator/Regex.php b/application/code/core/Wootook/Core/Form/Validator/Regex.php index a2d76e5..172a787 100644 --- a/application/code/core/Wootook/Core/Form/Validator/Regex.php +++ b/application/code/core/Wootook/Core/Form/Validator/Regex.php @@ -10,18 +10,18 @@ class Wootook_Core_Form_Validator_Regex $this->_expression = $expression; } - public function validate(Wootook_Core_Form_FieldAbstract $field, $data) + public function validate(Wootook_Core_Form_ElementAbstract $element, $data) { - if (!$this->_validate($field, $data)) { - $this->_getSession($field) - ->addError('Field "%s" does not match the validation pattern.', $field->getName()); + if (!$this->_validate($element, $data)) { + $this->_getSession($element) + ->addError('Field "%s" does not match the validation pattern.', $element->getName()); return false; } return true; } - protected function _validate(Wootook_Core_Form_FieldAbstract $field, $data) + protected function _validate(Wootook_Core_Form_ElementAbstract $element, $data) { return preg_match($this->_expression, $data); } diff --git a/application/code/core/Wootook/Core/Form/ValidatorAbstract.php b/application/code/core/Wootook/Core/Form/ValidatorAbstract.php index 5f7239b..d3f6da2 100644 --- a/application/code/core/Wootook/Core/Form/ValidatorAbstract.php +++ b/application/code/core/Wootook/Core/Form/ValidatorAbstract.php @@ -2,14 +2,14 @@ abstract class Wootook_Core_Form_ValidatorAbstract { - abstract public function validate(Wootook_Core_Form_FieldAbstract $field, $data); + abstract public function validate(Wootook_Core_Form_ElementAbstract $element, $data); - protected function _getSession(Wootook_Core_Form_FieldAbstract $field) + protected function _getSession(Wootook_Core_Form_ElementAbstract $element) { - $form = $field->getForm(); + $form = $element->getForm(); if (!$form instanceof Wootook_Core_Form) { return null; } - return $form->getSession(); + return $element->getSession(); } } \ No newline at end of file diff --git a/application/code/core/Wootook/Core/Layout.php b/application/code/core/Wootook/Core/Layout.php index d305f05..93db8e8 100644 --- a/application/code/core/Wootook/Core/Layout.php +++ b/application/code/core/Wootook/Core/Layout.php @@ -70,9 +70,14 @@ class Wootook_Core_Layout $this->setPackage(Wootook::getWebsiteConfig('package')); $this->setTheme(Wootook::getGameConfig('theme')); + $parser = new Wootook_Core_Layout_Parser(); foreach ($fileList as $layoutFile) { try { - $layoutData = include $this->_getLayoutPath($layoutFile); + if (preg_match('#\.php$#', $layoutFile)) { + $layoutData = include $this->_getLayoutPath($layoutFile); + } else { + $layoutData = $parser->parse($this->_getLayoutPath($layoutFile), $this->_getLayoutCachePath($layoutFile), 3600); + } } catch (Wootook_Core_Exception_LayoutException $e) { Wootook_Core_ErrorProfiler::getSingleton()->addException($e); continue; @@ -444,6 +449,22 @@ class Wootook_Core_Layout return $this->_view->render(); } + protected function _getLayoutCachePath($file) + { + $package = $this->getPackage(); + $theme = $this->getTheme(); + $pattern = APPLICATION_PATH . "cache/" . __CLASS__ . "--{$this->getDomain()}-%s-%s-{$file}.cache"; + + if (empty($package)) { + $package = self::DEFAULT_PACKAGE; + } + if (empty($theme)) { + $theme = self::DEFAULT_THEME; + } + + return sprintf($pattern, $package, $theme); + } + protected function _getLayoutPath($file) { $package = $this->getPackage(); diff --git a/application/code/core/Wootook/Core/Layout/Parser.php b/application/code/core/Wootook/Core/Layout/Parser.php new file mode 100644 index 0000000..d555ea9 --- /dev/null +++ b/application/code/core/Wootook/Core/Layout/Parser.php @@ -0,0 +1,132 @@ + 0 && (time() - filemtime($cachePath) > $cacheLifetime)) { + return include $cachePath; + } + + $parsedData = $this->_parse($filename); + + if ($cachePath !== null) { + $parsedData->save($cachePath); + } + + return $parsedData->toArray(); + } + + protected function _parse($filename) + { + $layout = simplexml_load_file($filename); + + if ($layout->getName() !== 'layout') { + return array(); + } + + $result = new Wootook_Core_Config_Adapter_Array(); + foreach ($layout->handle as $handle) { + $name = (string) $handle['name']; + if (empty($name)) { + continue; + } + + $handleNode = new Wootook_Core_Config_Node(array(), $result); + $result->$name = $handleNode; + + if (isset($handle->update) && isset($handle->update[0]['name'])) { + $handleNode->update = (string) $handle->update[0]['name']; + } + + if (isset($handle->block)) { + $this->_parseBlock($handle->block[0], $handleNode); + } + + if (isset($handle->reference)) { + $referenceListNode = new Wootook_Core_Config_Node(array(), $handleNode); + $handleNode->reference = $referenceListNode; + + foreach ($handle->reference as $reference) { + $referenceName = (string) $reference['name']; + if (empty($referenceName)) { + continue; + } + + $referenceNode = new Wootook_Core_Config_Node(array(), $referenceListNode); + $referenceListNode->$referenceName = $referenceNode; + + $this->_parseBlockBody($reference, $referenceNode); + } + } + } + + return $result; + } + + protected function _parseBlock(SimpleXMLElement $handle, Wootook_Core_Config_Node $blockNode) + { + foreach ($handle->attributes() as $attributeName => $attributeValue) { + $blockNode->$attributeName = (string) $attributeValue; + } + + $this->_parseBlockBody($handle, $blockNode); + } + + protected function _parseBlockBody(SimpleXMLElement $handle, Wootook_Core_Config_Node $blockNode) + { + if (isset($handle->block)) { + $childrenNode = new Wootook_Core_Config_Node(array(), $blockNode); + $blockNode->children = $childrenNode; + + foreach ($handle->block as $block) { + $blockName = (string) $block['name']; + if (empty($blockName)) { + continue; + } + + $childNode = new Wootook_Core_Config_Node(array(), $childrenNode); + $childrenNode->$blockName = $childNode; + + $this->_parseBlock($block, $childNode); + } + } + + if (isset($handle->action)) { + $actionListNode = new Wootook_Core_Config_Node(array(), $blockNode); + $blockNode->actions = $actionListNode; + + foreach ($handle->action as $action) { + $methodName = (string) $action['method']; + if (empty($methodName)) { + continue; + } + + $actionNode = new Wootook_Core_Config_Node(array( + 'method' => $methodName, + 'params' => array() + ), $actionListNode); + + $actionListNode[] = $actionNode; + + if (isset($action->params)) { + $paramsNode = $actionNode->params; + + foreach ($action->params[0]->param as $param) { + $paramName = (string) $param['name']; + if (empty($paramName)) { + continue; + } + + $paramsNode->$paramName = (string) $param; + } + } + } + } + } +} diff --git a/application/code/core/Wootook/Database.php b/application/code/core/Wootook/Database.php index 0086012..6dcd646 100644 --- a/application/code/core/Wootook/Database.php +++ b/application/code/core/Wootook/Database.php @@ -77,7 +77,7 @@ class Wootook_Database $dsn = "mysql:dbname={$params->database};host={$params->hostname}"; if (is_numeric($params->port)) { - $dsn .= ";port={$params->database}"; + $dsn .= ";port={$params->port}"; } $event = Wootook::dispatchEvent('database.prepare-options', array( diff --git a/application/code/core/Wootook/Empire/Model/Galaxy/Position.php b/application/code/core/Wootook/Empire/Model/Galaxy/Position.php index 2989b1a..8ca4d62 100644 --- a/application/code/core/Wootook/Empire/Model/Galaxy/Position.php +++ b/application/code/core/Wootook/Empire/Model/Galaxy/Position.php @@ -8,25 +8,4 @@ class Wootook_Empire_Model_Galaxy_Position $this->_tableName = 'galaxy'; $this->_idFieldNames = array('id_planet'); } - - static function initPlanetListerner($eventData) - { - if (!isset($eventData['planet'])) { - return; - } - - $planet = $eventData['planet']; - if (!$planet->isPlanet()) { - return; - } - - $galaxy = new self(); - $galaxy - ->setData('galaxy', $planet->getGalaxy()) - ->setData('system', $planet->getSystem()) - ->setData('planet', $planet->getPosition()) - ->setData('id_planet', $planet->getId()) - ->save() - ; - } } \ No newline at end of file diff --git a/application/code/core/Wootook/Empire/Model/User.php b/application/code/core/Wootook/Empire/Model/User.php index e66482b..eebf8c4 100644 --- a/application/code/core/Wootook/Empire/Model/User.php +++ b/application/code/core/Wootook/Empire/Model/User.php @@ -376,6 +376,17 @@ class Wootook_Empire_Model_User $planet->save(); + if ($planet->isPlanet()) { + $galaxy = new Wootook_Empire_Model_Galaxy_Position(); + $galaxy + ->setData('galaxy', $planet->getGalaxy()) + ->setData('system', $planet->getSystem()) + ->setData('planet', $planet->getPosition()) + ->setData('id_planet', $planet->getId()) + ->save() + ; + } + Wootook::dispatchEvent('planet.init', array( 'planet' => $planet, 'user' => $this diff --git a/application/config/local.php.sample b/application/config/local.php.sample index 812474e..94fa83f 100644 --- a/application/config/local.php.sample +++ b/application/config/local.php.sample @@ -70,15 +70,15 @@ 'episode' => 'default', ), 'core' => array( - 'use_large_numbers' => (bool) $request->getPost('use_large_numbers') + 'use_large_numbers' => true ), 'universe' => array( - 'galaxies' => $request->getPost('galaxies'), - 'systems' => $request->getPost('systems'), - 'positions' => $request->getPost('positions') + 'galaxies' => 3, + 'systems' => 100, + 'positions' => 15 ), 'combat' => array( - 'allow_spy_drone_attacks' => (bool) $request->getPost('allow_spy_drone_attacks') + 'allow_spy_drone_attacks' => true ) ), ) diff --git a/application/config/system.php b/application/config/system.php index 5df2e9e..f223774 100644 --- a/application/config/system.php +++ b/application/config/system.php @@ -47,46 +47,15 @@ ), ), 'frontend' => array( - 'web' => array( - 'url' => array( - 'base' => null, - 'skin' => null, - 'js' => null, - 'css' => null, - ) - ), - 'system' => array( - 'path' => array( - 'base' => null, - 'skin' => null, - 'js' => null, - 'css' => null, - ) - ), 'layout' => array( - 'page' => 'page.php', + 'page' => 'page.xml', + 'user' => 'user.xml', 'empire' => 'empire.php' ), ), 'backend' => array( - 'web' => array( - 'url' => array( - 'base' => null, - 'skin' => null, - 'js' => null, - 'css' => null, - ) - ), - 'system' => array( - 'path' => array( - 'base' => null, - 'skin' => null, - 'js' => null, - 'css' => null, - ) - ), 'layout' => array( - 'page' => 'page.php', + 'page' => 'page.xml', 'admin' => 'admin.php' ), ) diff --git a/application/design/backend/base/default/layouts/page.php b/application/design/backend/base/default/layouts/page.php deleted file mode 100644 index fcc31d8..0000000 --- a/application/design/backend/base/default/layouts/page.php +++ /dev/null @@ -1,183 +0,0 @@ - array( - 'update' => 'default' - ), - - '2columns-left' => array( - 'update' => 'default', - 'template' => 'page/2columns-left.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'left' => array( - 'type' => 'core/concat' - ) - ) - ) - ) - ), - - '2columns-right' => array( - 'update' => 'default', - 'template' => 'page/2columns-right.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'right' => array( - 'type' => 'core/concat' - ), - ) - ) - ) - ), - - '3columns' => array( - 'update' => 'default', - 'template' => 'page/3columns.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'left' => array( - 'type' => 'core/concat' - ), - 'right' => array( - 'type' => 'core/concat' - ), - ) - ) - ) - ), - - 'default' => array( - 'type' => 'core/html.page', - 'template' => 'page/1column.phtml', - 'children' => array( - 'head' => array( - 'type' => 'core/html.head', - 'template' => 'page/html/head.phtml', - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/base.css' - ) - ), - array( - 'method' => 'addJs', - 'params' => array( - 'script' => 'scripts/jquery/jquery-1.6.4.js' - ) - ) - ) - ), - 'header' => array( - 'type' => 'core/concat' - ), - 'footer' => array( - 'type' => 'core/template', - 'template' => 'page/html/footer.phtml' - ), - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'ajax' => array( - 'type' => 'core/html.page', - 'template' => 'page/empty.phtml', - 'children' => array( - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'empty' => array( - 'type' => 'core/html.page', - 'template' => 'page/empty.phtml', - 'children' => array( - 'head' => array( - 'type' => 'core/html.head', - 'template' => 'page/html/head.phtml' - ), - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'message' => array( - 'update' => 'default', - 'reference' => array( - 'content' => array( - 'children' => array( - 'message' => array( - 'type' => 'core/template', - 'template' => 'page/html/message.phtml' - ), - ) - ) - ) - ), - - 'login' => array( - 'update' => '1column', - 'reference' => array( - 'content' => array( - 'children' => array( - 'login' => array( - 'type' => 'core/template', - 'template' => 'user/login.phtml' - ), - ) - ), - 'head' => array( - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/styles.css' - ) - ), - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/about.css' - ) - ) - ) - ) - ) - ), - - 'registration' => array( - 'update' => '1column', - 'reference' => array( - 'content' => array( - 'children' => array( - 'registration' => array( - 'type' => 'core/template', - 'template' => 'user/registration.phtml' - ), - ) - ), - 'head' => array( - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/styles.css' - ) - ), - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/about.css' - ) - ) - ) - ) - ) - ) - ); diff --git a/application/design/backend/base/default/layouts/page.xml b/application/design/backend/base/default/layouts/page.xml new file mode 100644 index 0000000..607a517 --- /dev/null +++ b/application/design/backend/base/default/layouts/page.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + page/2columns-left.phtml + + + + + + + + + + + + page/2columns-right.phtml + + + + + + + + + + + + page/3columns.phtml + + + + + + + + + + + + css/base.css + + + + + scripts/jquery/jquery-1.6.4.js + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/design/frontend/base/default/layouts/page.php b/application/design/frontend/base/default/layouts/page.php deleted file mode 100644 index 9946e14..0000000 --- a/application/design/frontend/base/default/layouts/page.php +++ /dev/null @@ -1,195 +0,0 @@ - array( - 'update' => 'default' - ), - - '2columns-left' => array( - 'update' => 'default', - 'template' => 'page/2columns-left.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'left' => array( - 'type' => 'core/concat' - ) - ) - ) - ) - ), - - '2columns-right' => array( - 'update' => 'default', - 'template' => 'page/2columns-right.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'right' => array( - 'type' => 'core/concat' - ), - ) - ) - ) - ), - - '3columns' => array( - 'update' => 'default', - 'template' => 'page/3columns.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'left' => array( - 'type' => 'core/concat' - ), - 'right' => array( - 'type' => 'core/concat' - ), - ) - ) - ) - ), - - 'default' => array( - 'type' => 'core/html.page', - 'template' => 'page/1column.phtml', - 'children' => array( - 'head' => array( - 'type' => 'core/html.head', - 'template' => 'page/html/head.phtml', - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/default.css' - ) - ), - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/formate.css' - ) - ), - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/base.css' - ) - ), - array( - 'method' => 'addJs', - 'params' => array( - 'script' => 'scripts/jquery/jquery-1.6.4.js' - ) - ) - ) - ), - 'header' => array( - 'type' => 'core/concat' - ), - 'footer' => array( - 'type' => 'core/template', - 'template' => 'page/html/footer.phtml' - ), - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'ajax' => array( - 'type' => 'core/html.page', - 'template' => 'page/empty.phtml', - 'children' => array( - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'empty' => array( - 'type' => 'core/html.page', - 'template' => 'page/empty.phtml', - 'children' => array( - 'head' => array( - 'type' => 'core/html.head', - 'template' => 'page/html/head.phtml' - ), - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'message' => array( - 'update' => 'default', - 'reference' => array( - 'content' => array( - 'children' => array( - 'message' => array( - 'type' => 'core/template', - 'template' => 'page/html/message.phtml' - ), - ) - ) - ) - ), - - 'login' => array( - 'update' => '1column', - 'reference' => array( - 'content' => array( - 'children' => array( - 'login' => array( - 'type' => 'core/template', - 'template' => 'user/login.phtml' - ), - ) - ), - 'head' => array( - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/styles.css' - ) - ), - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/about.css' - ) - ) - ) - ) - ) - ), - - 'registration' => array( - 'update' => '1column', - 'reference' => array( - 'content' => array( - 'children' => array( - 'registration' => array( - 'type' => 'core/template', - 'template' => 'user/registration.phtml' - ), - ) - ), - 'head' => array( - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/styles.css' - ) - ), - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/about.css' - ) - ) - ) - ) - ) - ) - ); diff --git a/application/design/frontend/base/default/layouts/page.xml b/application/design/frontend/base/default/layouts/page.xml new file mode 100644 index 0000000..ec1ea8e --- /dev/null +++ b/application/design/frontend/base/default/layouts/page.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + page/2columns-left.phtml + + + + + + + + + + + + page/2columns-right.phtml + + + + + + + + + + + + page/3columns.phtml + + + + + + + + + + + + css/deprecated/default.css + + + + + css/deprecated/formate.css + + + + + css/base.css + + + + + scripts/jquery/jquery-1.6.4.js + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/design/frontend/base/default/layouts/user.xml b/application/design/frontend/base/default/layouts/user.xml new file mode 100644 index 0000000..43521f8 --- /dev/null +++ b/application/design/frontend/base/default/layouts/user.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + css/deprecated/styles.css + + + + + css/deprecated/about.css + + + + + + + + + + + + + + + + css/deprecated/styles.css + + + + + css/deprecated/about.css + + + + + \ No newline at end of file diff --git a/application/design/install/base/default/layouts/install.php b/application/design/install/base/default/layouts/install.php new file mode 100644 index 0000000..6053560 --- /dev/null +++ b/application/design/install/base/default/layouts/install.php @@ -0,0 +1,154 @@ + array( + 'update' => '2columns-left', + 'reference' => array( + 'content' => 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' => 0 + ) + ) + ) + ) + ) + ), + + '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' => 1 + ) + ) + ) + ) + ) + ), + + 'install.step.database' => array( + 'update' => 'install', + 'reference' => array( + 'content' => array( + 'children' => array( + 'overview' => array( + 'type' => 'core/template', + 'template' => 'step/database.phtml' + ), + ) + ), + 'status' => array( + 'actions' => array( + array( + 'method' => 'setData', + 'params' => array( + 'key' => 'step', + 'value' => 2 + ) + ) + ) + ) + ) + ), + + 'install.step.universe' => array( + 'update' => 'install', + 'reference' => array( + 'content' => array( + 'children' => array( + 'overview' => array( + 'type' => 'core/template', + 'template' => 'step/universe.phtml' + ), + ) + ), + 'status' => array( + 'actions' => array( + array( + 'method' => 'setData', + 'params' => array( + 'key' => 'step', + 'value' => 3 + ) + ) + ) + ) + ) + ), + + 'install.step.profile' => array( + 'update' => 'install', + 'reference' => array( + 'content' => array( + 'children' => array( + 'overview' => array( + 'type' => 'core/template', + 'template' => 'step/profile.phtml' + ), + ) + ), + 'status' => array( + 'actions' => array( + array( + 'method' => 'setData', + 'params' => array( + 'key' => 'step', + 'value' => 4 + ) + ) + ) + ) + ) + ), + + 'install.summary' => array( + 'update' => 'install', + 'reference' => array( + 'content' => array( + 'children' => array( + 'overview' => array( + 'type' => 'core/template', + 'template' => 'summary.phtml' + ), + ) + ) + ) + ), + ); diff --git a/application/design/install/base/default/layouts/page.php b/application/design/install/base/default/layouts/page.php deleted file mode 100644 index 4da6f85..0000000 --- a/application/design/install/base/default/layouts/page.php +++ /dev/null @@ -1,337 +0,0 @@ - array( - 'update' => 'default' - ), - - '2columns-left' => array( - 'update' => 'default', - 'template' => 'page/2columns-left.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'left' => array( - 'type' => 'core/concat' - ) - ) - ) - ) - ), - - '2columns-right' => array( - 'update' => 'default', - 'template' => 'page/2columns-right.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'right' => array( - 'type' => 'core/concat' - ), - ) - ) - ) - ), - - '3columns' => array( - 'update' => 'default', - 'template' => 'page/3columns.phtml', - 'reference' => array( - 'root' => array( - 'children' => array( - 'left' => array( - 'type' => 'core/concat' - ), - 'right' => array( - 'type' => 'core/concat' - ), - ) - ) - ) - ), - - 'default' => array( - 'type' => 'core/html.page', - 'template' => 'page/1column.phtml', - 'children' => array( - 'head' => array( - 'type' => 'core/html.head', - 'template' => 'page/html/head.phtml', - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/base.css' - ) - ), - array( - 'method' => 'addJs', - 'params' => array( - 'script' => 'scripts/jquery/jquery-1.6.4.js' - ) - ) - ) - ), - 'header' => array( - 'type' => 'core/template', - 'template' => 'page/html/header.phtml' - ), - 'footer' => array( - 'type' => 'core/template', - 'template' => 'page/html/footer.phtml' - ), - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'ajax' => array( - 'type' => 'core/html.page', - 'template' => 'page/empty.phtml', - 'children' => array( - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'empty' => array( - 'type' => 'core/html.page', - 'template' => 'page/empty.phtml', - 'children' => array( - 'head' => array( - 'type' => 'core/html.head', - 'template' => 'page/html/head.phtml' - ), - 'content' => array( - 'type' => 'core/concat' - ) - ) - ), - - 'message' => array( - 'update' => 'default', - 'reference' => array( - 'content' => array( - 'children' => array( - 'message' => array( - 'type' => 'core/template', - 'template' => 'page/html/message.phtml' - ), - ) - ) - ) - ), - - 'login' => array( - 'update' => '1column', - 'reference' => array( - 'content' => array( - 'children' => array( - 'login' => array( - 'type' => 'core/template', - 'template' => 'user/login.phtml' - ), - ) - ), - 'head' => array( - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/styles.css' - ) - ), - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/about.css' - ) - ) - ) - ) - ) - ), - - 'registration' => array( - 'update' => '1column', - 'reference' => array( - 'content' => array( - 'children' => array( - 'registration' => array( - 'type' => 'core/template', - 'template' => 'user/registration.phtml' - ), - ) - ), - 'head' => array( - 'actions' => array( - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/styles.css' - ) - ), - array( - 'method' => 'addCss', - 'params' => array( - 'stylesheet' => 'css/deprecated/about.css' - ) - ) - ) - ) - ) - ), - - 'install' => array( - 'update' => '2columns-left', - 'reference' => array( - 'content' => 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' => 0 - ) - ) - ) - ) - ) - ), - - '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' => 1 - ) - ) - ) - ) - ) - ), - - 'install.step.database' => array( - 'update' => 'install', - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'step/database.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 2 - ) - ) - ) - ) - ) - ), - - 'install.step.universe' => array( - 'update' => 'install', - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'step/universe.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 3 - ) - ) - ) - ) - ) - ), - - 'install.step.profile' => array( - 'update' => 'install', - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'step/profile.phtml' - ), - ) - ), - 'status' => array( - 'actions' => array( - array( - 'method' => 'setData', - 'params' => array( - 'key' => 'step', - 'value' => 4 - ) - ) - ) - ) - ) - ), - - 'install.summary' => array( - 'update' => 'install', - 'reference' => array( - 'content' => array( - 'children' => array( - 'overview' => array( - 'type' => 'core/template', - 'template' => 'summary.phtml' - ), - ) - ) - ) - ), - ); diff --git a/application/design/install/base/default/layouts/page.xml b/application/design/install/base/default/layouts/page.xml new file mode 100644 index 0000000..ec1ea8e --- /dev/null +++ b/application/design/install/base/default/layouts/page.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + page/2columns-left.phtml + + + + + + + + + + + + page/2columns-right.phtml + + + + + + + + + + + + page/3columns.phtml + + + + + + + + + + + + css/deprecated/default.css + + + + + css/deprecated/formate.css + + + + + css/base.css + + + + + scripts/jquery/jquery-1.6.4.js + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/install/index.php b/install/index.php index bfbb083..5a38a40 100644 --- a/install/index.php +++ b/install/index.php @@ -137,7 +137,8 @@ $configRewrites = array( 'package' => 'default', 'theme' => 'default', 'layout' => array( - 'page' => 'page.php' + 'page' => 'page.xml', + 'install' => 'install.php' ), 'storyline' => array( 'universe' => 'legacies', @@ -147,8 +148,11 @@ $configRewrites = array( ); $config = unserialize($session->getData('config')); -$config = array_merge_recursive($config, $configRewrites); -Wootook::loadConfig($config); +if (is_array($config)) { + Wootook::loadConfig(array_merge_recursive($config, $configRewrites)); +} else { + Wootook::loadConfig($configRewrites); +} $layout = new Wootook_Core_Layout('install'); @@ -229,10 +233,6 @@ case 'install': 'allow_spy_drone_attacks' => true ) ), - 'layout' => array( - 'page' => 'page.php', - 'empire' => 'empire.php' - ), 'locales' => array( 'fr' => 'fr_FR', 'fr_FR' => 'fr_FR',