Configuration & Layout architecture updates
Fixed production bug Fixed styles Updated Action Controller Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
dfa3dfb086
commit
66805034a6
815 changed files with 4020 additions and 1138 deletions
93
admin.php
Normal file
93
admin.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.wootook.com/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing Wootook.
|
||||
*
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -113,4 +113,3 @@ require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
|||
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ if ($user->getData('ally_id') == 0) {
|
|||
/*
|
||||
* Creation of the alliance
|
||||
*/
|
||||
if ($yes == 1 && isset($request->isPost())) {
|
||||
if ($yes == 1 && $request->isPost()) {
|
||||
|
||||
if ($request->getPost('atag') !== null) {
|
||||
message($lang['have_not_tag'], $lang['make_alliance']);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHP_VERSION_ID')) {
|
||||
$version = explode('.',PHP_VERSION);
|
||||
define('PHP_VERSION_ID', (((int)$version[0]) * 10000 + ((int)$version[1]) * 100 + ((int)$version[2])));
|
||||
unset($version);
|
||||
}
|
||||
|
||||
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'))) {
|
||||
|
|
@ -72,15 +78,28 @@ function __autoload($class) {
|
|||
include_once str_replace('_', '/', $class) . '.php';
|
||||
}
|
||||
|
||||
if (defined('IN_ADMIN')) {
|
||||
$website = new Wootook_Core_Model_Website();
|
||||
$website->setId(0)->setData('code', 'admin');
|
||||
Wootook::addWebsite($website);
|
||||
Wootook::setDefaultWebsite($website);
|
||||
|
||||
$game = new Wootook_Core_Model_Game();
|
||||
$game->setId(0)->setData('code', 'admin')->setData('website_id', $website->getId());
|
||||
Wootook::addGame($game);
|
||||
Wootook::setDefaultGame($game);
|
||||
}
|
||||
|
||||
include ROOT_PATH . 'includes/constants.php';
|
||||
|
||||
Wootook_Core_Time::init();
|
||||
Wootook_Core_ErrorProfiler::register();
|
||||
Wootook_Core_Model_Config_Events::registerEvents();
|
||||
|
||||
if (!defined('IN_INSTALL') && 0 === filesize(ROOT_PATH . 'config.php')) {
|
||||
if (!defined('IN_INSTALL') && 0 === filesize(APPLICATION_PATH . 'config' . DIRECTORY_SEPARATOR . 'local.php')) {
|
||||
header('HTTP/1.1 307 Temporary Redirect');
|
||||
header('Location: install/');
|
||||
$url = Wootook::getUrl('install/');
|
||||
header("Location: $url");
|
||||
die();
|
||||
}
|
||||
|
||||
|
|
@ -98,22 +117,17 @@ include(ROOT_PATH . 'language/' . DEFAULT_LANG . '/lang_info.cfg');
|
|||
include(ROOT_PATH . 'includes/vars.' . PHPEXT);
|
||||
include(ROOT_PATH . 'includes/strings.' . PHPEXT);
|
||||
|
||||
if (!defined('IN_INSTALL')) {
|
||||
|
||||
$cookieName = Wootook::getGameConfig('web/cookie/name');
|
||||
if ($cookieName !== null) {
|
||||
Wootook_Empire_Model_User::setCookieName($cookieName);
|
||||
}
|
||||
$user = Wootook_Empire_Model_User::getSingleton();
|
||||
|
||||
if (!defined('DISABLE_IDENTITY_CHECK')) {
|
||||
if (($user === null || !$user->getId())) {
|
||||
header('Location: login.php');
|
||||
$url = Wootook::getUrl('login.php');
|
||||
header("Location: $url");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (Wootook::getGameConfig('game/general/active') && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) {
|
||||
$layout = new Wootook_Core_Layout();
|
||||
$layout = new Wootook_Core_Layout(Wootook_Core_Layout::DOMAIN_FRONTEND);
|
||||
$layout->load('message');
|
||||
|
||||
$block = $layout->getBlock('message');
|
||||
|
|
@ -147,4 +161,3 @@ if (!defined('IN_INSTALL')) {
|
|||
));
|
||||
$planet->save();
|
||||
}
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@ CREATE TABLE IF NOT EXISTS {$this->getTableName('planets')} (
|
|||
`b_building_id` TEXT NOT NULL,
|
||||
`b_tech` SMALLINT UNSIGNED NOT NULL,
|
||||
`b_tech_id` SMALLINT UNSIGNED NOT NULL,
|
||||
`b_hangar` SMALLINT UNSIGNED NOT NULL,
|
||||
`b_hangar` INT UNSIGNED NOT NULL,
|
||||
`b_hangar_id` TEXT NOT NULL,
|
||||
`b_hangar_plus` SMALLINT UNSIGNED NOT NULL,
|
||||
`image` VARCHAR(50) NOT NULL DEFAULT 'normaltempplanet01',
|
||||
|
|
|
|||
|
|
@ -55,68 +55,73 @@ class Wootook
|
|||
*
|
||||
* @var Legacies_Core_Controller_Request_Http
|
||||
*/
|
||||
protected static $_request = null;
|
||||
private static $_request = null;
|
||||
|
||||
/**
|
||||
* HTTP response management object
|
||||
*
|
||||
* @var Legacies_Core_Controller_Response
|
||||
*/
|
||||
protected static $_response = null;
|
||||
private static $_response = null;
|
||||
|
||||
/**
|
||||
* The current timestamp
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected static $_now = null;
|
||||
private static $_now = null;
|
||||
|
||||
/**
|
||||
* Default locale identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $_defaultLocale = 'fr_FR';
|
||||
private static $_defaultLocale = 'fr_FR';
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @var Wootook_Core_Config_Adapter_Abstract
|
||||
*/
|
||||
protected static $_config = null;
|
||||
private static $_config = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @var Wootook_Core_Config_Adapter_Abstract
|
||||
*/
|
||||
protected static $_globalConfig = null;
|
||||
private static $_globalConfig = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @var array
|
||||
*/
|
||||
protected static $_websiteConfigs = array();
|
||||
private static $_websiteConfigs = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @var array
|
||||
*/
|
||||
protected static $_gameConfigs = array();
|
||||
private static $_gameConfigs = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @var array
|
||||
*/
|
||||
protected static $_ignoreDatabaseConfig = false;
|
||||
private static $_ignoreDatabaseConfig = false;
|
||||
|
||||
protected static $_websitesById = array();
|
||||
protected static $_websitesByCode = array();
|
||||
protected static $_gamesById = array();
|
||||
protected static $_gamesByCode = array();
|
||||
private static $_defaultWebsite = null;
|
||||
private static $_defaultGame = null;
|
||||
|
||||
private static $_websitesById = array();
|
||||
private static $_websitesByCode = array();
|
||||
private static $_gamesById = array();
|
||||
private static $_gamesByCode = array();
|
||||
|
||||
public static $isInstalled = true;
|
||||
|
||||
/**
|
||||
* Registers an event listener to be called later in the application.
|
||||
|
|
@ -329,13 +334,25 @@ class Wootook
|
|||
|
||||
self::$_config = new Wootook_Core_Config_Adapter_Array();
|
||||
try {
|
||||
if (!is_array($filename)) {
|
||||
self::$_config->load(APPLICATION_PATH . 'config' . DIRECTORY_SEPARATOR . 'system.php');
|
||||
|
||||
if ($filename === null) {
|
||||
$filename = ROOT_PATH . 'config.php';
|
||||
$filename = APPLICATION_PATH . 'config' . DIRECTORY_SEPARATOR . 'local.php';
|
||||
}
|
||||
self::$_config->load($filename);
|
||||
|
||||
if (is_string($filename)) {
|
||||
if (!self::$isInstalled) {
|
||||
throw new Wootook_Core_Exception_DataAccessException();
|
||||
}
|
||||
$localConfig = new Wootook_Core_Config_Adapter_Array($filename);
|
||||
self::$_config->merge($localConfig);
|
||||
} else if (is_array($filename)) {
|
||||
$localConfig = new Wootook_Core_Config_Node($filename);
|
||||
self::$_config->merge($localConfig);
|
||||
} else if ($filename instanceof Wootook_Core_Config_Node) {
|
||||
self::$_config->merge($filename);
|
||||
} else {
|
||||
self::$_config->setData($filename);
|
||||
throw new Wootook_Core_Exception_DataAccessException();
|
||||
}
|
||||
} catch (Wootook_Core_Exception_DataAccessException $e) {
|
||||
self::$_globalConfig = new Wootook_Core_Config_Node(array(), self::$_config);
|
||||
|
|
@ -353,7 +370,7 @@ class Wootook
|
|||
return self::$_config;
|
||||
}
|
||||
|
||||
protected static function _appendDatabaseConfig(Wootook_Core_Config_Node $config, $type = 'global', $model = null)
|
||||
private static function _appendDatabaseConfig(Wootook_Core_Config_Node $config, $type = 'global', $model = null)
|
||||
{
|
||||
if (self::$_ignoreDatabaseConfig) {
|
||||
return $config;
|
||||
|
|
@ -462,25 +479,67 @@ class Wootook
|
|||
}
|
||||
}
|
||||
|
||||
public static function setWebsite($websiteId, $website)
|
||||
public static function addWebsite(Wootook_Core_Model_Website $website)
|
||||
{
|
||||
$websiteId = $website->getId();
|
||||
$websiteKey = $website->getData('code');
|
||||
self::$_websitesById[$websiteId] = $website;
|
||||
self::$_websitesByCode[$websiteKey] = $website;
|
||||
}
|
||||
|
||||
public static function setGame($gameId, $game)
|
||||
public static function addGame(Wootook_Core_Model_Game $game)
|
||||
{
|
||||
$gameId = $game->getId();
|
||||
$gameKey = $game->getData('code');
|
||||
self::$_gamesById[$gameId] = $game;
|
||||
self::$_gamesByCode[$gameKey] = $game;
|
||||
}
|
||||
|
||||
protected static function _initWebsiteConfig($websiteId)
|
||||
public static function setDefaultWebsite(Wootook_Core_Model_Website $website)
|
||||
{
|
||||
self::$_defaultWebsite = $website;
|
||||
}
|
||||
|
||||
public static function getDefaultWebsite()
|
||||
{
|
||||
if (self::$_defaultWebsite === null) {
|
||||
self::$_defaultWebsite = new Wootook_Core_Model_Website();
|
||||
self::$_defaultWebsite->setId(1)->setData('code', Wootook_Core_Model_Website::DEFAULT_CODE);
|
||||
}
|
||||
return self::$_defaultWebsite;
|
||||
}
|
||||
|
||||
public static function getDefaultGame()
|
||||
{
|
||||
if (self::$_defaultGame === null) {
|
||||
self::$_defaultGame = new Wootook_Core_Model_Game();
|
||||
self::$_defaultGame->setId(1)->setData('code', Wootook_Core_Model_Game::DEFAULT_CODE);
|
||||
}
|
||||
return self::$_defaultGame;
|
||||
}
|
||||
|
||||
public static function setDefaultGame(Wootook_Core_Model_Game $game)
|
||||
{
|
||||
self::$_defaultGame = $game;
|
||||
}
|
||||
|
||||
private static function _initWebsiteConfig($websiteId)
|
||||
{
|
||||
if (self::$_config === null) {
|
||||
self::loadConfig();
|
||||
}
|
||||
if (!self::$isInstalled) {
|
||||
if (isset(self::$_config['default'])) {
|
||||
self::$_websiteConfigs[Wootook_Core_Model_Website::DEFAULT_CODE] = clone self::$_config['default'];
|
||||
} else {
|
||||
self::$_websiteConfigs[Wootook_Core_Model_Website::DEFAULT_CODE] = new Wootook_Core_Config_Node(array(), self::$_config);
|
||||
}
|
||||
if (isset(self::$_config['install'])) {
|
||||
self::$_websiteConfigs[Wootook_Core_Model_Website::DEFAULT_CODE]->merge(self::$_config['install']);
|
||||
}
|
||||
|
||||
return self::$_websiteConfigs[Wootook_Core_Model_Website::DEFAULT_CODE];
|
||||
}
|
||||
|
||||
try {
|
||||
$website = self::getWebsite($websiteId);
|
||||
|
|
@ -493,8 +552,10 @@ class Wootook
|
|||
|
||||
if (!isset(self::$_websiteConfigs[$websiteKey])) {
|
||||
self::$_websiteConfigs[$websiteKey] = clone self::$_config['default'];
|
||||
if (isset(self::$_config['frontend'])) {
|
||||
if ($websiteId != 0 && isset(self::$_config['frontend'])) {
|
||||
self::$_websiteConfigs[$websiteKey]->merge(self::$_config['frontend']);
|
||||
} else if ($websiteId == 0 && isset(self::$_config['backend'])) {
|
||||
self::$_websiteConfigs[$websiteKey]->merge(self::$_config['backend']);
|
||||
}
|
||||
|
||||
$websiteConfig = self::$_config->getConfig("website/{$websiteKey}");
|
||||
|
|
@ -508,11 +569,23 @@ class Wootook
|
|||
return self::$_websiteConfigs[$websiteKey];
|
||||
}
|
||||
|
||||
protected static function _initGameConfig($gameId)
|
||||
private static function _initGameConfig($gameId)
|
||||
{
|
||||
if (self::$_config === null) {
|
||||
self::loadConfig();
|
||||
}
|
||||
if (!self::$isInstalled) {
|
||||
if (isset(self::$_config['default'])) {
|
||||
self::$_gameConfigs[Wootook_Core_Model_Game::DEFAULT_CODE] = clone self::$_config['default'];
|
||||
} else {
|
||||
self::$_gameConfigs[Wootook_Core_Model_Game::DEFAULT_CODE] = new Wootook_Core_Config_Node(array(), self::$_config);
|
||||
}
|
||||
if (isset(self::$_config['install'])) {
|
||||
self::$_gameConfigs[Wootook_Core_Model_Game::DEFAULT_CODE]->merge(self::$_config['install']);
|
||||
}
|
||||
|
||||
return self::$_gameConfigs[Wootook_Core_Model_Game::DEFAULT_CODE];
|
||||
}
|
||||
|
||||
try {
|
||||
$game = self::getGame($gameId);
|
||||
|
|
@ -562,7 +635,8 @@ class Wootook
|
|||
}
|
||||
|
||||
if ($websiteKey === null) {
|
||||
$websiteKey = Wootook_Core_Model_Website::DEFAULT_CODE;
|
||||
//$websiteKey = Wootook_Core_Model_Website::DEFAULT_CODE;
|
||||
$websiteKey = self::getDefaultWebsite()->getData('code');
|
||||
}
|
||||
|
||||
$config = self::_initWebsiteConfig($websiteKey);
|
||||
|
|
@ -583,7 +657,8 @@ class Wootook
|
|||
}
|
||||
|
||||
if ($gameKey === null) {
|
||||
$gameKey = Wootook_Core_Model_Game::DEFAULT_CODE;
|
||||
//$gameKey = Wootook_Core_Model_Game::DEFAULT_CODE;
|
||||
$gameKey = self::getDefaultGame()->getData('code');
|
||||
}
|
||||
|
||||
$config = self::_initGameConfig($gameKey);
|
||||
|
|
@ -631,14 +706,28 @@ class Wootook
|
|||
return true;
|
||||
}
|
||||
|
||||
public static function getBaseUrl()
|
||||
public static function getBaseUrl($domain = 'base')
|
||||
{
|
||||
return self::getConfig('web/base_url');
|
||||
$urlConfig = self::getGameConfig('web/url');
|
||||
if (!$urlConfig instanceof Wootook_Core_Config_Node) {
|
||||
return null;
|
||||
}
|
||||
if (!is_string($domain) || !isset($urlConfig->$domain)) {
|
||||
return $urlConfig->base;
|
||||
}
|
||||
return $urlConfig->$domain;
|
||||
}
|
||||
|
||||
public static function getSkinUrl($package, $theme, $uri, Array $params = array())
|
||||
public static function getBasePath($domain = 'base')
|
||||
{
|
||||
return self::getUrl("skin/{$package}/{$theme}/{$uri}", $params);
|
||||
$pathConfig = self::getGameConfig('system/path');
|
||||
if (!$pathConfig instanceof Wootook_Core_Config_Node) {
|
||||
return null;
|
||||
}
|
||||
if (!is_string($domain) || !isset($pathConfig->$domain)) {
|
||||
return $pathConfig->base;
|
||||
}
|
||||
return $pathConfig->$domain;
|
||||
}
|
||||
|
||||
public static function getUrl($uri, Array $params = array())
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Admin_Controller_Front_Action
|
||||
extends Wootook_Core_Controller_Front_Action
|
||||
{
|
||||
protected function _initLayout()
|
||||
{
|
||||
$layout = new Wootook_Core_Layout(Wootook_Core_Layout::DOMAIN_BACKEND);
|
||||
$layout->registerBlockNamespace('admin', 'Wootook_Admin_Block_', 'Wootook/Admin/Block');
|
||||
|
||||
return $layout;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Admin_IndexController
|
||||
extends Wootook_Admin_Controller_Front_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_forward('index', 'user');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Admin_UserController
|
||||
extends Wootook_Admin_Controller_Front_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_forward('grid');
|
||||
}
|
||||
|
||||
public function gridAction()
|
||||
{
|
||||
$this->loadLayout();
|
||||
$this->renderLayout();
|
||||
}
|
||||
|
||||
public function newAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function editAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function saveMassAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
}
|
||||
|
||||
public function deleteMassAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
class Wootook_Core_Block_Html_Head
|
||||
extends Wootook_Core_Block_Template
|
||||
{
|
||||
const TYPE_GLOBAL_CSS = 'global_css';
|
||||
const TYPE_GLOBAL_JS = 'global_js';
|
||||
|
||||
const TYPE_SKIN_CSS = 'skin_css';
|
||||
|
|
@ -19,7 +20,7 @@ class Wootook_Core_Block_Html_Head
|
|||
|
||||
protected $_title = '';
|
||||
protected $_titleDefaultConcat = self::TITLE_CONCAT_AFTER;
|
||||
protected $_titleSeparator = ' | ';
|
||||
protected $_titleSeparator = ' ¤ ';
|
||||
|
||||
protected $_titleConcatTypes = array(
|
||||
self::TITLE_CONCAT_AFTER,
|
||||
|
|
@ -85,37 +86,56 @@ class Wootook_Core_Block_Html_Head
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function addJs($script, $type = 'text/javascript', Array $options = array())
|
||||
public function addJs($script, $type = 'text/javascript', Array $options = array(), $theme = null, $package = null)
|
||||
{
|
||||
$options['type'] = $type;
|
||||
$options['path'] = $script;
|
||||
$options['theme'] = $theme;
|
||||
$options['package'] = $package;
|
||||
|
||||
$this->addItem(self::TYPE_GLOBAL_JS, $options);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addCss($stylesheet, $type = 'text/css', $condition = null, Array $options = array())
|
||||
public function addCss($stylesheet, $type = 'text/css', $condition = null, Array $options = array(), $theme = null, $package = null)
|
||||
{
|
||||
$options['type'] = $type;
|
||||
$options['path'] = $stylesheet;
|
||||
$options['condition'] = $condition;
|
||||
$options['theme'] = $theme;
|
||||
$options['package'] = $package;
|
||||
|
||||
$this->addItem(self::TYPE_SKIN_CSS, $options);
|
||||
$this->addItem(self::TYPE_GLOBAL_CSS, $options);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addSkinJs($script, $type = 'text/javascript', Array $options = array())
|
||||
public function addSkinJs($script, $type = 'text/javascript', Array $options = array(), $theme = null, $package = null)
|
||||
{
|
||||
$options['type'] = $type;
|
||||
$options['path'] = $script;
|
||||
$options['theme'] = $theme;
|
||||
$options['package'] = $package;
|
||||
|
||||
$this->addItem(self::TYPE_SKIN_JS, $options);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addSkinCss($stylesheet, $type = 'text/css', $condition = null, Array $options = array(), $theme = null, $package = null)
|
||||
{
|
||||
$options['type'] = $type;
|
||||
$options['path'] = $stylesheet;
|
||||
$options['condition'] = $condition;
|
||||
$options['theme'] = $theme;
|
||||
$options['package'] = $package;
|
||||
|
||||
$this->addItem(self::TYPE_SKIN_CSS, $options);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addInlineJs($content, $type = 'text/javascript', Array $options = array())
|
||||
{
|
||||
$options['type'] = $type;
|
||||
|
|
@ -129,7 +149,6 @@ class Wootook_Core_Block_Html_Head
|
|||
public function addInlineCss($content, $type = 'text/css', Array $options = array())
|
||||
{
|
||||
$options['type'] = $type;
|
||||
$options['path'] = $path;
|
||||
$options['content'] = $content;
|
||||
|
||||
$this->addItem(self::TYPE_INLINE_CSS, $options);
|
||||
|
|
@ -138,6 +157,14 @@ class Wootook_Core_Block_Html_Head
|
|||
}
|
||||
|
||||
public function getCss()
|
||||
{
|
||||
if (isset($this->_items[self::TYPE_GLOBAL_CSS])) {
|
||||
return $this->_items[self::TYPE_GLOBAL_CSS];
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getSkinCss()
|
||||
{
|
||||
if (isset($this->_items[self::TYPE_SKIN_CSS])) {
|
||||
return $this->_items[self::TYPE_SKIN_CSS];
|
||||
|
|
@ -184,8 +211,35 @@ class Wootook_Core_Block_Html_Head
|
|||
if (!isset($css['media'])) {
|
||||
$css['media'] = 'all';
|
||||
}
|
||||
$url = $this->getUrl($css['path'], array());
|
||||
$render .=<<<HTML_EOF
|
||||
<link rel="stylesheet" type="{$css['type']}" src="{$css['path']}" media="{$css['media']}" />
|
||||
<link rel="stylesheet" type="{$css['type']}" src="{$url}" media="{$css['media']}" />
|
||||
HTML_EOF;
|
||||
}
|
||||
}
|
||||
|
||||
public function renderSkinCss()
|
||||
{
|
||||
$render = '';
|
||||
foreach ($this->getSkinCss() as $css) {
|
||||
if (!isset($css['media'])) {
|
||||
$css['media'] = 'all';
|
||||
}
|
||||
$url = $this->getSkinUrl($css['path'], array(), $css['theme'], $css['package']);
|
||||
$render .=<<<HTML_EOF
|
||||
<link rel="stylesheet" type="{$css['type']}" src="{$url}" media="{$css['media']}" />
|
||||
HTML_EOF;
|
||||
}
|
||||
}
|
||||
|
||||
public function renderInlineCss()
|
||||
{
|
||||
foreach ($this->getInlineCss() as $css) {
|
||||
if (!isset($css['media'])) {
|
||||
$css['media'] = 'all';
|
||||
}
|
||||
$render .=<<<HTML_EOF
|
||||
<style type="{$css['type']}">/*<![CDATA[*/{$css['content']}/*]]>*/</style>
|
||||
HTML_EOF;
|
||||
}
|
||||
return $render;
|
||||
|
|
@ -198,8 +252,34 @@ HTML_EOF;
|
|||
if (!isset($js['type'])) {
|
||||
$js['type'] = 'text/javascript';
|
||||
}
|
||||
$url = $this->getUrl($js['path']);
|
||||
$render .=<<<HTML_EOF
|
||||
<script type="{$js['type']}" src="{$js['path']}"></script>
|
||||
<script type="{$js['type']}" src="{$url}"></script>
|
||||
HTML_EOF;
|
||||
}
|
||||
return $render;
|
||||
}
|
||||
|
||||
public function renderSkinJs()
|
||||
{
|
||||
$render = '';
|
||||
foreach ($this->getJs() as $js) {
|
||||
if (!isset($js['type'])) {
|
||||
$js['type'] = 'text/javascript';
|
||||
}
|
||||
$url = $this->getSkinUrl($js['path'], array(), $js['theme'], $js['package']);
|
||||
$render .=<<<HTML_EOF
|
||||
<script type="{$js['type']}" src="{$url}"></script>
|
||||
HTML_EOF;
|
||||
}
|
||||
return $render;
|
||||
}
|
||||
|
||||
public function renderInlineJs()
|
||||
{
|
||||
foreach ($this->getInlineJs() as $js) {
|
||||
$render .=<<<HTML_EOF
|
||||
<script type="{$js['type']}">/*<![CDATA[*/{$js['content']}/*]]>*/</script>
|
||||
HTML_EOF;
|
||||
}
|
||||
return $render;
|
||||
|
|
|
|||
|
|
@ -65,13 +65,7 @@ class Wootook_Core_Collection
|
|||
|
||||
public function quote($data)
|
||||
{
|
||||
static $database = null;
|
||||
|
||||
if ($database === null) {
|
||||
$database = Wootook_Database::getSingleton();
|
||||
}
|
||||
|
||||
return $database->quote($data);
|
||||
return $this->getReadConnection()->quote($data);
|
||||
}
|
||||
|
||||
public function column($column = '*', $alias = null)
|
||||
|
|
@ -102,11 +96,7 @@ class Wootook_Core_Collection
|
|||
|
||||
public function join($table, $condition, $fields = array('*'), $mode = 'INNER')
|
||||
{
|
||||
static $database = null;
|
||||
|
||||
if ($database === null) {
|
||||
$database = Wootook_Database::getSingleton();
|
||||
}
|
||||
$database = $this->getReadConnection();
|
||||
|
||||
if (is_array($table)) {
|
||||
$alias = key($table);
|
||||
|
|
@ -160,7 +150,7 @@ class Wootook_Core_Collection
|
|||
protected function _prepareSql()
|
||||
{
|
||||
if (empty($this->_union)) {
|
||||
$database = Wootook_Database::getSingleton();
|
||||
$database = $this->getReadConnection();
|
||||
|
||||
$fields = array();
|
||||
foreach ($this->_columns as $field) {
|
||||
|
|
@ -301,7 +291,7 @@ SQL_EOF;
|
|||
|
||||
$sql = $clone->_prepareSql();
|
||||
|
||||
$database = Wootook_Database::getSingleton();
|
||||
$database = $this->getReadConnection();
|
||||
$statement = $database->prepare($sql);
|
||||
|
||||
$args = func_get_args();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ class Wootook_Core_Config_Adapter_Array
|
|||
|
||||
public function load($filename)
|
||||
{
|
||||
if (!file_exists($filename)) {
|
||||
throw new Wootook_Core_Exception_DataAccessException(sprintf('Could not load config file "%s"', $filename));
|
||||
}
|
||||
$data = include $filename;
|
||||
|
||||
if (!is_array($data)) {
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Controller_Action
|
||||
{
|
||||
private $_request = null;
|
||||
private $_response = null;
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
public function preDispatch()
|
||||
{
|
||||
}
|
||||
|
||||
public function postDispatch()
|
||||
{
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->_request;
|
||||
}
|
||||
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->_response;
|
||||
}
|
||||
|
||||
protected function _forward($action, $controller = null, $module = null)
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$request->setAction($action);
|
||||
if ($controller !== null) {
|
||||
$request->setController($controller);
|
||||
if ($module != null) {
|
||||
$request->setModule($module);
|
||||
}
|
||||
}
|
||||
$request->setIsDispatched(false);
|
||||
}
|
||||
|
||||
protected function _redirect($url)
|
||||
{
|
||||
$this->getResponse()->setRedirect($url);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
136
application/code/core/Wootook/Core/Controller/Front/Action.php
Normal file
136
application/code/core/Wootook/Core/Controller/Front/Action.php
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Controller_Front_Action
|
||||
{
|
||||
private $_request = null;
|
||||
private $_response = null;
|
||||
|
||||
private $_layout = null;
|
||||
|
||||
public function __construct(Wootook_Core_Controller_Request_Http $request, Wootook_Core_Controller_Response_Http $response)
|
||||
{
|
||||
$this->setRequest($request);
|
||||
$this->setResponse($response);
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
public function preDispatch()
|
||||
{
|
||||
}
|
||||
|
||||
public function postDispatch()
|
||||
{
|
||||
}
|
||||
|
||||
public function setRequest(Wootook_Core_Controller_Request_Http $request)
|
||||
{
|
||||
$this->_request = $request;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setResponse(Wootook_Core_Controller_Response_Http $response)
|
||||
{
|
||||
$this->_response = $response;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Wootook_Core_Controller_Request_Http
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->_request;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Wootook_Core_Controller_Response_Http
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->_response;
|
||||
}
|
||||
|
||||
protected function _forward($action, $controller = null, $module = null)
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$request->setActionName($action);
|
||||
if ($controller !== null) {
|
||||
$request->setControllerName($controller);
|
||||
if ($module != null) {
|
||||
$request->setModuleName($module);
|
||||
}
|
||||
}
|
||||
$request->setIsDispatched(false);
|
||||
}
|
||||
|
||||
protected function _redirect($uri, Array $params = array(), $code = Wootook_Core_Controller_Response_Http::REDIRECT_FOUND)
|
||||
{
|
||||
$this->getResponse()
|
||||
->setRedirect(Wootook::getUrl($uri, $params), $code);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _redirectUrl($url, $code = Wootook_Core_Controller_Response_Http::REDIRECT_FOUND)
|
||||
{
|
||||
$this->getResponse()->setRedirect($url, $code);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _buildLayoutHandle()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$module = $request->getModuleName();
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
return "{$module}.{$controller}.{$action}";
|
||||
}
|
||||
|
||||
public function loadLayout($handle = null)
|
||||
{
|
||||
if ($this->_layout === null) {
|
||||
$this->_layout = $this->_initLayout();
|
||||
}
|
||||
|
||||
if ($handle === null) {
|
||||
$handle = $this->_buildLayoutHandle();
|
||||
}
|
||||
$this->_layout->load($handle);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _initLayout()
|
||||
{
|
||||
return new Wootook_Core_Layout(Wootook_Core_Layout::DOMAIN_FRONTEND);
|
||||
}
|
||||
|
||||
public function getLayout()
|
||||
{
|
||||
return $this->_layout;
|
||||
}
|
||||
|
||||
public function renderLayout()
|
||||
{
|
||||
try {
|
||||
$content = $this->getLayout()->render();
|
||||
} catch (Wootook_Core_Exception_LayoutException $e) {
|
||||
Wootook_Core_ErrorProfiler::getSingleton()->addException($e);
|
||||
return $this;
|
||||
}
|
||||
$this->getResponse()->setBody($content);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Controller_Request_Abstract
|
||||
extends Wootook_Object
|
||||
{
|
||||
public function setParam($key, $value)
|
||||
{
|
||||
return $this->setData($key, $value);
|
||||
}
|
||||
|
||||
public function getParam($key, $default = null)
|
||||
{
|
||||
if ($this->hasData($key)) {
|
||||
return $this->getData($key);
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
abstract public function getModuleName();
|
||||
abstract public function getControllerName();
|
||||
abstract public function getActionName();
|
||||
|
||||
abstract public function setModuleName($name);
|
||||
abstract public function setControllerName($name);
|
||||
abstract public function setActionName($name);
|
||||
}
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Controller_Request_Http
|
||||
extends Wootook_Object
|
||||
extends Wootook_Core_Controller_Request_Abstract
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array());
|
||||
}
|
||||
protected $_actionKey = 'action';
|
||||
protected $_controllerKey = 'controller';
|
||||
protected $_moduleKey = 'module';
|
||||
|
||||
protected $_isDispatched = false;
|
||||
|
||||
public function setParam($key, $value)
|
||||
{
|
||||
|
|
@ -149,4 +150,82 @@ class Wootook_Core_Controller_Request_Http
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getModuleKey()
|
||||
{
|
||||
return $this->_moduleKey;
|
||||
}
|
||||
|
||||
public function setModuleKey($key)
|
||||
{
|
||||
$this->_moduleKey = $key;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getModuleName()
|
||||
{
|
||||
return $this->getParam($this->getModuleKey());
|
||||
}
|
||||
|
||||
public function setModuleName($name)
|
||||
{
|
||||
return $this->setParam($this->getModuleKey(), $name);
|
||||
}
|
||||
|
||||
public function getControllerKey()
|
||||
{
|
||||
return $this->_controllerKey;
|
||||
}
|
||||
|
||||
public function setControllerKey($key)
|
||||
{
|
||||
$this->_controllerKey = $key;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getControllerName()
|
||||
{
|
||||
return $this->getParam($this->getControllerKey(), 'index');
|
||||
}
|
||||
|
||||
public function setControllerName($name)
|
||||
{
|
||||
return $this->setParam($this->getControllerKey(), $name);
|
||||
}
|
||||
|
||||
public function getActionKey()
|
||||
{
|
||||
return $this->_actionKey;
|
||||
}
|
||||
|
||||
public function setActionKey($key)
|
||||
{
|
||||
$this->_actionKey = $key;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getActionName()
|
||||
{
|
||||
return $this->getParam($this->getActionKey(), 'index');
|
||||
}
|
||||
|
||||
public function setActionName($name)
|
||||
{
|
||||
return $this->setParam($this->getActionKey(), $name);
|
||||
}
|
||||
|
||||
public function setIsDispatched($dispatched = true)
|
||||
{
|
||||
$this->_isDispatched = $dispatched;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isDispatched()
|
||||
{
|
||||
return $this->_isDispatched;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Controller_Response_Abstract
|
||||
extends Wootook_Object
|
||||
{
|
||||
public function setParam($key, $value)
|
||||
{
|
||||
return $this->setData($key, $value);
|
||||
}
|
||||
|
||||
public function getParam($key, $default = null)
|
||||
{
|
||||
if ($this->hasData($key)) {
|
||||
return $this->getData($key);
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Controller_Response_Http
|
||||
extends Wootook_Object
|
||||
extends Wootook_Core_Controller_Response_Abstract
|
||||
{
|
||||
const REDIRECT_MOVED_PERMANENTLY = 301;
|
||||
const REDIRECT_FOUND = 302;
|
||||
|
|
@ -15,11 +15,6 @@ class Wootook_Core_Controller_Response_Http
|
|||
self::REDIRECT_TEMPORARY => 'Temporary Redirect'
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array());
|
||||
}
|
||||
|
||||
public function setBody($data)
|
||||
{
|
||||
$this->clearBody();
|
||||
|
|
@ -46,6 +41,9 @@ class Wootook_Core_Controller_Response_Http
|
|||
|
||||
public function sendBody()
|
||||
{
|
||||
if (!isset($this->_data['body']) || empty($this->_data['body'])) {
|
||||
return '';
|
||||
}
|
||||
return implode('', $this->_data['body']);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,6 @@ class Wootook_Core_ErrorProfiler
|
|||
$microsec = (int) ($error['time'][0] * 1000000);
|
||||
|
||||
return <<<ERROR_EOF
|
||||
Message #{$id}
|
||||
On: {$date} +{$microsec}µs
|
||||
Type: {$code}
|
||||
Message: {$error['message']}
|
||||
|
|
@ -150,47 +149,66 @@ ERROR_EOF;
|
|||
}
|
||||
|
||||
$index = 0;
|
||||
echo '<div style="background:#FFF;border:1px solid #F00;color:#000;padding:10px;margin:20px;text-align:left;">';
|
||||
echo '<h1>Debug profiler</h1>';
|
||||
echo '<div style="background:#FFF;border:5px solid #933;border-top-width:15px;border-radius:5px;color:#000;padding:0;margin:20px;text-align:left;margin:50px auto;width:800px;">';
|
||||
echo '<h1 style="margin:0;padding:0 10px;text-decoration:none;border-bottom:3px solid #933;">Debug profiler</h1>';
|
||||
if (count($this->_errors) <= 0 && count($this->_warnings) <= 0 &&
|
||||
count($this->_notices) <= 0 && count($this->_otherErrors) <= 0 &&
|
||||
count($this->_exceptions) <= 0) {
|
||||
echo '<p>Profiler was empty.</p>';
|
||||
echo '<p style="color:#666;font-style:italic;margin:20px 10px 10px;">Error profiler was empty.</p>';
|
||||
} else {
|
||||
echo '<pre>';
|
||||
echo '<div style="margin:0;overflow:auto;">';
|
||||
foreach ($this->_errors as $error) {
|
||||
echo $this->_renderError(++$index, $error);
|
||||
++$index;
|
||||
echo '<h2 style="font-size:1.2em;text-decoration:none;margin:0 5px;">Message #' . $index . '</h2>';
|
||||
echo '<pre style="margin:0 5px;">';
|
||||
echo $this->_renderError($index, $error);
|
||||
echo '</pre>';
|
||||
}
|
||||
foreach ($this->_warnings as $error) {
|
||||
echo $this->_renderError(++$index, $error);
|
||||
++$index;
|
||||
echo '<h2 style="font-size:1.2em;text-decoration:none;margin:10px 5px 0;">Message #' . $index . '</h2>';
|
||||
echo '<pre style="margin:0 5px;">';
|
||||
echo $this->_renderError($index, $error);
|
||||
echo '</pre>';
|
||||
}
|
||||
foreach ($this->_notices as $error) {
|
||||
echo $this->_renderError(++$index, $error);
|
||||
++$index;
|
||||
echo '<h2 style="font-size:1.2em;text-decoration:none;margin:10px 5px 0;">Message #' . $index . '</h2>';
|
||||
echo '<pre style="margin:0 5px;">';
|
||||
echo $this->_renderError($index, $error);
|
||||
echo '</pre>';
|
||||
}
|
||||
foreach ($this->_otherErrors as $errorList) {
|
||||
foreach ($errorList as $error) {
|
||||
echo $this->_renderError(++$index, $error);
|
||||
++$index;
|
||||
echo '<h2 style="font-size:1.2em;text-decoration:none;margin:10px 5px 0;">Message #' . $index . '</h2>';
|
||||
echo '<pre style="margin:0 5px;">';
|
||||
echo $this->_renderError($index, $error);
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
foreach ($this->_exceptions as $exception) {
|
||||
$index++;
|
||||
echo "Message #{$index}". PHP_EOL;
|
||||
++$index;
|
||||
echo '<h2 style="font-size:1.2em;text-decoration:none;margin:10px 5px 0;">Message #' . $index . '</h2>';
|
||||
echo '<pre style="margin:0 5px;">';
|
||||
echo $exception->getMessage() . PHP_EOL;
|
||||
echo $exception->getTraceAsString() . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
echo '</pre>';
|
||||
|
||||
$child = 0;
|
||||
$current = $exception;
|
||||
while (($current = $current->getPrevious()) !== null) {
|
||||
$child++;
|
||||
echo " Child level #{$child}". PHP_EOL;
|
||||
echo " " . $current->getMessage() . PHP_EOL;
|
||||
echo '<h3 style="font-size:1em;text-decoration:none;margin:10px 30px 0;">Message #' . $index . ', child level #' . $child . '</h3>';
|
||||
echo '<pre style="margin:0 30px;">';
|
||||
echo $current->getMessage() . PHP_EOL;
|
||||
echo $current->getTraceAsString() . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
echo '</pre>';
|
||||
}
|
||||
echo PHP_EOL;
|
||||
}
|
||||
echo '</pre>';
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Exception_LayoutException
|
||||
extends Wootook_Core_Exception_RuntimeException
|
||||
{
|
||||
}
|
||||
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
class Wootook_Core_Form
|
||||
{
|
||||
protected $_fields = array();
|
||||
protected $_elements = array();
|
||||
|
||||
protected $_request = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* Field class loader
|
||||
* @var Wootook_Core_Form_FieldLoader
|
||||
* Element class loader
|
||||
* @var Wootook_Core_Form_ElementLoader
|
||||
*/
|
||||
protected $_fieldLoader = null;
|
||||
protected $_elementLoader = null;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -27,30 +27,30 @@ class Wootook_Core_Form
|
|||
*/
|
||||
protected $_session = null;
|
||||
|
||||
public function __construct(Wootook_Core_Model_Session $session, Array $fields = array())
|
||||
public function __construct(Wootook_Core_Model_Session $session, Array $elements = array())
|
||||
{
|
||||
$this->_session = $session;
|
||||
|
||||
$this->_fieldLoader = new Wootook_Core_Form_FieldLoader($this, array(
|
||||
'Wootook_Core_Form_Field_' => 'Wootook/Core/Form/Field'
|
||||
$this->_elementLoader = new Wootook_Core_Form_ElementLoader($this, array(
|
||||
'Wootook_Core_Form_Element_' => 'Wootook/Core/Form/Element'
|
||||
));
|
||||
|
||||
$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'));
|
||||
$this->addElement('__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);
|
||||
foreach ($elements as $elementName => $elementConfig) {
|
||||
if (is_string($elementConfig)) {
|
||||
$this->addElement($elementName, $elementConfig);
|
||||
} else if ($elementConfig instanceof Wootook_Core_Form_ElementAbstract) {
|
||||
$this->addElement($elementName, $elementConfig);
|
||||
} else {
|
||||
if (isset($fieldConfig['validators'])) {
|
||||
$this->addField($fieldName, $fieldConfig['type'], $fieldConfig['validators']);
|
||||
if (isset($elementConfig['validators'])) {
|
||||
$this->addElement($elementName, $elementConfig['type'], $elementConfig['validators']);
|
||||
} else {
|
||||
$this->addField($fieldName, $fieldConfig['type']);
|
||||
$this->addElement($elementName, $elementConfig['type']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,8 +58,8 @@ class Wootook_Core_Form
|
|||
|
||||
public function validate()
|
||||
{
|
||||
foreach ($this->_fields as $field) {
|
||||
if (!$field->validate()) {
|
||||
foreach ($this->_elements as $element) {
|
||||
if (!$element->validate()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -70,36 +70,37 @@ class Wootook_Core_Form
|
|||
*
|
||||
* Enter description here ...
|
||||
* @param string $name
|
||||
* @param string|Wootook_Core_Form_FieldAbstract $type
|
||||
* @param string|Wootook_Core_Form_ElementAbstract $type
|
||||
* @return Wootook_Core_Form
|
||||
*/
|
||||
public function addField($name, $type = 'text', Array $validators = array())
|
||||
public function addElement($name, $type = 'text', Array $validators = array())
|
||||
{
|
||||
if ($type instanceof Wootook_Core_Form_FieldAbstract) {
|
||||
$this->_fields[$name] = $name;
|
||||
$this->_fields[$name]->setForm($this);
|
||||
if ($type instanceof Wootook_Core_Form_ElementAbstract) {
|
||||
$this->_elements[$name] = $name;
|
||||
$this->_elements[$name]->setForm($this);
|
||||
} else {
|
||||
$field = $this->_fieldLoader->load($type);
|
||||
$element = $this->_elementLoader->load($type);
|
||||
|
||||
if ($field === null) {
|
||||
trigger_error(sprintf('Field %1$s (type: %2$s) could not be created.', $name, $type), E_USER_WARNING);
|
||||
if ($element === null) {
|
||||
trigger_error(sprintf('Element %1$s (type: %2$s) could not be created.', $name, $type), E_USER_WARNING);
|
||||
return $this;
|
||||
}
|
||||
$this->_fields[$name] = $field;
|
||||
$this->_elements[$name] = $element;
|
||||
}
|
||||
$this->_fields[$name]->setName($name);
|
||||
$this->_elements[$name]->setName($name);
|
||||
|
||||
foreach ($validators as $validatorName => $validatorType) {
|
||||
if ($validatorType instanceof Wootook_Core_Form_FieldAbstract) {
|
||||
$this->_fields[$name]->addValidator($validatorType, $validatorName);
|
||||
if ($validatorType instanceof Wootook_Core_Form_ElementAbstract) {
|
||||
$this->_elements[$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);
|
||||
Wootook_Core_ErrorProfiler::getSingleton()
|
||||
->addException(new Wootook_Core_Exception_RuntimeException(sprintf('Validator %1$s (type: %2$s) could not be created.', $validatorName, $validatorType)));
|
||||
return $this;
|
||||
}
|
||||
$this->_fields[$name]->addValidator($validator, $validatorName);
|
||||
$this->_elements[$name]->addValidator($validator, $validatorName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,15 +111,15 @@ class Wootook_Core_Form
|
|||
*
|
||||
* Enter description here ...
|
||||
* @param string $name
|
||||
* @return Wootook_Core_Form_FieldAbstract
|
||||
* @return Wootook_Core_Form_ElementAbstract
|
||||
*/
|
||||
public function getField($name)
|
||||
public function getElement($name)
|
||||
{
|
||||
if (!isset($this->_fields[$name])) {
|
||||
if (!isset($this->_elements[$name])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_fields[$name];
|
||||
return $this->_elements[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -165,13 +166,13 @@ class Wootook_Core_Form
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
foreach ($this->_fields as $fieldName => $field) {
|
||||
if (isset($datas[$fieldName])) {
|
||||
$field->populate($datas[$fieldName]);
|
||||
foreach ($this->_elements as $elementName => $element) {
|
||||
if (isset($datas[$elementName])) {
|
||||
$element->populate($datas[$elementName]);
|
||||
} else if ($request->isPost()) {
|
||||
$field->populate($request->getPost($fieldName));
|
||||
$element->populate($request->getPost($elementName));
|
||||
} else {
|
||||
$field->populate($request->getQuery($fieldName));
|
||||
$element->populate($request->getQuery($elementName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
application/code/core/Wootook/Core/Form/Element/Button.php
Normal file
11
application/code/core/Wootook/Core/Form/Element/Button.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
|
||||
class Wootook_Core_Form_Element_Button
|
||||
extends Wootook_Core_Form_ElementAbstract
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
return 'button';
|
||||
}
|
||||
}
|
||||
11
application/code/core/Wootook/Core/Form/Element/Text.php
Normal file
11
application/code/core/Wootook/Core/Form/Element/Text.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
|
||||
class Wootook_Core_Form_Element_Text
|
||||
extends Wootook_Core_Form_ElementAbstract
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,23 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Form_FieldAbstract
|
||||
abstract class Wootook_Core_Form_ElementAbstract
|
||||
{
|
||||
protected $_name = null;
|
||||
protected $_form = null;
|
||||
protected $_value = null;
|
||||
|
||||
protected $_params = null;
|
||||
|
||||
protected $_validators = array();
|
||||
|
||||
public function __construct(Wootook_Core_Form $form = null)
|
||||
public function __construct($name, $params, Wootook_Core_Form $form = null)
|
||||
{
|
||||
if ($form !== null) {
|
||||
$this->setForm($form);
|
||||
}
|
||||
|
||||
$this->setName($name);
|
||||
$this->setParams($params);
|
||||
}
|
||||
|
||||
abstract public function getType();
|
||||
|
|
@ -41,6 +46,42 @@ abstract class Wootook_Core_Form_FieldAbstract
|
|||
return $this->_name;
|
||||
}
|
||||
|
||||
public function setAllParams($params)
|
||||
{
|
||||
$this->_params = $params;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAllParams()
|
||||
{
|
||||
return $this->_params;
|
||||
}
|
||||
|
||||
public function setParam($param, $value)
|
||||
{
|
||||
$this->_params[$param] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getParam($param)
|
||||
{
|
||||
return $this->_params[$param];
|
||||
}
|
||||
|
||||
public function hasParam($param)
|
||||
{
|
||||
return isset($this->_params[$param]);
|
||||
}
|
||||
|
||||
public function unsetParam($param)
|
||||
{
|
||||
unset($this->_params[$param]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setForm(Wootook_Core_Form $form)
|
||||
{
|
||||
$this->_form = $form;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Form_FieldLoader
|
||||
class Wootook_Core_Form_ElementLoader
|
||||
extends Wootook_Core_Plugin_LoaderAbstract
|
||||
{
|
||||
protected $_form = null;
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
class Wootook_Core_Form_Field_Text
|
||||
extends Wootook_Core_Form_FieldAbstract
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
return 'text';
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,9 @@ class Wootook_Core_Layout
|
|||
const DEFAULT_PACKAGE = 'base';
|
||||
const DEFAULT_THEME = 'default';
|
||||
|
||||
const DOMAIN_FRONTEND = 'frontend';
|
||||
const DOMAIN_BACKEND = 'backend';
|
||||
|
||||
protected $_blocks = array();
|
||||
|
||||
protected $_messageBlock = null;
|
||||
|
|
@ -14,15 +17,37 @@ class Wootook_Core_Layout
|
|||
protected $_eventPrefix = 'layout';
|
||||
protected $_eventObject = 'layout';
|
||||
|
||||
protected $_domain = self::DOMAIN_FRONTEND;
|
||||
protected $_package = self::DEFAULT_PACKAGE;
|
||||
protected $_theme = self::DEFAULT_THEME;
|
||||
|
||||
protected $_namespaces = array(
|
||||
'core' => array(
|
||||
'Wootook_Core_Block_' => 'Wootook/core/Block'
|
||||
'Wootook_Core_Block_' => 'Wootook/Core/Block'
|
||||
)
|
||||
);
|
||||
|
||||
public function __construct($domain = null, $package = null, $theme = null, Array $data = array())
|
||||
{
|
||||
if ($domain === null) {
|
||||
if (Wootook::getDefaultWebsite()->getId() == 0) {
|
||||
$this->_domain = self::DOMAIN_BACKEND;
|
||||
} else {
|
||||
$this->_domain = self::DOMAIN_FRONTEND;
|
||||
}
|
||||
} else {
|
||||
$this->_domain = $domain;
|
||||
}
|
||||
if ($package !== null) {
|
||||
$this->setPackage($package);
|
||||
}
|
||||
if ($theme !== null) {
|
||||
$this->setTheme($theme);
|
||||
}
|
||||
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
public function _init()
|
||||
{
|
||||
$modules = Wootook_Core_Model_Config_Modules::getSingleton();
|
||||
|
|
@ -33,22 +58,31 @@ class Wootook_Core_Layout
|
|||
}
|
||||
}
|
||||
|
||||
$fileList = Wootook::getConfig('layout');
|
||||
$fileList = Wootook::getGameConfig('layout');
|
||||
if ($fileList instanceof Wootook_Core_Config_Node) {
|
||||
$fileList = $fileList->toArray();
|
||||
}
|
||||
if (!is_array($fileList) || empty($fileList)) {
|
||||
$fileList = $this->getAllDatas();
|
||||
} else {
|
||||
$fileList = array_merge($fileList, $this->getAllDatas());
|
||||
$fileList = array();
|
||||
}
|
||||
$this->_data = array();
|
||||
|
||||
$this->setPackage(Wootook::getConfig('package'));
|
||||
$this->setTheme(Wootook::getConfig('theme'));
|
||||
$this->setPackage(Wootook::getWebsiteConfig('package'));
|
||||
$this->setTheme(Wootook::getGameConfig('theme'));
|
||||
|
||||
foreach ($fileList as $layoutFile) {
|
||||
foreach (include $this->_getLayoutPath($layoutFile) as $layoutId => $layoutConfig) {
|
||||
try {
|
||||
$layoutData = include $this->_getLayoutPath($layoutFile);
|
||||
} catch (Wootook_Core_Exception_LayoutException $e) {
|
||||
Wootook_Core_ErrorProfiler::getSingleton()->addException($e);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is_array($layoutData)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($layoutData as $layoutId => $layoutConfig) {
|
||||
if ($this->hasData($layoutId)) {
|
||||
$declared = $this->getData($layoutId);
|
||||
|
||||
|
|
@ -326,7 +360,7 @@ class Wootook_Core_Layout
|
|||
$callParamaters[$paramterPosition] = $parameter->getDefaultValue();
|
||||
//} else if (!$parameter->isOptionnal()) {
|
||||
} else if ($paramterPosition <= $requiredParameterCount) {
|
||||
throw new Wootook_Core_Exception_RuntimeException(Wootook::__('Method %s requires parameter %d ($%s) to be defined.',
|
||||
throw new Wootook_Core_Exception_LayoutException(Wootook::__('Method %s requires parameter %d ($%s) to be defined.',
|
||||
$reflectionMethod->getName(), $paramterPosition + 1, $paramterName));
|
||||
}
|
||||
}
|
||||
|
|
@ -342,6 +376,19 @@ class Wootook_Core_Layout
|
|||
}
|
||||
}
|
||||
|
||||
public function getDomain()
|
||||
{
|
||||
return $this->_domain;
|
||||
}
|
||||
|
||||
public function setDomain($domain)
|
||||
{
|
||||
$this->_domain = $domain;
|
||||
$this->_init();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPackage()
|
||||
{
|
||||
return $this->_package;
|
||||
|
|
@ -368,7 +415,7 @@ class Wootook_Core_Layout
|
|||
|
||||
public function getScriptPath()
|
||||
{
|
||||
return APPLICATION_PATH . DIRECTORY_SEPARATOR . 'design';
|
||||
return APPLICATION_PATH . 'design' . DIRECTORY_SEPARATOR . $this->getDomain();
|
||||
}
|
||||
|
||||
public function getBlock($code)
|
||||
|
|
@ -382,7 +429,7 @@ 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.'));
|
||||
throw new Wootook_Core_Exception_LayoutException(Wootook::__('No root view declared.'));
|
||||
}
|
||||
|
||||
$scriptPath = $this->getScriptPath();
|
||||
|
|
@ -403,24 +450,26 @@ class Wootook_Core_Layout
|
|||
$theme = $this->getTheme();
|
||||
$pattern = "{$this->getScriptPath()}/%s/%s/layouts/{$file}";
|
||||
|
||||
if ($package !== null && $theme !== null) {
|
||||
$path = sprintf($pattern, $package, $theme);
|
||||
if (Wootook::fileExists($path)) {
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
if ($package !== null) {
|
||||
$path = sprintf($pattern, $package, self::DEFAULT_THEME);
|
||||
if (Wootook::fileExists($path)) {
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
$path = sprintf($pattern, self::DEFAULT_PACKAGE, self::DEFAULT_THEME);
|
||||
if (Wootook::fileExists($path)) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
trigger_error(Wootook::__("Layout file '%s' does not exist.", $file), E_USER_NOTICE);
|
||||
|
||||
return null;
|
||||
throw new Wootook_Core_Exception_LayoutException(sprintf("Layout file '%s' does not exist.", $file));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ abstract class Wootook_Core_Model
|
|||
call_user_func_array(array($this, '_afterLoad'), $params);
|
||||
$this->_setOriginalData($this->_data);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_DataAccessException('Could not load data: ' . $e->getMessage(), 0);
|
||||
throw new Wootook_Core_Exception_DataAccessException('Could not load data: ' . $e->getMessage(), 0, $e);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ abstract class Wootook_Core_Model_Config_Abstract
|
|||
{
|
||||
protected function _initData($filename)
|
||||
{
|
||||
$config = Wootook::getConfig('storyline');
|
||||
$config = Wootook::getGameConfig('engine/storyline');
|
||||
|
||||
if ($config === null) {
|
||||
$config = array(
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Wootook_Core_Model_Session
|
|||
extends Wootook_Object
|
||||
{
|
||||
const CRIT = 0x80;
|
||||
const ERROR = 0x40;
|
||||
const ERR = 0x40;
|
||||
const WARN = 0x20;
|
||||
const INFO = 0x10;
|
||||
const DEBUG = 0x01;
|
||||
|
|
@ -19,21 +19,26 @@ class Wootook_Core_Model_Session
|
|||
|
||||
protected static $_instances = null;
|
||||
|
||||
protected static $_levels = null;
|
||||
protected static $_levels = array(
|
||||
self::CRIT => 'CRIT',
|
||||
self::ERR => 'ERR',
|
||||
self::WARN => 'WARN',
|
||||
self::INFO => 'INFO',
|
||||
self::DEBUG => 'DEBUG',
|
||||
self::SUCCESS => 'SUCCESS'
|
||||
);
|
||||
|
||||
const COOKIE_LIFETIME_CONFIG_KEY = 'web/session/time';
|
||||
const COOKIE_DOMAIN_CONFIG_KEY = 'web/session/domain';
|
||||
const COOKIE_PATH_CONFIG_KEY = 'web/session/path';
|
||||
|
||||
const IDENTIFIER_EXPIRES = '__expires';
|
||||
const IDENTIFIER_MESSAGES = '__messages';
|
||||
|
||||
public static function factory($namespace)
|
||||
{
|
||||
$namespace = (string) $namespace;
|
||||
if (!isset(self::$_instances[$namespace])) {
|
||||
if (self::$_levels === null) {
|
||||
$reflection = new ReflectionClass(__CLASS__);
|
||||
self::$_levels = array_flip($reflection->getConstants());
|
||||
}
|
||||
|
||||
self::$_instances[$namespace] = new self($namespace);
|
||||
}
|
||||
return self::$_instances[$namespace];
|
||||
|
|
@ -49,22 +54,26 @@ class Wootook_Core_Model_Session
|
|||
if (session_id() == '') {
|
||||
session_set_cookie_params($this->getCookieLifetime(), $this->getCookiePath(), $this->getCookieDomain(), false, true);
|
||||
session_start();
|
||||
session_regenerate_id(true);
|
||||
}
|
||||
|
||||
if (!isset($_SESSION[$namespace])) {
|
||||
$_SESSION[$namespace] = array();
|
||||
if (!isset($_SESSION[$namespace]) || !isset($_SESSION[$namespace][self::IDENTIFIER_EXPIRES]) || $_SESSION[$namespace][self::IDENTIFIER_EXPIRES] < time()) {
|
||||
$_SESSION[$namespace] = array(
|
||||
self::IDENTIFIER_EXPIRES => time() + $this->getCookieLifetime(),
|
||||
self::IDENTIFIER_MESSAGES => array()
|
||||
);
|
||||
}
|
||||
|
||||
$this->_data = &$_SESSION[$namespace];
|
||||
if (!isset($this->_data['messages'])) {
|
||||
$this->_data['messages'] = array();
|
||||
if (!isset($this->_data[self::IDENTIFIER_MESSAGES]) || !is_array($this->_data[self::IDENTIFIER_MESSAGES])) {
|
||||
$this->_data[self::IDENTIFIER_MESSAGES] = array();
|
||||
}
|
||||
}
|
||||
|
||||
public function getCookieLifetime()
|
||||
{
|
||||
$lifetime = Wootook::getWebsiteConfig(self::COOKIE_LIFETIME_CONFIG_KEY);
|
||||
if ($lifetime <= 0) {
|
||||
if (!is_numeric($lifetime) || $lifetime <= 0) {
|
||||
return 900;
|
||||
}
|
||||
|
||||
|
|
@ -73,19 +82,27 @@ class Wootook_Core_Model_Session
|
|||
|
||||
public function getCookieDomain()
|
||||
{
|
||||
return Wootook::getWebsiteConfig(self::COOKIE_DOMAIN_CONFIG_KEY);
|
||||
$domain = Wootook::getWebsiteConfig(self::COOKIE_DOMAIN_CONFIG_KEY);
|
||||
if ($domain === null) {
|
||||
return $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
return $domain;
|
||||
}
|
||||
|
||||
public function getCookiePath()
|
||||
{
|
||||
return Wootook::getWebsiteConfig(self::COOKIE_PATH_CONFIG_KEY);
|
||||
$path = Wootook::getWebsiteConfig(self::COOKIE_PATH_CONFIG_KEY);
|
||||
if ($path === null) {
|
||||
return '/';
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function getMessages($clear = true)
|
||||
{
|
||||
$messages = $this->_data['messages'];
|
||||
$messages = $this->_data[self::IDENTIFIER_MESSAGES];
|
||||
if ($clear == true) {
|
||||
$this->_data['messages'] = array();
|
||||
$this->_data[self::IDENTIFIER_MESSAGES] = array();
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
|
@ -96,13 +113,13 @@ class Wootook_Core_Model_Session
|
|||
$type = self::DEBUG;
|
||||
}
|
||||
|
||||
if (!isset($this->_data['messages'])) {
|
||||
$this->_data['messages'] = array();
|
||||
if (!isset($this->_data[self::IDENTIFIER_MESSAGES])) {
|
||||
$this->_data[self::IDENTIFIER_MESSAGES] = array();
|
||||
}
|
||||
if (!isset($this->_data['messages'][self::$_levels[$type]])) {
|
||||
$this->_data['messages'][self::$_levels[$type]] = array();
|
||||
if (!isset($this->_data[self::IDENTIFIER_MESSAGES][self::$_levels[$type]])) {
|
||||
$this->_data[self::IDENTIFIER_MESSAGES][self::$_levels[$type]] = array();
|
||||
}
|
||||
$this->_data['messages'][self::$_levels[$type]][] = $message;
|
||||
$this->_data[self::IDENTIFIER_MESSAGES][self::$_levels[$type]][] = $message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -120,7 +137,7 @@ class Wootook_Core_Model_Session
|
|||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return $this->addMessage(vsprintf($message, $args), self::ERROR);
|
||||
return $this->addMessage(vsprintf($message, $args), self::ERR);
|
||||
}
|
||||
|
||||
public function addWarning($message, $_ = null)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class Wootook_Core_Time
|
|||
public static function init($timezone = null)
|
||||
{
|
||||
if ($timezone === null) {
|
||||
$timezone = Wootook::getConfig('date/timezone');
|
||||
$timezone = Wootook::getConfig('system/date/timezone');
|
||||
}
|
||||
if ($timezone === null) {
|
||||
$timezone = 'GMT';
|
||||
|
|
|
|||
|
|
@ -129,34 +129,51 @@ class Wootook_Core_View
|
|||
return Wootook::getUrl($uri, $params);
|
||||
}
|
||||
|
||||
public function getSkinUrl($uri, Array $params = array())
|
||||
public function getSkinUrl($uri, Array $params = array(), $theme = null, $package = null)
|
||||
{
|
||||
$package = $this->getLayout()->getPackage();
|
||||
if (empty($package)) {
|
||||
$package = Wootook_Core_Layout::DEFAULT_PACKAGE;
|
||||
}
|
||||
|
||||
$user = Wootook_Empire_Model_User::getSingleton();
|
||||
if ($user !== null && $user->getId()) {
|
||||
$theme = $user->getSkinPath();
|
||||
}
|
||||
if (empty($theme)) {
|
||||
if ($theme === null || empty($theme)) {
|
||||
$theme = $this->getLayout()->getTheme();
|
||||
}
|
||||
if (empty($theme)) {
|
||||
if ($theme === null || empty($theme)) {
|
||||
$theme = Wootook_Core_Layout::DEFAULT_THEME;
|
||||
}
|
||||
|
||||
$pattern = ROOT_PATH . DIRECTORY_SEPARATOR . 'skin/%s/%s/{$uri}';
|
||||
|
||||
if (Wootook::fileExists(sprintf($pattern, $package, $theme))) {
|
||||
return Wootook::getSkinUrl($package, $theme, $uri, $params);
|
||||
if ($package === null || empty($package)) {
|
||||
$package = $this->getLayout()->getPackage();
|
||||
}
|
||||
if ($package === null || empty($package)) {
|
||||
$package = Wootook_Core_Layout::DEFAULT_PACKAGE;
|
||||
}
|
||||
$domain = $this->getLayout()->getDomain();
|
||||
|
||||
$baseUrl = Wootook::getBaseUrl('skin');
|
||||
$basePath = Wootook::getBasePath('skin');
|
||||
$pathPattern = $basePath . "{$domain}/%s/%s/{$uri}";
|
||||
$urlPattern = $baseUrl . "{$domain}/%s/%s/{$uri}";
|
||||
|
||||
if (count($params) > 0) {
|
||||
$serializedParams = array();
|
||||
foreach ($params as $paramKey => $paramValue) {
|
||||
if ($paramValue) {
|
||||
$serializedParams[] = "{$paramKey}={$paramValue}";
|
||||
}
|
||||
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);
|
||||
$urlPattern .= '?' . implode('&', $serializedParams);
|
||||
}
|
||||
|
||||
if (Wootook::fileExists(sprintf($pathPattern, $package, $theme))) {
|
||||
return sprintf($urlPattern, $package, $theme);
|
||||
}
|
||||
if (Wootook::fileExists(sprintf($pathPattern, $package, Wootook_Core_Layout::DEFAULT_THEME))) {
|
||||
return sprintf($urlPattern, $package, Wootook_Core_Layout::DEFAULT_THEME);
|
||||
}
|
||||
|
||||
return sprintf($urlPattern, Wootook_Core_Layout::DEFAULT_PACKAGE, Wootook_Core_Layout::DEFAULT_THEME);
|
||||
}
|
||||
|
||||
public function setPartial($name, $content)
|
||||
|
|
@ -172,6 +189,9 @@ class Wootook_Core_View
|
|||
|
||||
public function getPartial($name)
|
||||
{
|
||||
if (!$this->hasPartial($name)) {
|
||||
return null;
|
||||
}
|
||||
return $this->_partials[$name];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,16 +161,16 @@ INSERT IGNORE INTO {$this->getTableName('core_config')} (`website_id`, `game_id`
|
|||
(1, 1, 'game/noob-protection/points-cap', '5000'),
|
||||
(1, 1, 'game/noob-protection/multiplier', '5'),
|
||||
|
||||
(0, 0, 'web/cookie/name', '__wtk'),
|
||||
(0, 0, 'web/cookie/time', '2592000'),
|
||||
(0, 0, 'web/cookie/domain', ''),
|
||||
(0, 0, 'web/cookie/path', ''),
|
||||
-- (0, 0, 'web/cookie/name', '__wtk'),
|
||||
-- (0, 0, 'web/cookie/time', '2592000'),
|
||||
-- (0, 0, 'web/cookie/domain', ''),
|
||||
-- (0, 0, 'web/cookie/path', ''),
|
||||
|
||||
(1, 1, 'web/cookie/name', '__wtk_1_1'),
|
||||
|
||||
(0, 0, 'web/session/time', '900'),
|
||||
(0, 0, 'web/session/domain', '.wootook.org'),
|
||||
(0, 0, 'web/session/path', '/'),
|
||||
-- (0, 0, 'web/session/time', '900'),
|
||||
-- (0, 0, 'web/session/domain', '.wootook.org'),
|
||||
-- (0, 0, 'web/session/path', '/'),
|
||||
|
||||
(0, 0, 'engine/options/bbcode', '1'),
|
||||
(0, 0, 'engine/options/ga', '1'),
|
||||
|
|
|
|||
|
|
@ -38,47 +38,64 @@ class Wootook_Database
|
|||
return self::$_connectionAliases[$connectionName];
|
||||
}
|
||||
|
||||
if ($alias = Wootook::getConfig("database/{$connectionName}/use")) {
|
||||
$connectionConfig = Wootook::getConfig("resource/database/{$connectionName}");
|
||||
if ($alias = $connectionConfig->use) {
|
||||
self::$_connectionAliases[$connectionName] = self::getConnection($alias);
|
||||
|
||||
return self::$_connectionAliases[$connectionName];
|
||||
}
|
||||
|
||||
self::$_connections[$connectionName] = self::_initConnection($connectionName);
|
||||
self::$_connections[$connectionName] = self::_initConnection($connectionName,
|
||||
$connectionConfig->engine, $connectionConfig->params, $connectionConfig->options);
|
||||
}
|
||||
|
||||
return self::$_connections[$connectionName];
|
||||
}
|
||||
|
||||
private static function _initConnection($connectionName)
|
||||
private static function _initConnection($connectionName, $engine, $params, $options = array())
|
||||
{
|
||||
$hostname = Wootook::getConfig("database/{$connectionName}/params/hostname");
|
||||
$username = Wootook::getConfig("database/{$connectionName}/params/username");
|
||||
$password = Wootook::getConfig("database/{$connectionName}/params/password");
|
||||
$database = Wootook::getConfig("database/{$connectionName}/params/database");
|
||||
if (is_array($params)) {
|
||||
$params = new Wootook_Core_Config_Node($params);
|
||||
} else if (!$params instanceof Wootook_Core_Config_Node) {
|
||||
$params = new Wootook_Core_Config_Node(array());
|
||||
}
|
||||
|
||||
if (empty($hostname) || empty($username) || empty($database)) {
|
||||
if ($options instanceof Wootook_Core_Config_Node) {
|
||||
$options = $options->toArray();
|
||||
} else if (!is_array($options)) {
|
||||
$options = array();
|
||||
}
|
||||
|
||||
$hostname = $params->hostname;
|
||||
$username = $params->username;
|
||||
$password = $params->password;
|
||||
$database = $params->database;
|
||||
|
||||
if (empty($params->hostname) || empty($params->username) || empty($params->database)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$dsn = "mysql:dbname={$database};host={$hostname}";
|
||||
if (($port = Wootook::getConfig("database/{$connectionName}/params/port")) && is_numeric($port)) {
|
||||
$dsn .= ";port={$port}";
|
||||
$dsn = "mysql:dbname={$params->database};host={$params->hostname}";
|
||||
if (is_numeric($params->port)) {
|
||||
$dsn .= ";port={$params->database}";
|
||||
}
|
||||
|
||||
$event = Wootook::dispatchEvent('database.prepare-options', array(
|
||||
'name' => $connectionName,
|
||||
'options' => array_merge(self::$options, Wootook::getConfig("database/{$connectionName}/options")->toArray())
|
||||
'options' => array_merge(self::$options, $options)
|
||||
));
|
||||
|
||||
$options = $event->getData('options');
|
||||
|
||||
$connection = new self($dsn, $username, $password, $options);
|
||||
$connection = new self($dsn, $params->username, $params->password, $options);
|
||||
$connection->_dsn = $dsn;
|
||||
$connection->_username = $username;
|
||||
$connection->_password = $password;
|
||||
|
||||
if (($prefix = Wootook::getConfig("database/{$connectionName}/table_prefix")) !== null) {
|
||||
if (defined('DEBUG')) {
|
||||
$connection->_password = $password;
|
||||
}
|
||||
|
||||
if (($prefix = Wootook::getConfig("resource/database/{$connectionName}/table_prefix")) !== null) {
|
||||
$connection->setTablePrefix($prefix);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract
|
|||
$lang = includeLang('imperium');
|
||||
}
|
||||
if ($resourceId == 'cristal') {
|
||||
$resourceId = 'crystal';
|
||||
$resourceId = 'crystal'; // FIXME: backward compatibility
|
||||
}
|
||||
|
||||
if (isset($lang[$resourceId])) {
|
||||
|
|
|
|||
|
|
@ -160,12 +160,12 @@ class Wootook_Empire_Model_Planet
|
|||
|
||||
public function getLastUpdate()
|
||||
{
|
||||
return $this->getData('last_update');
|
||||
return strtotime($this->getData('last_update'));
|
||||
}
|
||||
|
||||
public function setLastUpdate($time)
|
||||
{
|
||||
return $this->setData('last_update', $time);
|
||||
return $this->setData('last_update', date('Y-m-d G:i:s', $time));
|
||||
}
|
||||
|
||||
public function getBuildingFields()
|
||||
|
|
@ -199,8 +199,8 @@ class Wootook_Empire_Model_Planet
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($this->getElement($resourceData['storage'])) {
|
||||
$storageEnhancementFactor = Math::floor(Math::pow(1.6, $this->getElement($resourceData['storage'])));
|
||||
if ($this->getElement($resourceData['storage_field'])) {
|
||||
$storageEnhancementFactor = Math::floor(Math::pow(1.6, $this->getElement($resourceData['storage_field'])));
|
||||
$storageEnhancement = Math::mul(BASE_STORAGE_SIZE / 2, $storageEnhancementFactor);
|
||||
} else {
|
||||
$storageEnhancement = 0;
|
||||
|
|
@ -987,7 +987,7 @@ class Wootook_Empire_Model_Planet
|
|||
|
||||
$planet->updateBuildingQueue($time);
|
||||
$planet->updateResources($time);
|
||||
$planet->getShipyard()->updateQueue($time);
|
||||
$planet->getShipyard()->updateQueue($time); // FIXME
|
||||
$planet->setLastUpdate($time);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ class Wootook_Empire_Model_Planet_Builder
|
|||
{
|
||||
$types = Wootook_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
if ($types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) {
|
||||
return true;
|
||||
if (!$types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBuildingTime($buildingId, $level)
|
||||
|
|
|
|||
85
application/config/local.php.sample
Normal file
85
application/config/local.php.sample
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php return array(
|
||||
'global' => array(
|
||||
'resource' => array(
|
||||
'database' => array(
|
||||
'default' => array(
|
||||
'engine' => 'mysql',
|
||||
'options' => array(
|
||||
),
|
||||
'params' => array(
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
'database' => 'db_wootook'
|
||||
),
|
||||
'table_prefix' => 'wtk_',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'backend' => array(
|
||||
'web' => array(
|
||||
'url' => array(
|
||||
'base' => 'http://testing.wootook.org/',
|
||||
'skin' => 'http://testing.wootook.org/skin/',
|
||||
'js' => 'http://testing.wootook.org/js/',
|
||||
'css' => 'http://testing.wootook.org/css/',
|
||||
),
|
||||
'session' => array(
|
||||
'time' => 900,
|
||||
'domain' => 'testing.wootook.org',
|
||||
'path' => '/'
|
||||
)
|
||||
),
|
||||
'system' => array(
|
||||
'path' => array(
|
||||
'base' => ROOT_PATH,
|
||||
'skin' => ROOT_PATH . 'skin' . DIRECTORY_SEPARATOR,
|
||||
),
|
||||
'date' => array(
|
||||
'timezone' => 'Europe/Paris'
|
||||
),
|
||||
),
|
||||
),
|
||||
'frontend' => array(
|
||||
'web' => array(
|
||||
'url' => array(
|
||||
'base' => 'http://testing.wootook.org/',
|
||||
'skin' => 'http://testing.wootook.org/skin/',
|
||||
'js' => 'http://testing.wootook.org/js/',
|
||||
'css' => 'http://testing.wootook.org/css/',
|
||||
),
|
||||
'session' => array(
|
||||
'time' => 900,
|
||||
'domain' => 'testing.wootook.org',
|
||||
'path' => '/'
|
||||
)
|
||||
),
|
||||
'system' => array(
|
||||
'path' => array(
|
||||
'base' => ROOT_PATH,
|
||||
'skin' => ROOT_PATH . 'skin' . DIRECTORY_SEPARATOR,
|
||||
),
|
||||
'date' => array(
|
||||
'timezone' => 'Europe/Paris'
|
||||
),
|
||||
),
|
||||
'engine' => array(
|
||||
'storyline' => array(
|
||||
'universe' => 'legacies',
|
||||
'episode' => 'default',
|
||||
),
|
||||
'core' => array(
|
||||
'use_large_numbers' => (bool) $request->getPost('use_large_numbers')
|
||||
),
|
||||
'universe' => array(
|
||||
'galaxies' => $request->getPost('galaxies'),
|
||||
'systems' => $request->getPost('systems'),
|
||||
'positions' => $request->getPost('positions')
|
||||
),
|
||||
'combat' => array(
|
||||
'allow_spy_drone_attacks' => (bool) $request->getPost('allow_spy_drone_attacks')
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
93
application/config/system.php
Normal file
93
application/config/system.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php return array(
|
||||
'global' => array(
|
||||
'resource' => array(
|
||||
'database' => array(
|
||||
'default' => array(
|
||||
'engine' => 'mysql',
|
||||
'options' => array(
|
||||
),
|
||||
'params' => array(
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
'database' => 'db_wootook'
|
||||
),
|
||||
'table_prefix' => 'wtk_',
|
||||
),
|
||||
'core_setup' => array(
|
||||
'use' => 'default'
|
||||
),
|
||||
'core_read' => array(
|
||||
'use' => 'default'
|
||||
),
|
||||
'core_write' => array(
|
||||
'use' => 'default'
|
||||
),
|
||||
)
|
||||
)
|
||||
),
|
||||
'default' => array(
|
||||
'engine' => array(
|
||||
'core' => array(
|
||||
'use_large_numbers' => true,
|
||||
),
|
||||
'universe' => array(
|
||||
'galaxies' => 3,
|
||||
'systems' => 100,
|
||||
'positions' => 15,
|
||||
),
|
||||
'combat' => array(
|
||||
'allow_spy_drone_attacks' => true,
|
||||
)
|
||||
),
|
||||
'system' => array(
|
||||
'date' => array(
|
||||
'timezone' => 'Europe/Paris'
|
||||
),
|
||||
),
|
||||
),
|
||||
'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',
|
||||
'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',
|
||||
'admin' => 'admin.php'
|
||||
),
|
||||
)
|
||||
);
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
'admin' => array(
|
||||
'update' => '1column',
|
||||
'reference' => array(
|
||||
'content' => array(
|
||||
'header' => array(
|
||||
'children' => array(
|
||||
'navigation' => array(
|
||||
'type' => 'core/html.navigation',
|
||||
|
|
@ -239,5 +239,45 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'admin.grid' => array(
|
||||
'update' => 'admin',
|
||||
'reference' => array(
|
||||
'content' => array(
|
||||
'children' => array(
|
||||
'grid.container' => array(
|
||||
'type' => 'admin/grid.container',
|
||||
'template' => 'grid/container.phtml',
|
||||
'children' => array(
|
||||
'mass-actions' => array(
|
||||
'type' => 'admin/grid.mass-actions',
|
||||
'template' => 'grid/view.phtml',
|
||||
),
|
||||
'grid' => array(
|
||||
'type' => 'admin/grid.view',
|
||||
'template' => 'grid/view.phtml',
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'admin.user.grid' => array(
|
||||
'update' => 'admin.grid',
|
||||
'reference' => array(
|
||||
'grid' => array(
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'addColumn',
|
||||
'params' => array(
|
||||
'name' => 'index',
|
||||
'type' => 'indexer',
|
||||
'config' => array()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
183
application/design/backend/base/default/layouts/page.php
Normal file
183
application/design/backend/base/default/layouts/page.php
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
<?php return array(
|
||||
'1column' => 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'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
@ -0,0 +1 @@
|
|||
a
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<html>
|
||||
<head>
|
||||
<?php echo $this->head->render()?>
|
||||
</head>
|
||||
<body<?php if ($classes = $this->getBodyClasses()):?> class="<?php echo $this->escape($classes)?>"<?php endif?>>
|
||||
<div class="global">
|
||||
<div class="header">
|
||||
<?php echo $this->header->render()?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $this->content->render()?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<html>
|
||||
<head>
|
||||
<?php echo $this->head->render()?>
|
||||
</head>
|
||||
<body<?php if ($classes = $this->getBodyClasses()):?> class="<?php echo $this->escape($classes)?>"<?php endif?>>
|
||||
<div class="global">
|
||||
<div class="header">
|
||||
<?php echo $this->header->render()?>
|
||||
</div>
|
||||
<div class="left">
|
||||
<?php echo $this->left->render()?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $this->content->render()?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<html>
|
||||
<head>
|
||||
<?php echo $this->head->render()?>
|
||||
</head>
|
||||
<body<?php if ($classes = $this->getBodyClasses()):?> class="<?php echo $this->escape($classes)?>"<?php endif?>>
|
||||
<div class="global">
|
||||
<div class="header">
|
||||
<?php echo $this->header->render()?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $this->content->render()?>
|
||||
</div>
|
||||
<div class="right">
|
||||
<?php echo $this->left->render()?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<html>
|
||||
<head>
|
||||
<?php echo $this->head->render()?>
|
||||
</head>
|
||||
<body<?php if ($classes = $this->getBodyClasses()):?> class="<?php echo $this->escape($classes)?>"<?php endif?>>
|
||||
<div class="global">
|
||||
<div class="header">
|
||||
<?php echo $this->header->render()?>
|
||||
</div>
|
||||
<div class="left">
|
||||
<?php echo $this->left->render()?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php echo $this->content->render()?>
|
||||
</div>
|
||||
<div class="right">
|
||||
<?php echo $this->left->render()?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<div class="navigation-container">
|
||||
<div class="navigation">
|
||||
<?php foreach ($this->getAllPartials() as $partial):?>
|
||||
<div class="navigation-node" rel="<?php echo $this->escape($partial->getNameInLayout())?>">
|
||||
<p class="title"><?php echo $this->escape($partial->getTitle())?></p>
|
||||
</div>
|
||||
<?php endforeach?>
|
||||
<span class="last"></span>
|
||||
<?php foreach ($this->getAllPartials() as $partial):?>
|
||||
<?php echo $partial->render()?>
|
||||
<?php endforeach?>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
(function($){
|
||||
var navigation = $('.navigation');
|
||||
$('.navigation-node', navigation).mouseenter(function(e){
|
||||
$('.navigation-node', $(this).parent()).removeClass('hover');
|
||||
$(this).addClass('hover');
|
||||
|
||||
$('.navigation-links', $(this).parent()).hide();
|
||||
var rel = ($(this).attr('rel')).replace(/(\.|\\|\\:|\\#)/, '\\$1');
|
||||
$('#navigation\\:' + rel).show();
|
||||
});
|
||||
})(jQuery);
|
||||
//]]>
|
||||
</script>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<div class="navigation-links" id="navigation:<?php echo $this->escape($this->getNameInLayout())?>">
|
||||
<?php foreach ($this->getAllPartials() as $name => $partial):?>
|
||||
<?php echo $partial->render()?>
|
||||
<?php endforeach?>
|
||||
</div>
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<tr>
|
||||
<th colspan="2">
|
||||
<br><?php echo $this->getData('ins_tx_acc1')?><br>
|
||||
<?php echo $this->getData('ins_tx_acc2')?><br><br>
|
||||
<table width="270" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_acc_user')?>:</td>
|
||||
<td><input name="adm_user" size="20" maxlength="20" type="text" onKeypress="
|
||||
if (event.keyCode==60 || event.keyCode==62) event.returnValue = false;
|
||||
if (event.which==60 || event.which==62) return false;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_acc_pass')?>:</td>
|
||||
<td><input name="adm_pass" size="20" maxlength="20" type="password" onKeypress="
|
||||
if (event.keyCode==60 || event.keyCode==62) event.returnValue = false;
|
||||
if (event.which==60 || event.which==62) return false;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_acc_email')?>:</td>
|
||||
<td><input name="adm_email" size="20" maxlength="40" type="text" onKeypress="
|
||||
if (event.keyCode==60 || event.keyCode==62) event.returnValue = false;
|
||||
if (event.which==60 || event.which==62) return false;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_acc_planet')?>:</td>
|
||||
<td><input name="adm_planet" size="20" maxlength="20" type="text" onKeypress="
|
||||
if (event.keyCode==60 || event.keyCode==62) event.returnValue = false;
|
||||
if (event.which==60 || event.which==62) return false;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_acc_sex')?>:</td>
|
||||
<td><select name="adm_sex">
|
||||
<option value=""><?php echo $this->getData('ins_acc_sex0')?></option>
|
||||
<option value="M"><?php echo $this->getData('ins_acc_sex1')?></option>
|
||||
<option value="F"><?php echo $this->getData('ins_acc_sex2')?></option>
|
||||
</select></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2"><input type="button" name="next" onclick="submit();" value="<?php echo $this->getData('ins_btn_creat')?>" ></th>
|
||||
</tr>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<tr>
|
||||
<th colspan="2">
|
||||
<br><?php echo $this->getData('ins_tx_done2')?><br>
|
||||
<?php echo $this->getData('ins_tx_done3')?><br><br>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2"><input type="button" name="next" onclick="self.location.href='../'" value="<?php echo $this->getData('ins_btn_login')?>" ></th>
|
||||
</tr>
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<br><br>
|
||||
<table width="700">
|
||||
<tbody><tr>
|
||||
<td width="120px" class="c" align="left"><font size="2px"><?php echo $this->getData('ins_appname')?></font></td>
|
||||
<td width="580px" rowspan="2" class="c" align="right"><font size="2px"><?php echo $this->getData('ins_tx_sys')?></font><br /><?php echo $this->getData('ins_tx_state')?> <?php echo $this->getData('ins_state')?></td>
|
||||
</tr><tr>
|
||||
<th rowspan="4"><table border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td width="124" align="center"><a href="index.php?mode=intro" accesskey="i"><?php echo $this->getData('ins_mnu_intro')?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="index.php?mode=ins&page=1" accesskey="i"><?php echo $this->getData('ins_mnu_inst')?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="index.php?mode=goto&page=1" accesskey="b"><?php echo $this->getData('ins_mnu_goto')?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="index.php?mode=upg" accesskey="u"><?php echo $this->getData('ins_mnu_upgr')?></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="index.php?mode=bye" accesskey="b"><?php echo $this->getData('ins_mnu_quit')?></a></td>
|
||||
</tr>
|
||||
</table></th>
|
||||
</tr>
|
||||
<form action="<?php echo $this->getData('dis_ins_btn')?>" method="post">
|
||||
<?php echo $this->getData('ins_page')?>
|
||||
</form>
|
||||
</table>
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<tr>
|
||||
<th colspan="2">
|
||||
<br><?php echo $this->getData('ins_tx_inst1')?><br>
|
||||
<?php echo $this->getData('ins_tx_inst2')?><br>
|
||||
<?php echo $this->getData('ins_tx_inst3')?><br><br>
|
||||
<table width="270" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_form_server')?>:</td>
|
||||
<td><input type="text" name="host" value="localhost" size="20"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_form_db')?>:</td>
|
||||
<td><input type="text" name="db" value="" size="20"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_form_prefix')?>:</td>
|
||||
<td><input type="text" name="prefix" value="game_" size="20"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_form_login')?>:</td>
|
||||
<td><input type="text" name="user" value="" size="20"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $this->getData('ins_form_pass')?>:</td>
|
||||
<td><input type="password" name="passwort" value="" size="20"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2"><input type="button" name="next" onclick="submit();" value="<?php echo $this->getData('ins_btn_inst')?>" ></th>
|
||||
</tr>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<tr>
|
||||
<th colspan="2">
|
||||
<br><br><?php echo $this->getData('ins_tx_done1')?><br><br>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2"><input type="button" name="next" onclick="submit();" value="<?php echo $this->getData('ins_btn_next')?>" ></th>
|
||||
</tr>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<tr>
|
||||
<th colspan="2">
|
||||
<br><?php echo $this->getData('ins_tx_done4')?><br>
|
||||
<?php echo $this->getData('ins_tx_done3')?><br><br>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2"><input type="button" name="next" onclick="self.location.href='../'" value="<?php echo $this->getData('ins_btn_login')?>" ></th>
|
||||
</tr>
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue