Updated Database component
Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
03efb85c0b
commit
7e7924e97e
385 changed files with 1950 additions and 603 deletions
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -98,7 +98,7 @@ include ROOT_PATH . 'includes/constants.php';
|
|||
Wootook_Core_ErrorProfiler::register();
|
||||
Wootook_Core_Helper_Config_Events::registerEvents();
|
||||
|
||||
if (!defined('IN_INSTALL') && !Wootook::fileExists(APPLICATION_PATH . 'configs' . DIRECTORY_SEPARATOR . 'local.php')) {
|
||||
if (!Wootook::$isInstalled) {
|
||||
Wootook::getResponse()
|
||||
->setRedirect(Wootook::getStaticUrl('install/'), Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_TEMPORARY)
|
||||
->sendHeaders();
|
||||
|
|
|
|||
|
|
@ -372,11 +372,18 @@ class Wootook
|
|||
|
||||
private static function _appendDatabaseConfig(Wootook_Core_Config_Node $config, $type = 'global', $model = null)
|
||||
{
|
||||
if (self::$_ignoreDatabaseConfig) {
|
||||
if (self::$_ignoreDatabaseConfig || !self::$isInstalled) {
|
||||
return $config;
|
||||
}
|
||||
|
||||
try {
|
||||
$adapter = Wootook_Core_Database_ConnectionManager::getSingleton()
|
||||
->getConnection('core_read');
|
||||
} catch (Wootook_Core_Exception_Database_AdapterError $e) {
|
||||
self::$isInstalled = false;
|
||||
return $config;
|
||||
}
|
||||
|
||||
$adapter = Wootook_Core_Database_Adapter_Pdo_Mysql::getConnection('core_read');
|
||||
$select = $adapter->select('core_config');
|
||||
|
||||
switch ($type) {
|
||||
|
|
@ -400,7 +407,7 @@ class Wootook
|
|||
break;
|
||||
}
|
||||
|
||||
foreach ($statement->fetch() as $row) {
|
||||
foreach ($statement as $row) {
|
||||
$config->setConfig($row['config_path'], $row['config_value']);
|
||||
}
|
||||
|
||||
|
|
@ -547,6 +554,13 @@ class Wootook
|
|||
|
||||
try {
|
||||
$website = self::getWebsite($websiteId);
|
||||
} catch (Wootook_Core_Exception_WebsiteError $e) {
|
||||
self::$isInstalled = false;
|
||||
|
||||
$website = new Wootook_Core_Model_Website();
|
||||
$website->setId(0)->setData('code', 'install');
|
||||
self::addWebsite($website);
|
||||
self::setDefaultWebsite($website);
|
||||
} catch (Wootook_Core_Exception_RuntimeException $e) {
|
||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||
return null;
|
||||
|
|
@ -593,6 +607,13 @@ class Wootook
|
|||
|
||||
try {
|
||||
$game = self::getGame($gameId);
|
||||
} catch (Wootook_Core_Exception_GameError $e) {
|
||||
self::$isInstalled = false;
|
||||
|
||||
$game = new Wootook_Core_Model_Game();
|
||||
$game->setId(0)->setData('code', 'install')->setData('website_id', self::getDefaultWebsite()->getId());
|
||||
self::addGame($game);
|
||||
self::setDefaultGame($game);
|
||||
} catch (Wootook_Core_Exception_RuntimeException $e) {
|
||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Database_Adapter_Adapter
|
||||
{
|
||||
protected $_handler = null;
|
||||
|
||||
protected $_tablePrefix = null;
|
||||
|
||||
public function getDriverHandler()
|
||||
{
|
||||
return $this->_handler;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $prefix
|
||||
* @return Wootook_Core_Database_Adapter_Pdo_Mysql
|
||||
*/
|
||||
public function setTablePrefix($prefix)
|
||||
{
|
||||
$this->_tablePrefix = $prefix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTablePrefix()
|
||||
{
|
||||
return $this->_tablePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Database_Sql_Select
|
||||
*/
|
||||
public function select()
|
||||
{
|
||||
return new Wootook_Core_Database_Sql_Select($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Database_Sql_Insert
|
||||
*/
|
||||
public function insert()
|
||||
{
|
||||
return new Wootook_Core_Database_Sql_Insert($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Database_Sql_Update
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
return new Wootook_Core_Database_Sql_Update($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Database_Sql_Delete
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
return new Wootook_Core_Database_Sql_Delete($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @return string
|
||||
*/
|
||||
abstract public function quote($data);
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
abstract public function quoteIdentifier($identifier);
|
||||
|
||||
/**
|
||||
* @param string $identifier
|
||||
* @return string
|
||||
*/
|
||||
public function quoteInto($string, $values)
|
||||
{
|
||||
$parts = preg_split('#(\?|:[\w_]+)#', $identifier, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
$result = '';
|
||||
if (is_array($values)) {
|
||||
$index = 0;
|
||||
foreach ($parts as $part) {
|
||||
if ($part == '?') {
|
||||
$result .= $this->quote($values[$index++]);
|
||||
} else if ($part[0] == ':') {
|
||||
$key = substr($part, 1);
|
||||
|
||||
if (isset($values[$key])) {
|
||||
$result .= $this->quote($values[$key]);
|
||||
} else if (isset($values[$part])) {
|
||||
$result .= $this->quote($values[$part]);
|
||||
} else {
|
||||
$result .= $part;
|
||||
}
|
||||
} else {
|
||||
$result .= $part;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($parts as $part) {
|
||||
if ($part == '?' || $part[0] == ':') {
|
||||
$result .= $this->quote($values);
|
||||
} else {
|
||||
$result .= $part;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
public function query($sql)
|
||||
{
|
||||
$statement = $this->prepare($sql);
|
||||
if (!$statement->execute()) {
|
||||
throw new Wootook_Core_Exception_Database_AdapterError($this, 'Could not execute query.');
|
||||
}
|
||||
|
||||
return $statement;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function execute($sql)
|
||||
{
|
||||
$statement = $this->prepare($sql);
|
||||
return $statement->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
abstract public function prepare($sql);
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function beginTransaction();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function commit();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function rollback();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function lastInsertId();
|
||||
}
|
||||
|
|
@ -3,35 +3,120 @@
|
|||
class Wootook_Core_Database_Adapter_Pdo_Mysql
|
||||
extends Wootook_Core_Database_Adapter_Adapter
|
||||
{
|
||||
protected $_tablePrefix = null;
|
||||
protected $_dsn = null;
|
||||
protected $_username = null;
|
||||
protected $_password = null;
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param Wootook_Core_Config_Node $config
|
||||
* @param array $params
|
||||
*/
|
||||
public function __construct(Wootook_Core_Config_Node $config, Array $options = array())
|
||||
{
|
||||
$dsn = "mysql:host={$config->hostname};dbname={$config->database}";
|
||||
if (is_numeric($config->port)) {
|
||||
$dsn .= ";port={$config->database}";
|
||||
}
|
||||
|
||||
try {
|
||||
$this->_handler = new PDO($dsn, $config->username, $config->password, $options);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Wootook_Core_Database_Adapter_Adapter::quoteIdentifier()
|
||||
*/
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
return "`$identifier`";
|
||||
}
|
||||
|
||||
public function setTablePrefix($prefix)
|
||||
public function quote($data)
|
||||
{
|
||||
$this->_tablePrefix = $prefix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTablePrefix()
|
||||
{
|
||||
return $this->_tablePrefix;
|
||||
try {
|
||||
return $this->_handler->quote($data);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
public function getTable($name)
|
||||
{
|
||||
return $this->getTablePrefix() . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Wootook_Core_Database_Adapter_Adapter::select()
|
||||
*/
|
||||
public function select($tableName = null)
|
||||
{
|
||||
return new Wootook_Core_Database_Sql_Mysql_Select($this, $tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
public function prepare($sql)
|
||||
{
|
||||
return new Wootook_Core_Database_Statement_Pdo_Mysql($this, $sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
try {
|
||||
return $this->_handler->beginTransaction();
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
try {
|
||||
return $this->_handler->commit();
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function rollback()
|
||||
{
|
||||
try {
|
||||
return $this->_handler->rollback();
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function lastInsertId()
|
||||
{
|
||||
try {
|
||||
return $this->_handler->lastInsertId();
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_AdapterError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,199 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Database_ConnectionManager
|
||||
extends Wootook_Core_PluginLoader_PluginLoader
|
||||
implements Wootook_Core_Singleton
|
||||
{
|
||||
const PROFILER = 'profiler';
|
||||
const CASE_FOLDING = 'case-folding';
|
||||
const AUTO_QUOTE_IDENTIFIERS = 'auto-quote-identifiers';
|
||||
const ALLOW_SERIALIZATION = 'allow-serialization';
|
||||
const AUTO_RECONNECT_ON_UNSERIALIZE = 'auto-reconnect-on-unserialize';
|
||||
|
||||
const INT_TYPE = 0;
|
||||
const BIGINT_TYPE = 1;
|
||||
const FLOAT_TYPE = 2;
|
||||
|
||||
const ATTR_AUTOCOMMIT = 0;
|
||||
const ATTR_PREFETCH = 1;
|
||||
const ATTR_TIMEOUT = 2;
|
||||
const ATTR_ERRMODE = 3;
|
||||
const ATTR_SERVER_VERSION = 4;
|
||||
const ATTR_CLIENT_VERSION = 5;
|
||||
const ATTR_SERVER_INFO = 6;
|
||||
const ATTR_CONNECTION_STATUS = 7;
|
||||
const ATTR_CASE = 8;
|
||||
const ATTR_CURSOR_NAME = 9;
|
||||
const ATTR_CURSOR = 10;
|
||||
const ATTR_ORACLE_NULLS = 11;
|
||||
const ATTR_PERSISTENT = 12;
|
||||
const ATTR_STATEMENT_CLASS = 13;
|
||||
const ATTR_FETCH_TABLE_NAMES = 14;
|
||||
const ATTR_FETCH_CATALOG_NAMES = 15;
|
||||
const ATTR_DRIVER_NAME = 16;
|
||||
const ATTR_STRINGIFY_FETCHES = 17;
|
||||
const ATTR_MAX_COLUMN_LEN = 18;
|
||||
|
||||
const CASE_NATURAL = 0;
|
||||
const CASE_UPPER = 1;
|
||||
const CASE_LOWER = 2;
|
||||
|
||||
const CURSOR_FWDONLY = 0;
|
||||
const CURSOR_SCROLL = 1;
|
||||
|
||||
const ERR_ALREADY_EXISTS = null;
|
||||
const ERR_CANT_MAP = null;
|
||||
const ERR_CONSTRAINT = null;
|
||||
const ERR_DISCONNECTED = null;
|
||||
const ERR_MISMATCH = null;
|
||||
const ERR_NO_PERM = null;
|
||||
const ERR_NONE = '00000';
|
||||
const ERR_NOT_FOUND = null;
|
||||
const ERR_NOT_IMPLEMENTED = null;
|
||||
const ERR_SYNTAX = null;
|
||||
const ERR_TRUNCATED = null;
|
||||
|
||||
const ERRMODE_SILENT = 0;
|
||||
const ERRMODE_WARNING = 1;
|
||||
const ERRMODE_EXCEPTION = 2;
|
||||
|
||||
const FETCH_LAZY = 0x000001;
|
||||
const FETCH_ASSOC = 0x000002;
|
||||
const FETCH_NUM = 0x000003;
|
||||
const FETCH_BOTH = 0x000004;
|
||||
const FETCH_OBJ = 0x000005;
|
||||
const FETCH_BOUND = 0x000006;
|
||||
const FETCH_COLUMN = 0x000007;
|
||||
const FETCH_CLASS = 0x000008;
|
||||
const FETCH_INTO = 0x000009;
|
||||
const FETCH_FUNC = 0x00000A;
|
||||
const FETCH_NAMED = 0x00000B;
|
||||
const FETCH_GROUP = 0x010000;
|
||||
const FETCH_UNIQUE = 0x030000;
|
||||
const FETCH_CLASSTYPE = 0x040000;
|
||||
const FETCH_SERIALIZE = 0x080000;
|
||||
|
||||
const FETCH_ORI_NEXT = 0;
|
||||
const FETCH_ORI_PRIOR = 1;
|
||||
const FETCH_ORI_FIRST = 2;
|
||||
const FETCH_ORI_LAST = 3;
|
||||
const FETCH_ORI_ABS = 4;
|
||||
const FETCH_ORI_REL = 5;
|
||||
|
||||
const PARAM_BOOL = 5;
|
||||
const PARAM_INPUT_OUTPUT = 0xFFFFFFFF80000000;
|
||||
const PARAM_INT = 1;
|
||||
const PARAM_LOB = 3;
|
||||
const PARAM_NULL = 0;
|
||||
const PARAM_STMT = 4;
|
||||
const PARAM_STR = 2;
|
||||
|
||||
const NULL_EMPTY_STRING = 1;
|
||||
const NULL_NATURAL = 0;
|
||||
const NULL_TO_STRING = null;
|
||||
|
||||
const DEFAULT_CONNECTION_NAME = 'default';
|
||||
|
||||
protected $_connections = array();
|
||||
protected $_connectionAliases = array();
|
||||
|
||||
protected static $_singleton = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->registerNamespace('Wootook_Core_Database_Adapter_');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Database_ConnectionManager
|
||||
*/
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected $_defaultOptions = array(
|
||||
self::ATTR_ERRMODE => self::ERRMODE_EXCEPTION
|
||||
);
|
||||
|
||||
public function getConnection($connectionName)
|
||||
{
|
||||
if (empty($connectionName) || $connectionName === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isset($this->_connections[$connectionName])) {
|
||||
if (isset($this->_connectionAliases[$connectionName])) {
|
||||
return $this->_connectionAliases[$connectionName];
|
||||
}
|
||||
|
||||
$connectionConfig = Wootook::getConfig("resource/database/{$connectionName}");
|
||||
if ($connectionConfig === null) {
|
||||
return null;
|
||||
}
|
||||
if ($alias = $connectionConfig->use) {
|
||||
$this->_connectionAliases[$connectionName] = self::getConnection($alias);
|
||||
|
||||
return $this->_connectionAliases[$connectionName];
|
||||
}
|
||||
|
||||
$this->_connections[$connectionName] = self::_initConnection($connectionName,
|
||||
$connectionConfig->engine, $connectionConfig->params, $connectionConfig->options);
|
||||
}
|
||||
|
||||
return $this->_connections[$connectionName];
|
||||
}
|
||||
|
||||
private function _initConnection($connectionName, $engine, $params, $options = array())
|
||||
{
|
||||
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 ($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;
|
||||
}
|
||||
|
||||
$event = Wootook::dispatchEvent('database.prepare-options', array(
|
||||
'name' => $connectionName,
|
||||
'options' => array_merge($this->_defaultOptions, $options)
|
||||
));
|
||||
|
||||
$options = $event->getData('options');
|
||||
|
||||
$connection = $this->load($engine, false, array($params, $options));
|
||||
|
||||
if (($prefix = Wootook::getConfig("resource/database/{$connectionName}/table_prefix")) !== null) {
|
||||
$connection->setTablePrefix($prefix);
|
||||
}
|
||||
|
||||
Wootook::dispatchEvent('database.init', array(
|
||||
'name' => $connectionName,
|
||||
'handler' => $connection
|
||||
));
|
||||
|
||||
return $connection;
|
||||
}
|
||||
|
||||
protected function _load($className, $useSingleton, Array $constructorParams = array())
|
||||
{
|
||||
$reflection = new ReflectionClass($className);
|
||||
return $reflection->newInstanceArgs($constructorParams);
|
||||
}
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ class Wootook_Core_Database_Orm_DataMapper
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function _load($className, $useSingleton)
|
||||
protected function _load($className, $useSingleton, Array $constructorParams = array())
|
||||
{
|
||||
$reflection = new ReflectionClass($className);
|
||||
if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) {
|
||||
|
|
@ -60,7 +60,7 @@ class Wootook_Core_Database_Orm_DataMapper
|
|||
}
|
||||
|
||||
try {
|
||||
return $reflection->newInstance();
|
||||
return $reflection->newInstance($this);
|
||||
} catch (ReflectionException $e) {
|
||||
Wootook_Core_ErrorProfiler::getSingleton()
|
||||
->addException($e);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Database_Orm_DataMapper_Array
|
||||
extends Wootook_Core_Database_Orm_DataMapper_FieldAbstract
|
||||
extends Wootook_Core_Database_Orm_DataMapper_FieldMapper
|
||||
{
|
||||
public function encode($value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Database_Orm_DataMapper_Config
|
||||
extends Wootook_Core_Database_Orm_DataMapper_Array
|
||||
extends Wootook_Core_Database_Orm_DataMapper_FieldMapper
|
||||
{
|
||||
public function encode($value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Database_Orm_DataMapper_DateTime
|
||||
extends Wootook_Core_Database_Orm_DataMapper_FieldAbstract
|
||||
extends Wootook_Core_Database_Orm_DataMapper_FieldMapper
|
||||
{
|
||||
const DATE_FORMAT_MYSQL = 'Y-m-d G:i:s';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Database_Orm_DataMapper_FieldAbstract
|
||||
{
|
||||
abstract public function encode($value);
|
||||
|
||||
abstract public function decode($value);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Database_Orm_DataMapper_FieldMapper
|
||||
{
|
||||
protected $_mapper = null;
|
||||
|
||||
public function __construct(Wootook_Core_Database_Orm_DataMapper $mapper)
|
||||
{
|
||||
$this->_mapper = $mapper;
|
||||
}
|
||||
|
||||
abstract public function encode($value);
|
||||
|
||||
abstract public function decode($value);
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Database_Orm_DataMapper_Object
|
||||
extends Wootook_Core_Database_Orm_DataMapper_Array
|
||||
extends Wootook_Core_Database_Orm_DataMapper_FieldMapper
|
||||
{
|
||||
protected $_entityClass = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ abstract class Wootook_Core_Database_Resource
|
|||
public function getReadConnection()
|
||||
{
|
||||
if ($this->_readConnection === null) {
|
||||
$this->_readConnection = $this->getConnection('core_read');
|
||||
$this->_readConnection = Wootook_Core_Database_ConnectionManager::getSingleton()
|
||||
->getConnection('core_read');
|
||||
}
|
||||
|
||||
return $this->_readConnection;
|
||||
|
|
@ -60,7 +61,8 @@ abstract class Wootook_Core_Database_Resource
|
|||
public function getWriteConnection()
|
||||
{
|
||||
if ($this->_writeConnection === null) {
|
||||
$this->_writeConnection = $this->getConnection('core_write');
|
||||
$this->_writeConnection = Wootook_Core_Database_ConnectionManager::getSingleton()
|
||||
->getConnection('core_write');
|
||||
}
|
||||
return $this->_writeConnection;
|
||||
}
|
||||
|
|
|
|||
30
src/application/code/core/Wootook/Core/Database/Sql/Dml.php
Normal file
30
src/application/code/core/Wootook/Core/Database/Sql/Dml.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
interface Wootook_Core_Database_Sql_Dml
|
||||
{
|
||||
function __construct(Wootook_Core_Database_Adapter_Adapter $connection, $param = null);
|
||||
|
||||
function where($condition);
|
||||
function limit($limit, $offset = null);
|
||||
|
||||
function renderWhere();
|
||||
function renderLimit();
|
||||
|
||||
function render();
|
||||
function toString($part = null);
|
||||
|
||||
function getPart($part = null);
|
||||
function reset($part = null);
|
||||
|
||||
function quote($data);
|
||||
function quoteIdentifier($identifier);
|
||||
|
||||
function setConnection(Wootook_Core_Database_Adapter_Adapter $connection);
|
||||
function getConnection();
|
||||
|
||||
function beforePrepare(Wootook_Core_Database_Statement_Statement $statement);
|
||||
function afterPrepare(Wootook_Core_Database_Statement_Statement $statement);
|
||||
|
||||
function beforeExecute(Wootook_Core_Database_Statement_Statement $statement);
|
||||
function afterExecute(Wootook_Core_Database_Statement_Statement $statement);
|
||||
}
|
||||
310
src/application/code/core/Wootook/Core/Database/Sql/DmlQuery.php
Normal file
310
src/application/code/core/Wootook/Core/Database/Sql/DmlQuery.php
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Database_Sql_DmlQuery
|
||||
implements Wootook_Core_Database_Sql_Dml
|
||||
{
|
||||
const WHERE = 'WHERE';
|
||||
const LIMIT = 'LIMIT';
|
||||
const OFFSET = 'OFFSET';
|
||||
|
||||
const OPERATOR_AND = 'AND';
|
||||
const OPERATOR_OR = 'OR';
|
||||
const OPERATOR_XOR = 'XOR';
|
||||
const OPERATOR_EQUALS = 'EQ';
|
||||
const OPERATOR_NOT_EQUALS = 'NEQ';
|
||||
const OPERATOR_LOWER = 'LT';
|
||||
const OPERATOR_GREATER = 'GT';
|
||||
const OPERATOR_LOWER_EQUALS = 'LTEQ';
|
||||
const OPERATOR_GREATER_EQUALS = 'GTEQ';
|
||||
const OPERATOR_IS_NULL = 'NULL';
|
||||
const OPERATOR_IN = 'IN';
|
||||
const OPERATOR_NOT_IN = 'NIN';
|
||||
const OPERATOR_FIND_IN_SET = 'FINSET';
|
||||
const OPERATOR_NOT_FIND_IN_SET = 'NFINSET';
|
||||
const OPERATOR_DATE = 'DATE';
|
||||
|
||||
protected $_parts = array();
|
||||
|
||||
protected $_connection = null;
|
||||
|
||||
protected $_placeholders = array();
|
||||
|
||||
public function __construct(Wootook_Core_Database_Adapter_Adapter $connection, $tableName = null)
|
||||
{
|
||||
$this->setConnection($connection);
|
||||
|
||||
$this->reset();
|
||||
$this->_init($tableName);
|
||||
}
|
||||
|
||||
public function getConnection()
|
||||
{
|
||||
return $this->_connection;
|
||||
}
|
||||
|
||||
public function setConnection(Wootook_Core_Database_Adapter_Adapter $connection)
|
||||
{
|
||||
$this->_connection = $connection;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _init($param = null)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPart($part = null)
|
||||
{
|
||||
if ($part === null) {
|
||||
return $this->_parts;
|
||||
}
|
||||
if (isset($this->_parts[$part])) {
|
||||
return $this->_parts[$part];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function quote($data)
|
||||
{
|
||||
return $this->getConnection()->quote($data);
|
||||
}
|
||||
|
||||
public function quoteIdentifier($identifier)
|
||||
{
|
||||
return $this->getConnection()->quoteIdentifier($identifier);
|
||||
}
|
||||
|
||||
public function where($condition, $value = null)
|
||||
{
|
||||
if ($condition instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) {
|
||||
$this->_parts[self::WHERE][] = $condition;
|
||||
} else if (is_string($condition)) {
|
||||
if ($value === null) {
|
||||
$this->_parts[self::WHERE][] = $condition;
|
||||
} else {
|
||||
$adapter = $this->getReadConnection();
|
||||
$this->_parts[self::WHERE][] = $adapter->quoteInto($condition, $value);
|
||||
}
|
||||
} else if (is_array($condition)) {
|
||||
$where = $this->_translateSqlWhere($condition, 'or', $value);
|
||||
if ($where !== null) {
|
||||
$this->_parts[self::WHERE][] = $where;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function limit($limit, $offset = null)
|
||||
{
|
||||
$this->_parts[self::LIMIT] = intval($limit);
|
||||
$this->_parts[self::OFFSET] = intval($offset);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function renderWhere()
|
||||
{
|
||||
if (count($this->_parts[self::WHERE]) <= 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return "\nWHERE (" . implode(') AND (', $this->_parts[self::WHERE]) . ')';
|
||||
}
|
||||
|
||||
public function renderLimit()
|
||||
{
|
||||
if (!$this->_parts[self::LIMIT]) {
|
||||
return '';
|
||||
}
|
||||
if (!$this->_parts[self::OFFSET]) {
|
||||
return sprintf("\nLIMIT %d", $this->_parts[self::LIMIT]);
|
||||
}
|
||||
return sprintf("\nLIMIT %d,%d", $this->_parts[self::LIMIT], $this->_parts[self::OFFSET]);
|
||||
}
|
||||
|
||||
protected function _translateSqlWhere($field, $operator, $value)
|
||||
{
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
$operator = strtoupper($operator);
|
||||
$adapter = $this->getReadConnection();
|
||||
|
||||
$basicBinayOperatorList = array(
|
||||
self::OPERATOR_EQUALS => '=',
|
||||
self::OPERATOR_NOT_EQUALS => '!=',
|
||||
self::OPERATOR_LOWER => '<',
|
||||
self::OPERATOR_GREATER => '>',
|
||||
self::OPERATOR_LOWER_EQUALS => '<=',
|
||||
self::OPERATOR_GREATER_EQUALS => '>='
|
||||
);
|
||||
|
||||
if (in_array($operator, $basicBinayOperatorList)) {
|
||||
if ($value === true) {
|
||||
return "{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}TRUE";
|
||||
} else if ($value === false) {
|
||||
return "{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}FALSE";
|
||||
} else if (is_numeric($value)) {
|
||||
return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%d", $value);
|
||||
} else if ($value instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) {
|
||||
$this->_placeholders[] = $value;
|
||||
return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%s", $adapter->quote($value->toString()));
|
||||
} else {
|
||||
return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%s", $adapter->quote($value));
|
||||
}
|
||||
}
|
||||
|
||||
switch ($operator) {
|
||||
case self::OPERATOR_IS_NULL:
|
||||
if ($value == false) {
|
||||
return "{$adapter->quoteIdentifier($field)} IS NOT NULL";
|
||||
} else {
|
||||
return "{$adapter->quoteIdentifier($field)} IS NULL";
|
||||
}
|
||||
break;
|
||||
|
||||
case self::OPERATOR_AND:
|
||||
case self::OPERATOR_OR:
|
||||
case self::OPERATOR_XOR:
|
||||
$where = array();
|
||||
foreach ($value as $valueItem) {
|
||||
$subOperator = key($valueItem);
|
||||
$realValue = current($valueItem);
|
||||
|
||||
if (is_array($realValue) && isset($realValue['field'])) {
|
||||
if (!isset($realValue['value'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$realField = $realValue['field'];
|
||||
$realValue = $realValue['value'];
|
||||
} else {
|
||||
$realField = $field;
|
||||
}
|
||||
|
||||
if ($realValue === null) {
|
||||
continue;
|
||||
}
|
||||
$actualValue = $this->_translateSqlWhere($realField, $subOperator, $realValue);
|
||||
if ($actualValue !== null) {
|
||||
$where[] = $actualValue;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($where)) {
|
||||
return '((' . implode(') ' . strtoupper($operator) . ' (', $where) . '))';
|
||||
}
|
||||
break;
|
||||
|
||||
case self::OPERATOR_IN:
|
||||
$valueList = array();
|
||||
foreach ($value as $setValue) {
|
||||
$valueList[] = $adapter->quote($setValue);
|
||||
}
|
||||
$implodedList = implode(',', $valueList);
|
||||
return "{$adapter->quoteIdentifier($field)} IN({$implodedList})";
|
||||
break;
|
||||
|
||||
case self::OPERATOR_NOT_IN:
|
||||
$valueList = array();
|
||||
foreach ($value as $setValue) {
|
||||
$valueList[] = $adapter->quote($setValue);
|
||||
}
|
||||
$implodedList = implode(',', $valueList);
|
||||
return "{$adapter->quoteIdentifier($field)} NOT IN({$implodedList})";
|
||||
break;
|
||||
|
||||
case self::OPERATOR_FIND_IN_SET:
|
||||
if (is_array($value)) {
|
||||
$subField = current($value);
|
||||
$subOperator = key($value);
|
||||
|
||||
if (in_array($subOperator, $basicBinayOperatorList)) {
|
||||
return "FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)}){$basicBinayOperatorList[$operator]}{$adapter->quoteIdentifier($subField)}";
|
||||
}
|
||||
} else {
|
||||
return "0 < FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)})";
|
||||
}
|
||||
break;
|
||||
|
||||
case self::OPERATOR_NOT_FIND_IN_SET:
|
||||
return "0 = FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)})";
|
||||
break;
|
||||
|
||||
case self::OPERATOR_DATE:
|
||||
$dateValues = array();
|
||||
if (isset($value['from'])) {
|
||||
if ($value['from'] instanceof Wootook_Core_DateTime) {
|
||||
$dateValues['from'] = "{$adapter->quoteIdentifier($field)} >= {$adapter->quote($this->getDataMapper()->load('DateTime')->encode($value['from']))}";
|
||||
} else if (is_string($value['from'])) {
|
||||
$dateValues['from'] = "{$adapter->quoteIdentifier($field)} >= {$adapter->quote($value['from'])}";
|
||||
} else if (is_numeric($value['from'])) {
|
||||
$dateValues['from'] = "UNIX_TIMESTAMP({$adapter->quoteIdentifier($field)}) >= {$adapter->quote($value['from'])}";
|
||||
}
|
||||
}
|
||||
if (isset($value['to'])) {
|
||||
if ($value['to'] instanceof Wootook_Core_DateTime) {
|
||||
$dateValues['to'] = "{$adapter->quoteIdentifier($field)} <= {$adapter->quote($this->getDataMapper()->load('DateTime')->encode($value['to']))}";
|
||||
} else if (is_string($value['to'])) {
|
||||
$dateValues['to'] = "{$adapter->quoteIdentifier($field)} <= {$adapter->quote($value['to'])}";
|
||||
} else if (is_numeric($value['to'])) {
|
||||
$dateValues['to'] = "UNIX_TIMESTAMP({$adapter->quoteIdentifier($field)}) <= {$adapter->quote($value['to'])}";
|
||||
}
|
||||
}
|
||||
|
||||
return '(' . implode(' AND ', $dateValues) . ')';
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function beforePrepare(Wootook_Core_Database_Statement_Statement $statement)
|
||||
{
|
||||
foreach ($this->_placeholders as $placeholder) {
|
||||
$placeholder->befrePrepare($statement);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function afterPrepare(Wootook_Core_Database_Statement_Statement $statement)
|
||||
{
|
||||
foreach ($this->_placeholders as $placeholder) {
|
||||
$placeholder->afterPrepare($statement);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function beforeExecute(Wootook_Core_Database_Statement_Statement $statement)
|
||||
{
|
||||
foreach ($this->_placeholders as $placeholder) {
|
||||
$placeholder->beforeExecute($statement);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function afterExecute(Wootook_Core_Database_Statement_Statement $statement)
|
||||
{
|
||||
foreach ($this->_placeholders as $placeholder) {
|
||||
$placeholder->afterExecute($statement);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function prepare()
|
||||
{
|
||||
return $this->getConnection()->prepare($this);
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
return $this->getConnection()->execute($this);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,121 +3,4 @@
|
|||
class Wootook_Core_Database_Sql_Mysql_Select
|
||||
extends Wootook_Core_Database_Sql_Select
|
||||
{
|
||||
public function renderColumns()
|
||||
{
|
||||
$fields = array();
|
||||
foreach ($this->_parts[self::COLUMNS] as $field) {
|
||||
if ($field['field'] instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) {
|
||||
$field['field']->process($this);
|
||||
|
||||
if ($field['alias'] !== null) {
|
||||
$fields[] = "{$field['field']} AS {$field['alias']}";
|
||||
} else {
|
||||
$fields[] = "{$field['field']}";
|
||||
}
|
||||
} else if ($field['alias'] !== null) {
|
||||
if ($field['table'] !== null) {
|
||||
$fields[] = "{$field['table']}.{$field['field']} AS {$field['alias']}";
|
||||
} else {
|
||||
$fields[] = "{$field['field']} AS {$field['alias']}";
|
||||
}
|
||||
} else if ($field['table'] !== null) {
|
||||
$fields[] = "{$field['table']}.{$field['field']}";
|
||||
} else {
|
||||
$fields[] = "{$field['field']}";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($fields)) {
|
||||
return implode(", ", $fields);
|
||||
}
|
||||
return '*';
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
if (empty($this->_parts[self::UNION])) {
|
||||
$fields = $this->renderColumns();
|
||||
|
||||
if (!empty($this->_parts[self::WHERE])) {
|
||||
$where = 'WHERE (' . implode(") AND (", $this->_parts[self::WHERE]) . ')';
|
||||
} else {
|
||||
$where = '';
|
||||
}
|
||||
$joinedTables = implode("\n ", $this->_parts[self::JOIN]);
|
||||
|
||||
$order = '';
|
||||
if (!empty($this->_parts[self::ORDER])) {
|
||||
$order = 'ORDER BY ' . implode(", ", $this->_parts[self::ORDER]);
|
||||
}
|
||||
$limit = '';
|
||||
if ($this->_parts[self::LIMIT]) {
|
||||
if ($this->_parts[self::OFFSET]) {
|
||||
$limit = "LIMIT {$this->_parts[self::LIMIT]}, {$this->_parts[self::OFFSET]}";
|
||||
} else {
|
||||
$limit = "LIMIT {$this->_parts[self::LIMIT]}";
|
||||
}
|
||||
}
|
||||
$group = '';
|
||||
if (!empty($this->_parts[self::GROUP])) {
|
||||
foreach ($this->_parts[self::GROUP] as &$groupedField) {
|
||||
$groupedField = $this->_connection->quoteIdentifier($groupedField);
|
||||
}
|
||||
unset($groupedField);
|
||||
$group = 'GROUP BY ' . implode(', ', $this->_parts[self::GROUP]);
|
||||
}
|
||||
|
||||
$tableList = array();
|
||||
foreach ($this->_parts[self::FROM] as $table) {
|
||||
if ($table['schema'] !== null) {
|
||||
$tableString = "{$this->_connection->quoteIdentifier($table['schema'])}.{$this->_connection->quoteIdentifier($this->_connection->getTable($table['table']))}";
|
||||
} else {
|
||||
$tableString = $this->_connection->quoteIdentifier($this->_connection->getTable($table['table']));
|
||||
}
|
||||
if ($table['alias'] !== null) {
|
||||
$tableString .= " AS {$this->_connection->quoteIdentifier($table['alias'])}";
|
||||
}
|
||||
|
||||
$tableList[] = $tableString;
|
||||
}
|
||||
$tableList = implode(', ', $tableList);
|
||||
|
||||
return <<<SQL_EOF
|
||||
SELECT {$fields}
|
||||
FROM {$tableList}
|
||||
{$joinedTables}
|
||||
{$where}
|
||||
{$group}
|
||||
{$order}
|
||||
{$limit}
|
||||
SQL_EOF;
|
||||
} else {
|
||||
$statements = array();
|
||||
foreach ($this->_parts[self::UNION] as $statement) {
|
||||
$statements[] = $statement->_prepareSql();
|
||||
}
|
||||
|
||||
$statements = '(' . implode(') UNION (', $statements) . ')';
|
||||
if (!empty($where)) {
|
||||
$where = 'WHERE (' . implode(") AND (", $this->_parts[self::WHERE]) . ')';
|
||||
} else {
|
||||
$where = '';
|
||||
}
|
||||
|
||||
$limit = '';
|
||||
if ($this->_parts[self::LIMIT]) {
|
||||
if ($this->_parts[self::OFFSET]) {
|
||||
$limit = "LIMIT {$this->_parts[self::LIMIT]}, {$this->_parts[self::OFFSET]}";
|
||||
} else {
|
||||
$limit = "LIMIT {$this->_parts[self::LIMIT]}";
|
||||
}
|
||||
}
|
||||
|
||||
return <<<SQL_EOF
|
||||
$statements
|
||||
{$where}
|
||||
{$limit}
|
||||
SQL_EOF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Database_Sql_Placeholder_Expression
|
||||
extends Wootook_Core_Database_Sql_Placeholder_Placeholder
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Database_Sql_Placeholder_Param
|
||||
extends Wootook_Core_Database_Sql_Placeholder_Placeholder
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Database_Sql_Placeholder_Placeholder
|
||||
{
|
||||
abstract public function __toString();
|
||||
|
||||
abstract public function beforePrepare(Wootook_Core_Database_Statement_Statement $statement)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract public function afterPrepare(Wootook_Core_Database_Statement_Statement $statement)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract public function beforeExcute(Wootook_Core_Database_Statement_Statement $statement)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract public function afterExecute(Wootook_Core_Database_Statement_Statement $statement)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Database_Sql_Select
|
||||
implements Wootook_Core_Database_Sql_Dml
|
||||
extends Wootook_Core_Database_Sql_DmlQuery
|
||||
{
|
||||
const COLUMNS = 'COLUMNS';
|
||||
const FROM = 'FROM';
|
||||
|
|
@ -54,11 +54,12 @@ abstract class Wootook_Core_Database_Sql_Select
|
|||
self::FROM => array(),
|
||||
self::JOIN => array(),
|
||||
self::WHERE => array(),
|
||||
self::ORDER => array(),
|
||||
self::UNION => array(),
|
||||
self::LIMIT => array(),
|
||||
self::OFFSET => array(),
|
||||
self::GROUP => array(),
|
||||
self::HAVING => array(),
|
||||
self::ORDER => array(),
|
||||
);
|
||||
} else if (isset($this->_parts[$part])) {
|
||||
$this->_parts[$part] = array();
|
||||
|
|
@ -114,25 +115,23 @@ abstract class Wootook_Core_Database_Sql_Select
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function join($table, $condition, $fields = array('*'), $mode = self::JOIN_INNER)
|
||||
public function join($table, $condition, $fields = array('*'), $mode = self::JOIN_INNER, $schema = null)
|
||||
{
|
||||
$database = $this->getConnection();
|
||||
|
||||
$this->column($fields);
|
||||
if (is_array($table)) {
|
||||
$alias = key($table);
|
||||
$table = current($table);
|
||||
|
||||
foreach ($fields as $fieldAlias => $fieldName) {
|
||||
$this->column("{$alias}.{$field}", $fieldAlias);
|
||||
if ($schema !== null) {
|
||||
$this->_parts[self::JOIN][] = "\n{$mode} JOIN {$this->_connection->quoteIdentifier($schema)}{$this->_connection->quoteIdentifier($this->_connection->getTable($table))} AS {$this->_connection->quoteIdentifier($alias)}"
|
||||
. "\n ON {$condition}";
|
||||
} else {
|
||||
$this->_parts[self::JOIN][] = "\n{$mode} JOIN {$this->_connection->quoteIdentifier($this->_connection->getTable($table))} AS {$this->_connection->quoteIdentifier($alias)}"
|
||||
. "\n ON {$condition}";
|
||||
}
|
||||
|
||||
$this->_parts[self::JOIN][] = "{$mode} JOIN {$database->getTable($table)} AS {$alias} ON {$condition}";
|
||||
} else {
|
||||
foreach ($fields as $field) {
|
||||
$this->column("{$field}");
|
||||
}
|
||||
|
||||
$this->_parts[self::JOIN][] = "{$mode} JOIN {$database->getTable($table)} ON {$condition}";
|
||||
$this->_parts[self::JOIN][] = "\n{$mode} JOIN {$this->_connection->quoteIdentifier($this->_connection->getTable($table))}"
|
||||
. "\n ON {$condition}";
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
@ -223,11 +222,128 @@ abstract class Wootook_Core_Database_Sql_Select
|
|||
return null;
|
||||
}
|
||||
|
||||
abstract public function renderColumns();
|
||||
abstract public function renderFrom();
|
||||
abstract public function renderJoin();
|
||||
abstract public function renderOrder();
|
||||
abstract public function renderUnion();
|
||||
abstract public function renderGroup();
|
||||
abstract public function renderHaving();
|
||||
public function renderColumns()
|
||||
{
|
||||
$fields = array();
|
||||
foreach ($this->_parts[self::COLUMNS] as $field) {
|
||||
if ($field['field'] instanceof Wootook_Core_Database_Sql_Dml) {
|
||||
if ($field['alias'] !== null) {
|
||||
$fields[] = "({$field['field']}) AS {$field['alias']}";
|
||||
} else {
|
||||
$fields[] = "({$field['field']})";
|
||||
}
|
||||
} else if ($field['field'] instanceof Wootook_Core_Database_Sql_Placeholder_Placeholder) {
|
||||
$field['field']->prepare($this);
|
||||
|
||||
if ($field['alias'] !== null) {
|
||||
$fields[] = "({$field['field']}) AS {$field['alias']}";
|
||||
} else {
|
||||
$fields[] = "({$field['field']})";
|
||||
}
|
||||
} else if ($field['alias'] !== null) {
|
||||
if ($field['table'] !== null) {
|
||||
$fields[] = "{$field['table']}.{$field['field']} AS {$field['alias']}";
|
||||
} else {
|
||||
$fields[] = "{$field['field']} AS {$field['alias']}";
|
||||
}
|
||||
} else if ($field['table'] !== null) {
|
||||
$fields[] = "{$field['table']}.{$field['field']}";
|
||||
} else {
|
||||
$fields[] = "{$field['field']}";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($fields)) {
|
||||
return 'SELECT ' . implode(", ", $fields);
|
||||
}
|
||||
return '*';
|
||||
}
|
||||
|
||||
public function renderFrom()
|
||||
{
|
||||
$tables = array();
|
||||
foreach ($this->_parts[self::FROM] as $table) {
|
||||
if ($table['table'] instanceof Wootook_Core_Database_Sql_Dml) {
|
||||
if ($table['alias'] !== null) {
|
||||
$tables[] = "({$table['table']}) AS {$this->_connection->quoteIdentifier($table['alias'])}";
|
||||
} else {
|
||||
$tables[] = "({$table['table']})";
|
||||
}
|
||||
} else if ($table['alias'] !== null) {
|
||||
if ($table['schema'] !== null) {
|
||||
$tables[] = "{$this->_connection->quoteIdentifier($table['schema'])}.{$this->_connection->quoteIdentifier($table['table'])} AS {$this->_connection->quoteIdentifier($table['alias'])}";
|
||||
} else {
|
||||
$tables[] = "{$this->_connection->quoteIdentifier($table['table'])} AS {$this->_connection->quoteIdentifier($table['alias'])}";
|
||||
}
|
||||
} else if ($table['schema'] !== null) {
|
||||
$tables[] = "{$this->_connection->quoteIdentifier($table['schema'])}.{$this->_connection->quoteIdentifier($table['table'])}";
|
||||
} else {
|
||||
$tables[] = "({$this->_connection->quoteIdentifier($table['table'])})";
|
||||
}
|
||||
}
|
||||
|
||||
return "\nFROM " . implode(', ', $tables);
|
||||
}
|
||||
|
||||
public function renderJoin()
|
||||
{
|
||||
return implode('', $this->_parts[self::JOIN]);
|
||||
}
|
||||
|
||||
public function renderOrder()
|
||||
{
|
||||
if (count($this->_parts[self::ORDER]) <= 0) {
|
||||
return null;
|
||||
}
|
||||
return "\n ORDER BY " . implode(', ', $this->_parts[self::ORDER]);
|
||||
}
|
||||
|
||||
public function renderUnion()
|
||||
{
|
||||
$statements = array();
|
||||
foreach ($this->_parts[self::UNION] as $statement) {
|
||||
$statements[] = $statement->render();
|
||||
}
|
||||
|
||||
return "(" . implode(")\nUNION\n(", $statements) . ")";
|
||||
}
|
||||
|
||||
public function renderGroup()
|
||||
{
|
||||
if (count($this->_parts[self::GROUP]) <= 0) {
|
||||
return null;
|
||||
}
|
||||
return "\n GROUP BY " . implode(', ', $this->_parts[self::GROUP]);
|
||||
}
|
||||
|
||||
public function renderHaving()
|
||||
{
|
||||
if (count($this->_parts[self::HAVING]) <= 0) {
|
||||
return null;
|
||||
}
|
||||
return "\n HAVING " . implode(', ', $this->_parts[self::HAVING]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
if (empty($this->_parts[self::UNION])) {
|
||||
return implode('', array(
|
||||
$this->renderColumns(),
|
||||
$this->renderFrom(),
|
||||
$this->renderJoin(),
|
||||
$this->renderWhere(),
|
||||
$this->renderGroup(),
|
||||
$this->renderHaving(),
|
||||
$this->renderOrder(),
|
||||
$this->renderLimit()
|
||||
));
|
||||
} else {
|
||||
return implode('', array(
|
||||
$this->renderUnion(),
|
||||
$this->renderWhere(),
|
||||
$this->renderOrder(),
|
||||
$this->renderLimit()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,244 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Database_Statement_Pdo_Mysql
|
||||
extends Wootook_Core_Database_Statement_Statement
|
||||
{
|
||||
protected $_handler = null;
|
||||
|
||||
protected $_query = null;
|
||||
|
||||
protected function _init($query)
|
||||
{
|
||||
$this->_query = $query;
|
||||
|
||||
if ($this->_query instanceof Wootook_Core_Database_Sql_Dml) {
|
||||
$this->_query->beforePrepare($this);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->_handler = $this->_adapter->getDriverHandler()->prepare($this->_query);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
|
||||
if ($this->_query instanceof Wootook_Core_Database_Sql_Dml) {
|
||||
$this->_query->afterPrepare($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|int $column
|
||||
* @param mixed $param
|
||||
* @param int $type
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
public function bindColumn($column, &$param, $type = null)
|
||||
{
|
||||
try {
|
||||
return $this->_handler->bindColumn($column, $param, $type);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|int $parameter
|
||||
* @param mixed $variable
|
||||
* @param int $type
|
||||
* @param int $length
|
||||
* @param unknown_type $options
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null)
|
||||
{
|
||||
try {
|
||||
return $this->_handler->bindParam($parameter, $variable, $type, $length, $options);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|int $parameter
|
||||
* @param mixed $value
|
||||
* @param int $type
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
public function bindValue($parameter, $value, $type = null)
|
||||
{
|
||||
try {
|
||||
return $this->_handler->bindValue($parameter, $value, $type);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public function execute(Array $params = null)
|
||||
{
|
||||
if ($this->_query instanceof Wootook_Core_Database_Sql_Dml) {
|
||||
$this->_query->beforeExecute($this);
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $this->_handler->execute($params);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
|
||||
if ($this->_query instanceof Wootook_Core_Database_Sql_Dml) {
|
||||
$this->_query->afterExecute($this);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $style
|
||||
* @param int $col
|
||||
* @return mixed
|
||||
*/
|
||||
public function fetchAll($style = null, $col = null)
|
||||
{
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, 'Unimplemented', null, $e);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $col
|
||||
* @return mixed
|
||||
*/
|
||||
public function fetchColumn($col)
|
||||
{
|
||||
try {
|
||||
return $this->_handler->fetchColumn($col);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Wootook_Core_Database_Adapter_Adapter
|
||||
*/
|
||||
public function getAdapter()
|
||||
{
|
||||
return $this->_adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $key
|
||||
*/
|
||||
public function getAttribute($key)
|
||||
{
|
||||
try {
|
||||
return $this->_handler->getAttribute($key);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
public function setAttribute($key, $value)
|
||||
{
|
||||
try {
|
||||
return $this->_handler->setAttribute($key, $value);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown_type $mode
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
public function setFetchMode($mode)
|
||||
{
|
||||
try {
|
||||
$params = func_get_args();
|
||||
return call_user_func_array($array($this->_handler, 'setFetchMode'), $params);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
try {
|
||||
return $this->_handler->columnCount();
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
try {
|
||||
return $this->_handler->rowCount();
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $col
|
||||
* @return mixed
|
||||
*/
|
||||
public function fetch($style = null, $orientation = Wootook_Core_Database_ConnectionManager::FETCH_ORI_NEXT, $cursorOffset = 0)
|
||||
{
|
||||
try {
|
||||
return $this->_handler->fetch($style, $orientation, $cursorOffset);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param array $config
|
||||
* @return Wootook_Object
|
||||
*/
|
||||
public function fetchObject($class = 'Wootook_Object', Array $constructorArgs = array())
|
||||
{
|
||||
try {
|
||||
return $this->_handler->fetchObject($class, $constructorArgs);
|
||||
} catch (PDOException $e) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, $e->getMessage(), null, $e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Database_Statement_Statement
|
||||
implements Iterator
|
||||
{
|
||||
protected $_adapter = null;
|
||||
|
||||
protected $_currentIndex = 0;
|
||||
protected $_currentRow = null;
|
||||
|
||||
public function __construct(Wootook_Core_Database_Adapter_Adapter $adapter, $sql)
|
||||
{
|
||||
$this->_adapter = $adapter;
|
||||
|
||||
$this->_init($sql);
|
||||
}
|
||||
|
||||
abstract protected function _init($sql);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|int $column
|
||||
* @param mixed $param
|
||||
* @param int $type
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
abstract public function bindColumn($column, &$param, $type = null);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|int $parameter
|
||||
* @param mixed $variable
|
||||
* @param int $type
|
||||
* @param int $length
|
||||
* @param unknown_type $options
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
abstract public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|int $parameter
|
||||
* @param mixed $value
|
||||
* @param int $type
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
abstract public function bindValue($parameter, $value, $type = null);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function execute(Array $params = null);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $style
|
||||
* @param int $col
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function fetch($style = null, $orientation = Wootook_Core_Database_ConnectionManager::FETCH_ORI_NEXT, $cursorOffset = 0);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $style
|
||||
* @param int $col
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function fetchAll($style = null, $col = null);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $col
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function fetchColumn($col);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $class
|
||||
* @param array $config
|
||||
* @return Wootook_Object
|
||||
*/
|
||||
abstract public function fetchObject($class = 'Wootook_Object', Array $constructorArgs = array());
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $class
|
||||
* @param array $config
|
||||
* @return Wootook_Object
|
||||
*/
|
||||
public function fetchEntity($class = 'Wootook_Core_Entity', Array $constructorArgs = array())
|
||||
{
|
||||
$reflection = new ReflectionClass($class);
|
||||
$object = $reflection->newInstanceArgs($constructorArgs);
|
||||
|
||||
if (!$object instanceof Wootook_Object) {
|
||||
throw new Wootook_Core_Exception_Database_StatementError($this, 'Destination object should be a Wootook_Core_Entity instance.');
|
||||
}
|
||||
|
||||
$data = $this->fetch(Wootook_Core_Database_ConnectionManager::FETCH_ASSOC);
|
||||
$object->getDataMapper()->decode($object, $data);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Wootook_Core_Database_Adapter_Adapter
|
||||
*/
|
||||
abstract public function getAdapter();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $key
|
||||
*/
|
||||
abstract public function getAttribute($key);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
abstract public function setAttribute($key, $value);
|
||||
|
||||
/**
|
||||
* @param unknown_type $mode
|
||||
* @return Wootook_Core_Database_Statement_Statement
|
||||
*/
|
||||
abstract public function setFetchMode($mode);
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
abstract public function columnCount();
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
abstract public function rowCount();
|
||||
|
||||
public function current()
|
||||
{
|
||||
return $this->_currentRow;
|
||||
}
|
||||
|
||||
public function next()
|
||||
{
|
||||
$this->_currentRow = $this->fetch();
|
||||
$this->_currentIndex++;
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return $this->_currentIndex;
|
||||
}
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
return $this->_currentIndex = 0;
|
||||
}
|
||||
|
||||
public function valid()
|
||||
{
|
||||
return $this->_currentRow !== null;
|
||||
}
|
||||
}
|
||||
|
|
@ -268,7 +268,6 @@ class Wootook_Core_DateTime
|
|||
|
||||
foreach ($rule as $part => $regex) {
|
||||
if (!preg_match($regex, $datetime, $matches, null, $offset)) {
|
||||
var_dump($datetime);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,14 +46,11 @@ abstract class Wootook_Core_Entity
|
|||
}
|
||||
|
||||
$select = $database->select()
|
||||
->from($database->getTable($this->getTableName()))
|
||||
->where($idFieldName)
|
||||
$sql =<<<SQL_EOF
|
||||
SELECT * FROM {$database->getTable($this->getTableName())}
|
||||
WHERE {$idFieldName}=:id
|
||||
LIMIT 1
|
||||
SQL_EOF;
|
||||
$statement = $database->prepare($sql);
|
||||
->from(array('main_table' => $database->getTable($this->getTableName())))
|
||||
->where("{$database->quoteIdentifier($idFieldName)}=:id")
|
||||
->limit(1);
|
||||
|
||||
$statement = $database->prepare($select);
|
||||
$statement->execute(array(
|
||||
'id' => $id
|
||||
));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Core_Exception_Database_AdapterError
|
||||
extends Wootook_Core_Exception_RuntimeException
|
||||
implements Wootook_Core_Exception_Database_Error
|
||||
{
|
||||
protected $_adapter = null;
|
||||
|
||||
public function __construct(Wootook_Core_Database_Adapter_Adapter $adapter, $message = null, $code = null, $previous = null)
|
||||
{
|
||||
parent::__construct($message, null, $previous);
|
||||
|
||||
$this->_adapter = $adapter;
|
||||
}
|
||||
|
||||
public function getAdapter()
|
||||
{
|
||||
return $this->_adapter;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
interface Wootook_Core_Exception_Database_Error
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
abstract class Wootook_Core_Exception_Database_StatementError
|
||||
extends Wootook_Core_Exception_RuntimeException
|
||||
implements Wootook_Core_Exception_Database_Error
|
||||
{
|
||||
protected $_statement = null;
|
||||
|
||||
public function __construct(Wootook_Core_Database_Statement_Statement $statement, $message = null, $code = null, $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
$this->_statement = $statement;
|
||||
}
|
||||
|
||||
public function getStatement()
|
||||
{
|
||||
return $this->_statement;
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ class Wootook_Core_Form_ElementLoader
|
|||
}
|
||||
}
|
||||
|
||||
protected function _load($className, $useSingleton)
|
||||
protected function _load($className, $useSingleton, Array $constructorParams = array())
|
||||
{
|
||||
$reflection = new ReflectionClass($className);
|
||||
if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Wootook_Core_Form_ValidatorLoader
|
|||
}
|
||||
}
|
||||
|
||||
protected function _load($className, $useSingleton)
|
||||
protected function _load($className, $useSingleton, Array $constructorParams = array())
|
||||
{
|
||||
$reflection = new ReflectionClass($className);
|
||||
if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ class Wootook_Core_Model_Session
|
|||
self::SUCCESS => 'SUCCESS'
|
||||
);
|
||||
|
||||
protected $_messages = array();
|
||||
|
||||
const COOKIE_LIFETIME_CONFIG_KEY = 'web/session/time';
|
||||
const COOKIE_DOMAIN_CONFIG_KEY = 'web/session/domain';
|
||||
const COOKIE_PATH_CONFIG_KEY = 'web/session/path';
|
||||
|
|
@ -73,6 +75,7 @@ class Wootook_Core_Model_Session
|
|||
}
|
||||
|
||||
$this->_data = &$_SESSION[$namespace][self::IDENTIFIER_DATA];
|
||||
$this->_messages = &$_SESSION[$namespace][self::IDENTIFIER_MESSAGES];
|
||||
}
|
||||
|
||||
public function getCookieLifetime()
|
||||
|
|
@ -105,11 +108,10 @@ class Wootook_Core_Model_Session
|
|||
|
||||
public function getMessages($clear = true)
|
||||
{
|
||||
$messages = $this->_data[self::IDENTIFIER_MESSAGES];
|
||||
if ($clear == true) {
|
||||
$this->_data[self::IDENTIFIER_MESSAGES] = array();
|
||||
$this->_messages = array();
|
||||
}
|
||||
return $messages;
|
||||
return $this->_messages;
|
||||
}
|
||||
|
||||
public function addMessage($message, $type = self::DEBUG)
|
||||
|
|
@ -118,13 +120,13 @@ class Wootook_Core_Model_Session
|
|||
$type = self::DEBUG;
|
||||
}
|
||||
|
||||
if (!isset($this->_data[self::IDENTIFIER_MESSAGES])) {
|
||||
$this->_data[self::IDENTIFIER_MESSAGES] = array();
|
||||
if (!isset($this->_messages)) {
|
||||
$this->_messages = array();
|
||||
}
|
||||
if (!isset($this->_data[self::IDENTIFIER_MESSAGES][self::$_levels[$type]])) {
|
||||
$this->_data[self::IDENTIFIER_MESSAGES][self::$_levels[$type]] = array();
|
||||
if (!isset($this->_messages[self::$_levels[$type]])) {
|
||||
$this->_messages[self::$_levels[$type]] = array();
|
||||
}
|
||||
$this->_data[self::IDENTIFIER_MESSAGES][self::$_levels[$type]][] = $message;
|
||||
$this->_messages[self::$_levels[$type]][] = $message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@ class Wootook_Core_Mvc_Controller_Front
|
|||
const ROUTE_DEFAULT = 'default';
|
||||
const ROUTE_ERROR = 'error';
|
||||
|
||||
// FIXME: Create a router class to manage all this
|
||||
protected $_routes = array(
|
||||
self::ROUTE_ERROR => array(
|
||||
'modules' => array(
|
||||
'core' => array(
|
||||
'class' => 'Wootook_Core_',
|
||||
'path' => 'Wootook/Core'
|
||||
'class' => 'Wootook_Core_Controller_',
|
||||
'path' => 'Wootook/Core/Controller'
|
||||
)
|
||||
),
|
||||
'defaults' => array(
|
||||
|
|
@ -22,20 +23,20 @@ class Wootook_Core_Mvc_Controller_Front
|
|||
self::ROUTE_DEFAULT => array(
|
||||
'modules' => array(
|
||||
'core' => array(
|
||||
'class' => 'Wootook_Core_',
|
||||
'path' => 'Wootook/Core'
|
||||
'class' => 'Wootook_Core_Controller_',
|
||||
'path' => 'Wootook/Core/Controller'
|
||||
),
|
||||
'admin' => array(
|
||||
'class' => 'Wootook_Admin_',
|
||||
'path' => 'Wootook/Admin'
|
||||
'class' => 'Wootook_Admin_Controller_',
|
||||
'path' => 'Wootook/Admin/Controller'
|
||||
),
|
||||
'player' => array(
|
||||
'class' => 'Wootook_Player_',
|
||||
'path' => 'Wootook/Player'
|
||||
'class' => 'Wootook_Player_Controller_',
|
||||
'path' => 'Wootook/Player/Controller'
|
||||
),
|
||||
'empire' => array(
|
||||
'class' => 'Wootook_Empire_',
|
||||
'path' => 'Wootook/Empire'
|
||||
'class' => 'Wootook_Empire_Controller_',
|
||||
'path' => 'Wootook/Empire/Controller'
|
||||
)
|
||||
),
|
||||
'defaults' => array(
|
||||
|
|
@ -78,7 +79,16 @@ class Wootook_Core_Mvc_Controller_Front
|
|||
|
||||
protected function _camelizeClass($string)
|
||||
{
|
||||
return str_replace(' ', '_', ucwords(str_replace('-', ' ', $string)));
|
||||
$string = strtolower($string);
|
||||
$string = str_replace(' ', '_', ucwords(str_replace('.', ' ', $string)));
|
||||
return str_replace(' ', '', ucwords(str_replace('-', ' ', $string)));
|
||||
}
|
||||
|
||||
protected function _camelizePath($string)
|
||||
{
|
||||
$string = strtolower($string);
|
||||
$string = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('.', ' ', $string)));
|
||||
return str_replace(' ', '', ucwords(str_replace('-', ' ', $string)));
|
||||
}
|
||||
|
||||
protected function _camelizeMethod($string)
|
||||
|
|
@ -86,15 +96,29 @@ class Wootook_Core_Mvc_Controller_Front
|
|||
return lcfirst(str_replace(' ', '', ucwords(str_replace('-', ' ', $string))));
|
||||
}
|
||||
|
||||
protected function _getControllerClass($modulePrefix, $controllerKey)
|
||||
protected function _getControllerClass($route, $module, $controllerKey)
|
||||
{
|
||||
if (!isset($this->_routes[$route])) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($this->_routes[$route]['modules'][$module])) {
|
||||
return null;
|
||||
}
|
||||
$modulePrefix = $this->_routes[$route]['modules'][$module]['class'];
|
||||
return $modulePrefix . $this->_camelizeClass($controllerKey) . 'Controller';
|
||||
}
|
||||
|
||||
protected function _getControllerPath($modulePath, $controllerKey)
|
||||
protected function _getControllerFilename($route, $module, $controllerKey)
|
||||
{
|
||||
return $modulePath . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR
|
||||
. $this->_camelizeClass($controllerKey) . 'Controller.php';
|
||||
if (!isset($this->_routes[$route])) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($this->_routes[$route]['modules'][$module])) {
|
||||
return null;
|
||||
}
|
||||
$modulePath = $this->_routes[$route]['modules'][$module]['path'];
|
||||
|
||||
return $modulePath . DIRECTORY_SEPARATOR . $this->_camelizePath($controllerKey) . 'Controller.php';
|
||||
}
|
||||
|
||||
protected function _getActionMethod($actionKey)
|
||||
|
|
@ -102,6 +126,18 @@ class Wootook_Core_Mvc_Controller_Front
|
|||
return $this->_camelizeMethod($actionKey) . 'Action';
|
||||
}
|
||||
|
||||
protected function _forward($action, $controller = null, $module = null)
|
||||
{
|
||||
$this->_request->setActionName($action);
|
||||
if ($controller !== null) {
|
||||
$this->_request->setControllerName($controller);
|
||||
if ($module != null) {
|
||||
$this->_request->setModuleName($module);
|
||||
}
|
||||
}
|
||||
$this->_response->setIsDispatched(false);
|
||||
}
|
||||
|
||||
public function dispatch($route = null)
|
||||
{
|
||||
if ($route == null) {
|
||||
|
|
@ -115,51 +151,42 @@ class Wootook_Core_Mvc_Controller_Front
|
|||
$loop = 0;
|
||||
while ($loop++ < 100) {
|
||||
$moduleKey = $this->_request->getModuleName();
|
||||
$controllerKey = $this->_request->getControllerName();
|
||||
$actionKey = $this->_request->getActionName();
|
||||
|
||||
if (empty($moduleKey)) {
|
||||
$this->_setDefaultRouteAction($route, $moduleKey, $controllerKey, $actionKey);
|
||||
$this->_forward('no-route', 'error', 'core');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($this->_routes[$route]['modules'][$moduleKey])) {
|
||||
$this->_setNoRouteAction($route, $moduleKey, $controllerKey, $actionKey);
|
||||
$this->_forward('no-route', 'error', 'core');
|
||||
continue;
|
||||
}
|
||||
|
||||
$controllerKey = $this->_request->getControllerName();
|
||||
if (empty($controllerKey)) {
|
||||
$controllerKey = $this->_routes[$route]['defaults']['controller'];
|
||||
}
|
||||
|
||||
$controllerClass = $this->_getControllerClass($this->_routes[$route]['modules'][$moduleKey]['class'], $controllerKey);
|
||||
$controllerPath = $this->_getControllerPath($this->_routes[$route]['modules'][$moduleKey]['path'], $controllerKey);
|
||||
$controllerClass = $this->_getControllerClass($route, $moduleKey, $controllerKey);
|
||||
$controllerPath = $this->_getControllerFilename($route, $moduleKey, $controllerKey);
|
||||
|
||||
if (!class_exists($controllerClass, false) && Wootook::fileExists($controllerPath)) {
|
||||
include_once $controllerPath;
|
||||
}
|
||||
|
||||
if (!class_exists($controllerClass, false)) {
|
||||
$this->_setNoRouteAction($route, $moduleKey, $controllerKey, $actionKey);
|
||||
|
||||
$controllerClass = $this->_getControllerClass($this->_routes[$route]['modules'][$moduleKey]['class'], $controllerKey);
|
||||
$controllerPath = $this->_getControllerPath($this->_routes[$route]['modules'][$moduleKey]['path'], $controllerKey);
|
||||
|
||||
include_once $controllerPath;
|
||||
$this->_forward('no-route', 'error', 'core');
|
||||
continue;
|
||||
}
|
||||
|
||||
$actionKey = $this->_request->getActionName();
|
||||
if (empty($actionKey)) {
|
||||
$actionKey = $this->_routes[$route]['defaults']['action'];
|
||||
}
|
||||
|
||||
$actionMethod = $this->_getActionMethod($actionKey);
|
||||
if (!method_exists($controllerClass, $actionMethod)) {
|
||||
$this->_setNoRouteAction($route, $moduleKey, $controllerKey, $actionKey);
|
||||
|
||||
$controllerClass = $this->_getControllerClass($this->_routes[$route]['modules'][$moduleKey]['class'], $controllerKey);
|
||||
$controllerPath = $this->_getControllerPath($this->_routes[$route]['modules'][$moduleKey]['path'], $controllerKey);
|
||||
|
||||
include_once $controllerPath;
|
||||
|
||||
$actionMethod = $this->_getActionMethod($actionKey);
|
||||
$this->_forward('no-route', 'error', 'core');
|
||||
continue;
|
||||
}
|
||||
|
||||
$controller = new $controllerClass($this->_request, $this->_response);
|
||||
|
|
@ -173,6 +200,11 @@ class Wootook_Core_Mvc_Controller_Front
|
|||
}
|
||||
|
||||
$controller->$actionMethod();
|
||||
|
||||
if (!$this->_response->isDispatched()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$controller->postDispatch();
|
||||
|
||||
if ($this->_response->isDispatched()) {
|
||||
|
|
|
|||
|
|
@ -11,11 +11,13 @@ abstract class Wootook_Core_PluginLoader_PluginLoader
|
|||
return $this->_pluginInstances[$pluginName];
|
||||
}
|
||||
|
||||
$pluginName = str_replace(' ', '_', ucwords(str_replace('.', ' ', $pluginName)));
|
||||
$pluginName = str_replace(' ', '', ucwords(str_replace('-', ' ', $pluginName)));
|
||||
|
||||
foreach ($this->_namespaces as $namespace => $path) {
|
||||
$className = $namespace . $pluginName;
|
||||
$fileName = $path . DIRECTORY_SEPARATOR . $pluginName . '.php';
|
||||
$fileName = $path . DIRECTORY_SEPARATOR .
|
||||
str_replace('_', DIRECTORY_SEPARATOR, $pluginName) . '.php';
|
||||
|
||||
if (!Wootook::fileExists($fileName)) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ abstract class Wootook_Core_Resource_CollectionAbstract
|
|||
if ($connection instanceof Wootook_Core_Database_Adapter_Pdo_Mysql) {
|
||||
$this->_connection = $connection;
|
||||
} else if (is_string($connection)) {
|
||||
$this->_connection = Wootook_Core_Database_Adapter_Pdo_Mysql::getConnection($connection);
|
||||
$this->_connection = Wootook_Core_Database_ConnectionManager::getSingleton()
|
||||
->getConnection($connection);
|
||||
} else {
|
||||
throw new Wootook_Core_Exception_RuntimeException(
|
||||
'First parameter should be either a database connection object or a string identifier.');
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ class Wootook_Core_Setup_Updater
|
|||
public function setSetupConnection($connection)
|
||||
{
|
||||
if (is_string($connection)) {
|
||||
$this->_setupConnection = Wootook_Core_Database_Adapter_Pdo_Mysql::getConnection($connection);
|
||||
$this->_setupConnection = Wootook_Core_Database_ConnectionManager::getSingleton()
|
||||
->getConnection($connection);
|
||||
} else {
|
||||
$this->_setupConnection = $connection;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -841,7 +841,8 @@ class Wootook_Empire_Model_Planet
|
|||
|
||||
public static function searchMostFreeSystems($galaxyList = null, $systemList = null)
|
||||
{
|
||||
$adapter = $this->getReadConnection();
|
||||
$adapter = Wootook_Core_Database_ConnectionManager::getSingleton()
|
||||
->getConnection('core_read');
|
||||
$select = $adapter->select(array('galaxy' => 'galaxy'));
|
||||
$select
|
||||
->column(array(
|
||||
|
|
@ -859,7 +860,7 @@ class Wootook_Empire_Model_Planet
|
|||
|
||||
if ($galaxyList !== null) {
|
||||
array_walk($galaxyList, array(__CLASS__, '_cleanItemRanges'));
|
||||
$collection->where('galaxy.galaxy IN(' . implode(', ', $galaxyList) . ')');
|
||||
$select->where('galaxy.galaxy IN(' . implode(', ', $galaxyList) . ')');
|
||||
}
|
||||
|
||||
if ($systemList === null && Wootook::getGameConfig('user/registration/system_list')) {
|
||||
|
|
@ -868,7 +869,7 @@ class Wootook_Empire_Model_Planet
|
|||
|
||||
if ($systemList !== null) {
|
||||
array_walk($systemList, array(__CLASS__, '_cleanItemRanges'));
|
||||
$collection->where('galaxy.system IN(' . implode(', ', $systemList) . ')');
|
||||
$select->where('galaxy.system IN(' . implode(', ', $systemList) . ')');
|
||||
}
|
||||
|
||||
$orders = array(
|
||||
|
|
@ -877,14 +878,14 @@ class Wootook_Empire_Model_Planet
|
|||
"1 + 2 * ABS(galaxy.system - CEIL({$adapter->quote(Wootook::getGameConfig('engine/universe/systems'))} / 2))",
|
||||
"RAND() / 1000",
|
||||
);
|
||||
$collection
|
||||
$select
|
||||
->order('((' . implode(') * (', $orders) . '))', 'ASC')
|
||||
//->order("ABS(galaxy.system - CEIL({$collection->quote(Wootook::getGameConfig('engine/universe/systems'))} / 2))", 'ASC')
|
||||
//->order("ABS(galaxy.galaxy - CEIL({$collection->quote(Wootook::getGameConfig('engine/universe/galaxies'))} / 2))", 'ASC')
|
||||
//->order("1.5 / COUNT(*)", 'ASC')
|
||||
->order('RAND()', 'ASC');
|
||||
|
||||
return $adapter;
|
||||
return $select;
|
||||
}
|
||||
|
||||
private static function _cleanItemRanges(&$value, $index, $userdata = null)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Wootook_Empire_Model_Planet_PluginLoader
|
|||
$this->registerNamespace('Legacies_Empire_Model_Planet_Building_');
|
||||
}
|
||||
|
||||
protected function _load($className, $useSingleton)
|
||||
protected function _load($className, $useSingleton, Array $constructorParams = array())
|
||||
{
|
||||
$reflection = new ReflectionClass($className);
|
||||
if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) {
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class Wootook_Player_Model_Entity
|
|||
$select->limit(1);
|
||||
|
||||
try {
|
||||
$statement = $adapter->prepare($select);
|
||||
$statement = $select->prepare();
|
||||
if (!$statement->execute()) {
|
||||
throw new Wootook_Empire_Exception_RuntimeException('No more planet to colonize!'); // Oops, no more free place
|
||||
}
|
||||
|
|
@ -203,7 +203,6 @@ class Wootook_Player_Model_Entity
|
|||
$player->getWriteConnection()->rollback();
|
||||
$session = Wootook_Core_Model_Session::factory(Wootook_Player_Model_Entity::SESSION_KEY);
|
||||
|
||||
$this->getWriteConnection()->rollback();
|
||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||
$session->addError($e->getMessage());
|
||||
return null;
|
||||
|
|
@ -211,7 +210,6 @@ class Wootook_Player_Model_Entity
|
|||
$player->getWriteConnection()->rollback();
|
||||
$session = Wootook_Core_Model_Session::factory(Wootook_Player_Model_Entity::SESSION_KEY);
|
||||
|
||||
$this->getWriteConnection()->rollback();
|
||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||
$session->addError($e->getMessage());
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ parent.frames['Hauptframe'].location.replace("overview.php");
|
|||
</tr><tr>
|
||||
<td><div><a href="errors.php" accesskey="e" target="<?php echo $this->getData('mf')?>"><?php echo $this->getData('adm_error')?></a></div></td>
|
||||
</tr><tr>
|
||||
<td><div><a href="http://www.xnova-ng.org/forum/index.php" accesskey="3" target="<?php echo $this->getData('mf')?>"><?php echo $this->getData('adm_help')?></a></div></td>
|
||||
<td><div><a href="http://wootook.org/forum/index.php" accesskey="3" target="<?php echo $this->getData('mf')?>"><?php echo $this->getData('adm_help')?></a></div></td>
|
||||
</tr><tr>
|
||||
<td><div><a href="../frames.php" accesskey="i" target="_top" style="color:red"><?php echo $this->getData('adm_back')?></a></div></td>
|
||||
</tr><tr>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<td class="c" colspan="2"><?php echo $this->getData('adm_ov_infos')?></td>
|
||||
</tr><tr>
|
||||
<td class="b" style="color:#FFFFFF"><?php echo $this->getData('adm_ov_yourv')?>: <strong><?php echo $this->getData('adm_ov_data_yourv')?></strong></td>
|
||||
<td class="b" style="color:#FFFFFF"><?php echo $this->getData('adm_ov_lastv')?>: <b><a style="color:orange;" href="http://www.xnova-ng.org/"><?php echo $this->getData('adm_ov_here')?></a></b></td>
|
||||
<td class="b" style="color:#FFFFFF"><?php echo $this->getData('adm_ov_lastv')?>: <b><a style="color:orange;" href="http://wootook.org/"><?php echo $this->getData('adm_ov_here')?></a></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<td colspan="2" class="c"><b><?php echo $this->getData('cred_link')?></b></td>
|
||||
</tr><tr>
|
||||
<th width="278"><?php echo $this->getData('cred_site')?>:<br><?php echo $this->getData('cred_forum')?>:</th>
|
||||
<th width="279"><a href="http://www.xnova-ng.org" target="_blank">www.xnova-ng.org</a><br><a href="http://www.xnova-ng.org/forum" target="_blank">www.xnova-ng.org/forum</a></th>
|
||||
<th width="279"><a href="http://wootook.org" target="_blank">www.xnova-ng.org</a><br><a href="http://wootook.org/forum" target="_blank">www.xnova-ng.org/forum</a></th>
|
||||
</tr><tr>
|
||||
<td colspan="2" class="c"><b><?php echo $this->getData('cred_credit')?></b></td>
|
||||
</tr><tr>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -62,7 +62,7 @@ while($v=mysql_fetch_object($query)){
|
|||
$msg=preg_replace("#:\(#isU","<img src=\"images/smileys/sad.png\" align=\"absmiddle\" title=\":(\" alt=\":(\">",$msg);
|
||||
$msg=preg_replace("#;\)#isU","<img src=\"images/smileys/wink.png\" align=\"absmiddle\" title=\";)\" alt=\";)\">",$msg);
|
||||
$msg=preg_replace("#:s#isU","<img src=\"images/smileys/shit.png\" align=\"absmiddle\" title=\":s\" alt=\":s\">",$msg);
|
||||
$msg=preg_replace("#xnova#","<a href=\"http://www.xnova-ng.org\">Wootook</a>",$msg);
|
||||
$msg=preg_replace("#xnova#","<a href=\"http://wootook.org\">Wootook</a>",$msg);
|
||||
|
||||
// Affichage du message
|
||||
$msg="<div align=\"left\">".$nick." > ".$msg."<br></div>";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://www.xnova-ng.org>
|
||||
* Copyright (c) 2009-Present, Wootook Support Team <http://wootook.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue