From: Roland Häder Date: Wed, 2 Dec 2020 01:13:48 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0b9976904b63e57186a5ee2943dab1abbe96f07d;p=city.git Continued: - renamed "Wrapper" to "Frontend" - added missing trait for above instance - removed all .htaccess files - updated core framework Signed-off-by: Roland Häder --- diff --git a/application/.htaccess b/application/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/.htaccess b/application/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/.htaccess b/application/city/classes/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/actions/.htaccess b/application/city/classes/actions/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/actions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/actions/class_BaseCityAction.php b/application/city/classes/actions/class_BaseCityAction.php index 595c4d4..ee069c8 100644 --- a/application/city/classes/actions/class_BaseCityAction.php +++ b/application/city/classes/actions/class_BaseCityAction.php @@ -36,7 +36,7 @@ abstract class BaseCityAction extends BaseAction { * @param $className Name of the class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); } diff --git a/application/city/classes/actions/html/.htaccess b/application/city/classes/actions/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/actions/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/actions/html/city/.htaccess b/application/city/classes/actions/html/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/actions/html/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/city_daemon/.htaccess b/application/city/classes/city_daemon/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/city_daemon/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/city_daemon/class_BaseCityDaemon.php b/application/city/classes/city_daemon/class_BaseCityDaemon.php index 5e743d1..ded79a3 100644 --- a/application/city/classes/city_daemon/class_BaseCityDaemon.php +++ b/application/city/classes/city_daemon/class_BaseCityDaemon.php @@ -6,19 +6,21 @@ namespace Org\Mxchange\City\Daemon; use Org\Mxchange\City\Factory\Manager\ManagerFactory; use Org\Mxchange\City\Factory\State\CityStateFactory; use Org\Mxchange\City\Generic\BaseCitySystem; -use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper; +use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Criteria\Add\AddableCriteria; use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria; -use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper; +use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Database\Updateable; -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry;; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; +use Org\Mxchange\CoreFramework\Traits\Crypto\CryptoTrait; +use Org\Mxchange\CoreFramework\Traits\Database\Frontend\DatabaseFrontendTrait; /** * A general City class @@ -43,6 +45,10 @@ use Org\Mxchange\CoreFramework\Response\Responseable; * along with this program. If not, see . */ abstract class BaseCityDaemon extends BaseCitySystem implements Updateable, AddableCriteria { + // Load traits + use CryptoTrait; + use DatabaseFrontendTrait; + /** * City types */ @@ -60,15 +66,15 @@ abstract class BaseCityDaemon extends BaseCitySystem implements Updateable, Adda * @param $className Name of the class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); - // Get a wrapper instance - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class'); + // Get a frontend instance + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_info_db_frontend_class'); // Set it here - $this->setWrapperInstance($wrapperInstance); + $this->setFrontendInstance($frontendInstance); // Get a crypto instance $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class'); @@ -126,11 +132,11 @@ abstract class BaseCityDaemon extends BaseCitySystem implements Updateable, Adda assert($requestInstance instanceof Requestable); // Add City number and type - $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID , 1); - $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode')); + $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_ID , 1); + $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode')); // Add the City id - $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID, $this->getCityId()); + $criteriaInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_ID, $this->getCityId()); } /** @@ -151,7 +157,7 @@ abstract class BaseCityDaemon extends BaseCitySystem implements Updateable, Adda $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Add search criteria - $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName()); + $searchInstance->addCriteria(UserDatabaseFrontend::DB_COLUMN_USERNAME, $this->getUserName()); $searchInstance->setLimit(1); // Now get another criteria @@ -163,8 +169,8 @@ abstract class BaseCityDaemon extends BaseCitySystem implements Updateable, Adda // Add the search criteria for searching for the right entry $updateInstance->setSearchInstance($searchInstance); - // Set wrapper class name - $updateInstance->setWrapperConfigEntry('user_db_wrapper_class'); + // Set frontend class name + $updateInstance->setFrontendConfigEntry('user_db_frontend_class'); // Remember the update in database result $this->getResultInstance()->add2UpdateQueue($updateInstance); @@ -234,7 +240,7 @@ abstract class BaseCityDaemon extends BaseCitySystem implements Updateable, Adda */ public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $cityData) { // Add all data the array provides - foreach (CityInformationDatabaseWrapper::getAllElements() as $element) { + foreach (CityInformationDatabaseFrontend::getAllElements() as $element) { // Is the element there? if (isset($cityData[$element])) { // Add it diff --git a/application/city/classes/city_daemon/default/.htaccess b/application/city/classes/city_daemon/default/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/city_daemon/default/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/class_BaseCitySystem.php b/application/city/classes/class_BaseCitySystem.php index 084a716..13d1a29 100644 --- a/application/city/classes/class_BaseCitySystem.php +++ b/application/city/classes/class_BaseCitySystem.php @@ -49,7 +49,7 @@ abstract class BaseCitySystem extends BaseFrameworkSystem { * @param $className Name of the class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); } diff --git a/application/city/classes/commands/.htaccess b/application/city/classes/commands/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/commands/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/commands/console/.htaccess b/application/city/classes/commands/console/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/commands/console/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/commands/html/.htaccess b/application/city/classes/commands/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/commands/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/commands/html/class_CityHtmlConfirmCommand.php b/application/city/classes/commands/html/class_CityHtmlConfirmCommand.php index 8888756..50b0566 100644 --- a/application/city/classes/commands/html/class_CityHtmlConfirmCommand.php +++ b/application/city/classes/commands/html/class_CityHtmlConfirmCommand.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Command\BaseCommand; use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; -use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper; +use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; @@ -123,7 +123,7 @@ class CityHtmlConfirmCommand extends BaseCommand implements Commandable { } // Set username - $templateInstance->assignVariable('username', $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USERNAME)); + $templateInstance->assignVariable('username', $userInstance->getField(UserDatabaseFrontend::DB_COLUMN_USERNAME)); // Construct the menu in every command. We could do this in BaseCommand class. But this means // *every* command has a navigation system and that is want we don't want. diff --git a/application/city/classes/commands/html/class_CityHtmlResendLinkCommand.php b/application/city/classes/commands/html/class_CityHtmlResendLinkCommand.php index 55f82f0..5107e75 100644 --- a/application/city/classes/commands/html/class_CityHtmlResendLinkCommand.php +++ b/application/city/classes/commands/html/class_CityHtmlResendLinkCommand.php @@ -7,7 +7,7 @@ use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Command\BaseCommand; use Org\Mxchange\CoreFramework\Command\Commandable; use Org\Mxchange\CoreFramework\Controller\Controller; -use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper; +use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; @@ -91,7 +91,7 @@ class CityHtmlResendLinkCommand extends BaseCommand implements Commandable { $hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString)); // Update the user class - $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, $hashedString); + $userInstance->updateDatabaseField(UserDatabaseFrontend::DB_COLUMN_CONFIRM_HASH, $hashedString); // Re-set config entry to mailer engine FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('html_template_class', FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('mail_template_class')); diff --git a/application/city/classes/controller/.htaccess b/application/city/classes/controller/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/controller/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/controller/console/.htaccess b/application/city/classes/controller/console/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/controller/console/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/controller/html/.htaccess b/application/city/classes/controller/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/controller/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/controller/html/form/.htaccess b/application/city/classes/controller/html/form/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/controller/html/form/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/controller/html/login/.htaccess b/application/city/classes/controller/html/login/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/controller/html/login/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/.htaccess b/application/city/classes/database/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/.htaccess b/application/city/classes/database/frontend/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/city/.htaccess b/application/city/classes/database/frontend/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/city/class_CityInformationDatabaseFrontend.php b/application/city/classes/database/frontend/city/class_CityInformationDatabaseFrontend.php new file mode 100644 index 0000000..1a795ef --- /dev/null +++ b/application/city/classes/database/frontend/city/class_CityInformationDatabaseFrontend.php @@ -0,0 +1,284 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityInformationDatabaseFrontend extends BaseDatabaseFrontend implements CityInformationFrontend, Registerable { + // Constants for database table names + const DB_TABLE_CITY_INFORMATION = 'city_data'; + + // Constants for database column names + const DB_COLUMN_CITY_ID = 'city_id'; + const DB_COLUMN_CITY_MODE = 'city_mode'; + const DB_COLUMN_CITY_NAME = 'city_name'; + const DB_COLUMN_CITY_USER_ID = 'city_user_id'; + const DB_COLUMN_CITY_REGION_ID = 'city_region_id'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this database frontend by a provided user class + * + * @return $frontendInstance An instance of the created frontend class + */ + public static final function createCityInformationDatabaseFrontend () { + // Get a new instance + $frontendInstance = new CityInformationDatabaseFrontend(); + + // Set (primary!) table name + $frontendInstance->setTableName(self::DB_TABLE_CITY_INFORMATION); + + // Return the instance + return $frontendInstance; + } + + /** + * Checks whether there is an entry for given city instance + * + * @param $cityInstance An instance of a CityHelper class + * @return $isFound Whether a city id has been found for this city + */ + public function ifCityDataIsFound (CityHelper $cityInstance) { + // Now get a search criteria instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Search for the city number one which is hard-coded the default + $searchInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_ID , 1); + $searchInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_MODE, $cityInstance->getRequestInstance()->getRequestElement('mode')); + $searchInstance->setLimit(1); + + // Get a result back + $resultInstance = $this->doSelectByCriteria($searchInstance); + + // Set result instance in city instance + $cityInstance->setResultInstance($resultInstance); + + // Is it valid? + $isFound = $resultInstance->next(); + + // Return it + return $isFound; + } + + /** + * 'Registers' a new city id along with data provided in the city instance. + * This may sound confusing but avoids double code very nicely... + * + * @param $cityInstance A city instance + * @param $requestInstance An instance of a Requestable class + * @return void + */ + public function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance) { + // Get a dataset instance + $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION)); + + // Set the primary key + $dataSetInstance->setUniqueKey(self::DB_COLUMN_CITY_ID); + + // Add registration elements to the dataset + $cityInstance->addElementsToDataSet($dataSetInstance, $requestInstance); + + // "Insert" this dataset instance completely into the database + $this->queryInsertDataSet($dataSetInstance); + } + + /** + * Removes non-public data from given array. + * + * @param $data An array with possible non-public data that needs to be removed. + * @return $data A cleaned up array with only public data. + */ + public function removeNonPublicDataFromArray(array $data) { + // Currently call only inner method + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...'); + $data = parent::removeNonPublicDataFromArray($data); + + // Return cleaned data + return $data; + } + + /** + * Checks whether the user has already founded a city + * + * @return $hasFounded Whether the user has already founded a city + */ + public function ifUserHasFoundedCity () { + // Get user instance + $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + + // Now get a search criteria instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Search for user's cities + $searchInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_USER_ID, $userInstance->getUserId()); + + // Get a result back + $resultInstance = $this->doSelectByCriteria($searchInstance); + + // Get city manager instance + $managerInstance = ManagerFactory::createManagerByType('city'); + + // Make sure the manager instance is valid + assert($managerInstance instanceof ManageableCity); + + // Set result instance + $managerInstance->setResultInstance($resultInstance); + + // Has it been founded? + $hasFounded = $resultInstance->next(); + + // Return result + return $hasFounded; + } + + /** + * Checks whether the given city name is taken + * + * @para $cityName Name of city + * @return $isTaken Whether the given city name is taken + */ + public function ifCityExists (string $cityName) { + // Now get a search criteria instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Search for the city number one which is hard-coded the default + $searchInstance->addCriteria(CityInformationDatabaseFrontend::DB_COLUMN_CITY_NAME, $cityName); + $searchInstance->setLimit(1); + + // Get a result back + $resultInstance = $this->doSelectByCriteria($searchInstance); + + // Check it + $isTaken = $resultInstance->valid(); + + // Get manger instance + $managerInstance = ManagerFactory::createManagerByType('city'); + + // Make sure the instance is valid + assert($managerInstance instanceof ManageableCity); + + // Set result instance + $managerInstance->setResultInstance($resultInstance); + + // Return result + return $isTaken; + } + + /** + * Creates a city from given request + * + * @para $requestInstance An instance of a Requestable class + * @return void + */ + public function createCityByRequest (Requestable $requestInstance) { + // Make sure all required fields are there + assert($requestInstance->isRequestElementSet(self::DB_COLUMN_CITY_NAME)); + assert($requestInstance->isRequestElementSet(self::DB_COLUMN_CITY_REGION_ID)); + + // Get city name (to save some calls) + $cityName = $requestInstance->getRequestElement(self::DB_COLUMN_CITY_NAME); + + // Make sure the city name is not taken yet + assert(!$this->ifCityExists($cityName)); + + // Get user instance + $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + + // Get a dataset instance + $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION)); + + // Set the primary key + $dataSetInstance->setUniqueKey(self::DB_COLUMN_CITY_ID); + + // Add city name and assign user id + $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_ID , ($this->countTotalRows() + 1)); + $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_NAME , $cityName); + $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_USER_ID , $userInstance->getUserId()); + $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_REGION_ID, $requestInstance->getRequestElement(self::DB_COLUMN_CITY_REGION_ID)); + + // "Insert" this dataset instance completely into the database + $this->queryInsertDataSet($dataSetInstance); + + // Post-check name + assert($this->ifCityExists($cityName)); + } + + /** + * Getter for all city ids as an array + * + * @return $cityIds All city ids as an array + */ + public function getAllCityIds () { + // Init empty search instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // And run it on the database + $resultInstance = $this->doSelectByCriteria($searchInstance); + + // Init array + $cityIds = array(); + + // Anything found? + if ($resultInstance->count() == 0) { + // Nothing found + return $cityIds; + } // END - if + + // Now get all 'city_id' columns + while ($resultInstance->next()) { + // Get current entry + $current = $resultInstance->current(); + + // 'city_id' should be there + assert(isset($current[self::DB_COLUMN_CITY_ID])); + + // Add it to the array + array_push($cityIds, $current[self::DB_COLUMN_CITY_ID]); + } // END - while + + // Return result + return $cityIds; + } +} diff --git a/application/city/classes/database/frontend/city/class_CityInformationDatabaseWrapper.php b/application/city/classes/database/frontend/city/class_CityInformationDatabaseWrapper.php deleted file mode 100644 index 7963d17..0000000 --- a/application/city/classes/database/frontend/city/class_CityInformationDatabaseWrapper.php +++ /dev/null @@ -1,284 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class CityInformationDatabaseWrapper extends BaseDatabaseWrapper implements CityInformationWrapper, Registerable { - // Constants for database table names - const DB_TABLE_CITY_INFORMATION = 'city_data'; - - // Constants for database column names - const DB_COLUMN_CITY_ID = 'city_id'; - const DB_COLUMN_CITY_MODE = 'city_mode'; - const DB_COLUMN_CITY_NAME = 'city_name'; - const DB_COLUMN_CITY_USER_ID = 'city_user_id'; - const DB_COLUMN_CITY_REGION_ID = 'city_region_id'; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this database wrapper by a provided user class - * - * @return $wrapperInstance An instance of the created wrapper class - */ - public static final function createCityInformationDatabaseWrapper () { - // Get a new instance - $wrapperInstance = new CityInformationDatabaseWrapper(); - - // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_CITY_INFORMATION); - - // Return the instance - return $wrapperInstance; - } - - /** - * Checks whether there is an entry for given city instance - * - * @param $cityInstance An instance of a CityHelper class - * @return $isFound Whether a city id has been found for this city - */ - public function ifCityDataIsFound (CityHelper $cityInstance) { - // Now get a search criteria instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Search for the city number one which is hard-coded the default - $searchInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID , 1); - $searchInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_MODE, $cityInstance->getRequestInstance()->getRequestElement('mode')); - $searchInstance->setLimit(1); - - // Get a result back - $resultInstance = $this->doSelectByCriteria($searchInstance); - - // Set result instance in city instance - $cityInstance->setResultInstance($resultInstance); - - // Is it valid? - $isFound = $resultInstance->next(); - - // Return it - return $isFound; - } - - /** - * 'Registers' a new city id along with data provided in the city instance. - * This may sound confusing but avoids double code very nicely... - * - * @param $cityInstance A city instance - * @param $requestInstance An instance of a Requestable class - * @return void - */ - public function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance) { - // Get a dataset instance - $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION)); - - // Set the primary key - $dataSetInstance->setUniqueKey(self::DB_COLUMN_CITY_ID); - - // Add registration elements to the dataset - $cityInstance->addElementsToDataSet($dataSetInstance, $requestInstance); - - // "Insert" this dataset instance completely into the database - $this->queryInsertDataSet($dataSetInstance); - } - - /** - * Removes non-public data from given array. - * - * @param $data An array with possible non-public data that needs to be removed. - * @return $data A cleaned up array with only public data. - */ - public function removeNonPublicDataFromArray(array $data) { - // Currently call only inner method - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...'); - $data = parent::removeNonPublicDataFromArray($data); - - // Return cleaned data - return $data; - } - - /** - * Checks whether the user has already founded a city - * - * @return $hasFounded Whether the user has already founded a city - */ - public function ifUserHasFoundedCity () { - // Get user instance - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); - - // Now get a search criteria instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Search for user's cities - $searchInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_USER_ID, $userInstance->getUserId()); - - // Get a result back - $resultInstance = $this->doSelectByCriteria($searchInstance); - - // Get city manager instance - $managerInstance = ManagerFactory::createManagerByType('city'); - - // Make sure the manager instance is valid - assert($managerInstance instanceof ManageableCity); - - // Set result instance - $managerInstance->setResultInstance($resultInstance); - - // Has it been founded? - $hasFounded = $resultInstance->next(); - - // Return result - return $hasFounded; - } - - /** - * Checks whether the given city name is taken - * - * @para $cityName Name of city - * @return $isTaken Whether the given city name is taken - */ - public function ifCityExists ($cityName) { - // Now get a search criteria instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Search for the city number one which is hard-coded the default - $searchInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NAME, $cityName); - $searchInstance->setLimit(1); - - // Get a result back - $resultInstance = $this->doSelectByCriteria($searchInstance); - - // Check it - $isTaken = $resultInstance->valid(); - - // Get manger instance - $managerInstance = ManagerFactory::createManagerByType('city'); - - // Make sure the instance is valid - assert($managerInstance instanceof ManageableCity); - - // Set result instance - $managerInstance->setResultInstance($resultInstance); - - // Return result - return $isTaken; - } - - /** - * Creates a city from given request - * - * @para $requestInstance An instance of a Requestable class - * @return void - */ - public function createCityByRequest (Requestable $requestInstance) { - // Make sure all required fields are there - assert($requestInstance->isRequestElementSet(self::DB_COLUMN_CITY_NAME)); - assert($requestInstance->isRequestElementSet(self::DB_COLUMN_CITY_REGION_ID)); - - // Get city name (to save some calls) - $cityName = $requestInstance->getRequestElement(self::DB_COLUMN_CITY_NAME); - - // Make sure the city name is not taken yet - assert(!$this->ifCityExists($cityName)); - - // Get user instance - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); - - // Get a dataset instance - $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION)); - - // Set the primary key - $dataSetInstance->setUniqueKey(self::DB_COLUMN_CITY_ID); - - // Add city name and assign user id - $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_ID , ($this->countTotalRows() + 1)); - $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_NAME , $cityName); - $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_USER_ID , $userInstance->getUserId()); - $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_REGION_ID, $requestInstance->getRequestElement(self::DB_COLUMN_CITY_REGION_ID)); - - // "Insert" this dataset instance completely into the database - $this->queryInsertDataSet($dataSetInstance); - - // Post-check name - assert($this->ifCityExists($cityName)); - } - - /** - * Getter for all city ids as an array - * - * @return $cityIds All city ids as an array - */ - public function getAllCityIds () { - // Init empty search instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // And run it on the database - $resultInstance = $this->doSelectByCriteria($searchInstance); - - // Init array - $cityIds = array(); - - // Anything found? - if ($resultInstance->count() == 0) { - // Nothing found - return $cityIds; - } // END - if - - // Now get all 'city_id' columns - while ($resultInstance->next()) { - // Get current entry - $current = $resultInstance->current(); - - // 'city_id' should be there - assert(isset($current[self::DB_COLUMN_CITY_ID])); - - // Add it to the array - array_push($cityIds, $current[self::DB_COLUMN_CITY_ID]); - } // END - while - - // Return result - return $cityIds; - } -} diff --git a/application/city/classes/database/frontend/city_entities/.htaccess b/application/city/classes/database/frontend/city_entities/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/city_entities/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/city_entities/districts/.htaccess b/application/city/classes/database/frontend/city_entities/districts/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/city_entities/districts/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseFrontend.php b/application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseFrontend.php new file mode 100644 index 0000000..758abf1 --- /dev/null +++ b/application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseFrontend.php @@ -0,0 +1,94 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityDistrictsDatabaseFrontend extends BaseDatabaseFrontend implements CityDistrictsFrontend, Registerable { + // Constants for database table names + const DB_TABLE_CITY_DISTRICTS = 'city_districts'; + + // Section id, an referenced city id and district id + const DB_COLUMN_CITY_ID = 'city_id'; + const DB_COLUMN_DISTRICT_ID = 'district_id'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this database frontend by a provided user class + * + * @return $frontendInstance An instance of the created frontend class + */ + public static final function createCityDistrictsDatabaseFrontend () { + // Get a new instance + $frontendInstance = new CityDistrictsDatabaseFrontend(); + + // Set (primary!) table name + $frontendInstance->setTableName(self::DB_TABLE_CITY_DISTRICTS); + + // Return the instance + return $frontendInstance; + } + + /** + * Checks if the given city id is found in districts table + * + * @param $cityId City id to check + * @return $isFound Whether the city id is found + */ + public function ifCityHasDistricts (int $cityId) { + // Get search instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Search for 'city_id' + $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId); + + /* + * Only one entry is enough to find, else this query could run very + * long on large maps. + */ + $searchInstance->setLimit(1); + + // Execute it on database instance + $resultInstance = $this->doSelectByCriteria($searchInstance); + + // Check if there is one entry + $isFound = $resultInstance->next(); + + // Return result + return $isFound; + } +} diff --git a/application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseWrapper.php b/application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseWrapper.php deleted file mode 100644 index b7722a6..0000000 --- a/application/city/classes/database/frontend/city_entities/districts/class_CityDistrictsDatabaseWrapper.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class CityDistrictsDatabaseWrapper extends BaseDatabaseWrapper implements CityDistrictsWrapper, Registerable { - // Constants for database table names - const DB_TABLE_CITY_DISTRICTS = 'city_districts'; - - // Section id, an referenced city id and district id - const DB_COLUMN_CITY_ID = 'city_id'; - const DB_COLUMN_DISTRICT_ID = 'district_id'; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this database wrapper by a provided user class - * - * @return $wrapperInstance An instance of the created wrapper class - */ - public static final function createCityDistrictsDatabaseWrapper () { - // Get a new instance - $wrapperInstance = new CityDistrictsDatabaseWrapper(); - - // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_CITY_DISTRICTS); - - // Return the instance - return $wrapperInstance; - } - - /** - * Checks if the given city id is found in districts table - * - * @param $cityId City id to check - * @return $isFound Whether the city id is found - */ - public function ifCityHasDistricts ($cityId) { - // Get search instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Search for 'city_id' - $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId); - - /* - * Only one entry is enough to find, else this query could run very - * long on large maps. - */ - $searchInstance->setLimit(1); - - // Execute it on database instance - $resultInstance = $this->doSelectByCriteria($searchInstance); - - // Check if there is one entry - $isFound = $resultInstance->next(); - - // Return result - return $isFound; - } -} diff --git a/application/city/classes/database/frontend/city_entities/lots/.htaccess b/application/city/classes/database/frontend/city_entities/lots/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/city_entities/lots/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/city_entities/lots/class_CityLotsDatabaseFrontend.php b/application/city/classes/database/frontend/city_entities/lots/class_CityLotsDatabaseFrontend.php new file mode 100644 index 0000000..1cf4ab5 --- /dev/null +++ b/application/city/classes/database/frontend/city_entities/lots/class_CityLotsDatabaseFrontend.php @@ -0,0 +1,95 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityLotsDatabaseFrontend extends BaseDatabaseFrontend implements CityLotsFrontend, Registerable { + // Constants for database table names + const DB_TABLE_CITY_LOTS = 'city_lots'; + + // Section id, an referenced city id and lot id + const DB_COLUMN_CITY_ID = 'city_id'; + const DB_COLUMN_LOT_ID = 'lot_id'; + const DB_COLUMN_DISTRICT_ID = 'district_id'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this database frontend by a provided user class + * + * @return $frontendInstance An instance of the created frontend class + */ + public static final function createCityLotsDatabaseFrontend () { + // Get a new instance + $frontendInstance = new CityLotsDatabaseFrontend(); + + // Set (primary!) table name + $frontendInstance->setTableName(self::DB_TABLE_CITY_LOTS); + + // Return the instance + return $frontendInstance; + } + + /** + * Checks if the given city id is found in lots table + * + * @param $cityId City id to check + * @return $isFound Whether the city id is found + */ + public function ifCityHasLots (int $cityId) { + // Get search instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Search for 'city_id' + $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId); + + /* + * Only one entry is enough to find, else this query could run very + * long on large maps. + */ + $searchInstance->setLimit(1); + + // Execute it on database instance + $resultInstance = $this->doSelectByCriteria($searchInstance); + + // Check if there is one entry + $isFound = $resultInstance->next(); + + // Return result + return $isFound; + } +} diff --git a/application/city/classes/database/frontend/city_entities/lots/class_CityLotsDatabaseWrapper.php b/application/city/classes/database/frontend/city_entities/lots/class_CityLotsDatabaseWrapper.php deleted file mode 100644 index 9f07157..0000000 --- a/application/city/classes/database/frontend/city_entities/lots/class_CityLotsDatabaseWrapper.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class CityLotsDatabaseWrapper extends BaseDatabaseWrapper implements CityLotsWrapper, Registerable { - // Constants for database table names - const DB_TABLE_CITY_LOTS = 'city_lots'; - - // Section id, an referenced city id and lot id - const DB_COLUMN_CITY_ID = 'city_id'; - const DB_COLUMN_LOT_ID = 'lot_id'; - const DB_COLUMN_DISTRICT_ID = 'district_id'; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this database wrapper by a provided user class - * - * @return $wrapperInstance An instance of the created wrapper class - */ - public static final function createCityLotsDatabaseWrapper () { - // Get a new instance - $wrapperInstance = new CityLotsDatabaseWrapper(); - - // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_CITY_LOTS); - - // Return the instance - return $wrapperInstance; - } - - /** - * Checks if the given city id is found in lots table - * - * @param $cityId City id to check - * @return $isFound Whether the city id is found - */ - public function ifCityHasLots ($cityId) { - // Get search instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Search for 'city_id' - $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId); - - /* - * Only one entry is enough to find, else this query could run very - * long on large maps. - */ - $searchInstance->setLimit(1); - - // Execute it on database instance - $resultInstance = $this->doSelectByCriteria($searchInstance); - - // Check if there is one entry - $isFound = $resultInstance->next(); - - // Return result - return $isFound; - } -} diff --git a/application/city/classes/database/frontend/city_entities/sections/.htaccess b/application/city/classes/database/frontend/city_entities/sections/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/city_entities/sections/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/city_entities/sections/class_CitySectionsDatabaseFrontend.php b/application/city/classes/database/frontend/city_entities/sections/class_CitySectionsDatabaseFrontend.php new file mode 100644 index 0000000..dc4004f --- /dev/null +++ b/application/city/classes/database/frontend/city_entities/sections/class_CitySectionsDatabaseFrontend.php @@ -0,0 +1,274 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CitySectionsDatabaseFrontend extends BaseDatabaseFrontend implements CitySectionsFrontend, Registerable { + // Constants for database table names + const DB_TABLE_CITY_SECTIONS = 'city_sections'; + + // Entry id + const DB_COLUMN_ENTRY_ID = 'entry_id'; + + // Section id, an referenced city id and lot id + const DB_COLUMN_SECTION_ID = 'city_section_id'; + const DB_COLUMN_CITY_ID = 'city_id'; + + /* + * Lot id, the lot id is only set if the player has "aquired" the sections + * and has created a lot based on these sections. + */ + const DB_COLUMN_LOT_ID = 'lot_id'; + + // Section and sub type (e.g. residential, hut) + const DB_COLUMN_SECTION_TYPE = 'section_type'; + const DB_COLUMN_SECTION_SUB_TYPE = 'section_sub_type'; + + // X-Y-Z position + const DB_COLUMN_SECTION_POSITION_X = 'section_position_x'; + const DB_COLUMN_SECTION_POSITION_Y = 'section_position_y'; + const DB_COLUMN_SECTION_POSITION_Z = 'section_position_z'; + + // Connected neigbouring sections + const DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID = 'section_neighbour_west_id'; + const DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID = 'section_neighbour_east_id'; + const DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID = 'section_neighbour_north_id'; + const DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID = 'section_neighbour_south_id'; + const DB_COLUMN_SECTION_NEIGHBOUR_UP_ID = 'section_neighbour_up_id'; + const DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID = 'section_neighbour_down_id'; + + // Other settings: + // Reserved section (see documentation) + const DB_COLUMN_SECTION_RESERVED = 'section_reserved'; + + // Section types + // @TODO "water" is not yet supported and may end up in a very random land. + const SECTION_TYPE_WATER = 'water'; + const SECTION_TYPE_EMPTY_LAND = 'land'; + const SECTION_TYPE_AIR = 'air'; + + // Sub sections + // @TODO All types of water are not supported yet. + const SECTION_SUB_TYPE_GRASS = 'grass'; + const SECTION_SUB_TYPE_AIR = 'air'; + + // Reserved flag + const IS_NOT_RESERVED = 0; + const IS_RESERVED = 1; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this database frontend by a provided user class + * + * @return $frontendInstance An instance of the created frontend class + */ + public static final function createCitySectionsDatabaseFrontend () { + // Get a new instance + $frontendInstance = new CitySectionsDatabaseFrontend(); + + // Set (primary!) table name + $frontendInstance->setTableName(self::DB_TABLE_CITY_SECTIONS); + + // Return the instance + return $frontendInstance; + } + + /** + * Checks if the given city id is found in sections table + * + * @param $cityId City id to check + * @return $isFound Whether the city id is found + */ + public function ifCityHasSections (int $cityId) { + // Get search instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Search for 'city_id' + $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId); + + /* + * Only one entry is enough to find, else this query could run very + * long on large maps. + */ + $searchInstance->setLimit(1); + + // Execute it on database instance + $resultInstance = $this->doSelectByCriteria($searchInstance); + + // Check if there is one entry + $isFound = $resultInstance->next(); + + // Return result + return $isFound; + } + + /** + * Expands the sections table with initial data for given city id + * + * @param $cityId City id to check + * @return $ids Sections ids from initial expansion + * @todo Add handling of water types to make a more cooler map + */ + public function doInitialCityExpansion (int $cityId) { + // Make sure this city has no sections + assert(!$this->ifCityHasSections($cityId)); + + /* + * "Cache" max "radius" for initial city expansion. It is not a real + * radius but more a max expansion area (expand +- half of "radius" + * from 0/0). The "zero point" is always calculated in. + * + * This gives a maxium initial area calculated as follows: + * + * totalInitialSections = (radius + 1) * (radius + 1) + */ + $radius = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_xy_expansion_radius'); + + // Max up and down ... + $maxUp = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_up_expansion'); + $maxDown = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_down_expansion'); + + // Calculate total sections + $totalSections = (($radius + 1) * ($radius + 1) * $maxUp * ($maxDown + 1)); + + // Debug message: + /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: radius=' . $radius . ',maxUp=' . $maxUp . ',maxDown=' . $maxDown . ',totalSections=' . $totalSections); + + // Get data set instance + $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_SECTIONS)); + + // Add values for "zero point" + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_ID , 1); + $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_ID , $cityId); + $dataSetInstance->addCriteria(self::DB_COLUMN_LOT_ID , 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_TYPE , self::SECTION_TYPE_AIR); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_SUB_TYPE , self::SECTION_SUB_TYPE_AIR); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_X , 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_Y , 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_Z , 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID, 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID, 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID , 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID , 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_UP_ID , 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID , 0); + $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_RESERVED , self::IS_NOT_RESERVED); + + // Set primary key to 'city_id'/'section_id' + $dataSetInstance->setPrimaryKeyCombined(array(self::DB_COLUMN_CITY_ID, self::DB_COLUMN_SECTION_ID)); + + // Entry id for counting each entry + $dataSetInstance->setUniqueKey(self::DB_COLUMN_ENTRY_ID); + + // Add "zero point" + $this->queryInsertDataSet($dataSetInstance); + + // Set section id to 2 as 1 is already initialized + init array + $sections = array(); + + // Output message to ask for user's patience ... + self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: Writing ' . $totalSections . ' sections for city ' . $cityId . ' ... (this may takes some time)'); + + // Expand half of it to north/south (north=positive, south=negative) + for ($north = 1; $north < round($radius / 2); $north++) { + // Expand half of it to west/east (west=positive, east=negative) + for ($west = 1; $west < round($radius / 2); $west++) { + // Expand up/down (including "zero point") + for ($z = $maxDown; $z < ($maxUp + 1); $z++) { + // Debug message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: north=' . $north . ',west=' . $west . ',z=' . $z); + + // Fill array up with south/east/down ids + $sections[($north * -1)][($west * -1)][$z]['type'] = self::SECTION_TYPE_EMPTY_LAND; + $sections[($north * -1)][($west * -1)][$z]['sub'] = self::SECTION_SUB_TYPE_GRASS; + + // Fill up array with north/west/up ids (only air) + $sections[$north][$west][$z]['type'] = self::SECTION_TYPE_AIR; + $sections[$north][$west][$z]['sub'] = self::SECTION_SUB_TYPE_AIR; + } // END - for + } // END - for + } // END - for + + // Init section id with 2 as 1 is the "zero point" + $sectionId = 2; + + // Loop through whole array again for writing it to database: north/south + foreach ($sections as $x => $sectionX) { + // Loop through west/east values + foreach ($sectionX as $y => $sectionY) { + // Loop through up/down values + foreach ($sectionY as $z => $sectionData) { + // Debug message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ',y=' . $y . ',z=' . $z . ',sectionId=' . $sectionId); + + // Set all coordinates for positive directions + $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_ID , $sectionId); + $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_X, $x); + $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_Y, $y); + $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_Z, $z); + $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_TYPE , $sectionData['type']); + $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_SUB_TYPE , $sectionData['sub']); + + // Add value to database + $this->queryInsertDataSet($dataSetInstance); + + // Count id up + $sectionId++; + } // END - foreach + + // Debug message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ',y=' . $y . ' has been written.'); + } // END - foreach + + // Debug message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ' has been written.'); + } // END - foreach + + // Thank you for waiting! :-) + self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: A total of ' . $totalSections . ' sections has been written for city id ' . $cityId . '.'); + } +} diff --git a/application/city/classes/database/frontend/city_entities/sections/class_CitySectionsDatabaseWrapper.php b/application/city/classes/database/frontend/city_entities/sections/class_CitySectionsDatabaseWrapper.php deleted file mode 100644 index 2b4d671..0000000 --- a/application/city/classes/database/frontend/city_entities/sections/class_CitySectionsDatabaseWrapper.php +++ /dev/null @@ -1,274 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class CitySectionsDatabaseWrapper extends BaseDatabaseWrapper implements CitySectionsWrapper, Registerable { - // Constants for database table names - const DB_TABLE_CITY_SECTIONS = 'city_sections'; - - // Entry id - const DB_COLUMN_ENTRY_ID = 'entry_id'; - - // Section id, an referenced city id and lot id - const DB_COLUMN_SECTION_ID = 'city_section_id'; - const DB_COLUMN_CITY_ID = 'city_id'; - - /* - * Lot id, the lot id is only set if the player has "aquired" the sections - * and has created a lot based on these sections. - */ - const DB_COLUMN_LOT_ID = 'lot_id'; - - // Section and sub type (e.g. residential, hut) - const DB_COLUMN_SECTION_TYPE = 'section_type'; - const DB_COLUMN_SECTION_SUB_TYPE = 'section_sub_type'; - - // X-Y-Z position - const DB_COLUMN_SECTION_POSITION_X = 'section_position_x'; - const DB_COLUMN_SECTION_POSITION_Y = 'section_position_y'; - const DB_COLUMN_SECTION_POSITION_Z = 'section_position_z'; - - // Connected neigbouring sections - const DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID = 'section_neighbour_west_id'; - const DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID = 'section_neighbour_east_id'; - const DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID = 'section_neighbour_north_id'; - const DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID = 'section_neighbour_south_id'; - const DB_COLUMN_SECTION_NEIGHBOUR_UP_ID = 'section_neighbour_up_id'; - const DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID = 'section_neighbour_down_id'; - - // Other settings: - // Reserved section (see documentation) - const DB_COLUMN_SECTION_RESERVED = 'section_reserved'; - - // Section types - // @TODO "water" is not yet supported and may end up in a very random land. - const SECTION_TYPE_WATER = 'water'; - const SECTION_TYPE_EMPTY_LAND = 'land'; - const SECTION_TYPE_AIR = 'air'; - - // Sub sections - // @TODO All types of water are not supported yet. - const SECTION_SUB_TYPE_GRASS = 'grass'; - const SECTION_SUB_TYPE_AIR = 'air'; - - // Reserved flag - const IS_NOT_RESERVED = 0; - const IS_RESERVED = 1; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this database wrapper by a provided user class - * - * @return $wrapperInstance An instance of the created wrapper class - */ - public static final function createCitySectionsDatabaseWrapper () { - // Get a new instance - $wrapperInstance = new CitySectionsDatabaseWrapper(); - - // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_CITY_SECTIONS); - - // Return the instance - return $wrapperInstance; - } - - /** - * Checks if the given city id is found in sections table - * - * @param $cityId City id to check - * @return $isFound Whether the city id is found - */ - public function ifCityHasSections ($cityId) { - // Get search instance - $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); - - // Search for 'city_id' - $searchInstance->addCriteria(self::DB_COLUMN_CITY_ID, $cityId); - - /* - * Only one entry is enough to find, else this query could run very - * long on large maps. - */ - $searchInstance->setLimit(1); - - // Execute it on database instance - $resultInstance = $this->doSelectByCriteria($searchInstance); - - // Check if there is one entry - $isFound = $resultInstance->next(); - - // Return result - return $isFound; - } - - /** - * Expands the sections table with initial data for given city id - * - * @param $cityId City id to check - * @return $ids Sections ids from initial expansion - * @todo Add handling of water types to make a more cooler map - */ - public function doInitialCityExpansion ($cityId) { - // Make sure this city has no sections - assert(!$this->ifCityHasSections($cityId)); - - /* - * "Cache" max "radius" for initial city expansion. It is not a real - * radius but more a max expansion area (expand +- half of "radius" - * from 0/0). The "zero point" is always calculated in. - * - * This gives a maxium initial area calculated as follows: - * - * totalInitialSections = (radius + 1) * (radius + 1) - */ - $radius = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_xy_expansion_radius'); - - // Max up and down ... - $maxUp = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_up_expansion'); - $maxDown = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('city_max_initial_down_expansion'); - - // Calculate total sections - $totalSections = (($radius + 1) * ($radius + 1) * $maxUp * ($maxDown + 1)); - - // Debug message: - /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: radius=' . $radius . ',maxUp=' . $maxUp . ',maxDown=' . $maxDown . ',totalSections=' . $totalSections); - - // Get data set instance - $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_SECTIONS)); - - // Add values for "zero point" - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_ID , 1); - $dataSetInstance->addCriteria(self::DB_COLUMN_CITY_ID , $cityId); - $dataSetInstance->addCriteria(self::DB_COLUMN_LOT_ID , 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_TYPE , self::SECTION_TYPE_AIR); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_SUB_TYPE , self::SECTION_SUB_TYPE_AIR); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_X , 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_Y , 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_POSITION_Z , 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_NORTH_ID, 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_SOUTH_ID, 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_WEST_ID , 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_EAST_ID , 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_UP_ID , 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_NEIGHBOUR_DOWN_ID , 0); - $dataSetInstance->addCriteria(self::DB_COLUMN_SECTION_RESERVED , self::IS_NOT_RESERVED); - - // Set primary key to 'city_id'/'section_id' - $dataSetInstance->setPrimaryKeyCombined(array(self::DB_COLUMN_CITY_ID, self::DB_COLUMN_SECTION_ID)); - - // Entry id for counting each entry - $dataSetInstance->setUniqueKey(self::DB_COLUMN_ENTRY_ID); - - // Add "zero point" - $this->queryInsertDataSet($dataSetInstance); - - // Set section id to 2 as 1 is already initialized + init array - $sections = array(); - - // Output message to ask for user's patience ... - self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: Writing ' . $totalSections . ' sections for city ' . $cityId . ' ... (this may takes some time)'); - - // Expand half of it to north/south (north=positive, south=negative) - for ($north = 1; $north < round($radius / 2); $north++) { - // Expand half of it to west/east (west=positive, east=negative) - for ($west = 1; $west < round($radius / 2); $west++) { - // Expand up/down (including "zero point") - for ($z = $maxDown; $z < ($maxUp + 1); $z++) { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: north=' . $north . ',west=' . $west . ',z=' . $z); - - // Fill array up with south/east/down ids - $sections[($north * -1)][($west * -1)][$z]['type'] = self::SECTION_TYPE_EMPTY_LAND; - $sections[($north * -1)][($west * -1)][$z]['sub'] = self::SECTION_SUB_TYPE_GRASS; - - // Fill up array with north/west/up ids (only air) - $sections[$north][$west][$z]['type'] = self::SECTION_TYPE_AIR; - $sections[$north][$west][$z]['sub'] = self::SECTION_SUB_TYPE_AIR; - } // END - for - } // END - for - } // END - for - - // Init section id with 2 as 1 is the "zero point" - $sectionId = 2; - - // Loop through whole array again for writing it to database: north/south - foreach ($sections as $x => $sectionX) { - // Loop through west/east values - foreach ($sectionX as $y => $sectionY) { - // Loop through up/down values - foreach ($sectionY as $z => $sectionData) { - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ',y=' . $y . ',z=' . $z . ',sectionId=' . $sectionId); - - // Set all coordinates for positive directions - $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_ID , $sectionId); - $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_X, $x); - $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_Y, $y); - $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_POSITION_Z, $z); - $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_TYPE , $sectionData['type']); - $dataSetInstance->setCriteria(self::DB_COLUMN_SECTION_SUB_TYPE , $sectionData['sub']); - - // Add value to database - $this->queryInsertDataSet($dataSetInstance); - - // Count id up - $sectionId++; - } // END - foreach - - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ',y=' . $y . ' has been written.'); - } // END - foreach - - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: x=' . $x . ' has been written.'); - } // END - foreach - - // Thank you for waiting! :-) - self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: A total of ' . $totalSections . ' sections has been written for city id ' . $cityId . '.'); - } -} diff --git a/application/city/classes/database/frontend/game_options/.htaccess b/application/city/classes/database/frontend/game_options/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/game_options/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/game_options/class_CityGameOptionsDatabaseFrontend.php b/application/city/classes/database/frontend/game_options/class_CityGameOptionsDatabaseFrontend.php new file mode 100644 index 0000000..956cac2 --- /dev/null +++ b/application/city/classes/database/frontend/game_options/class_CityGameOptionsDatabaseFrontend.php @@ -0,0 +1,65 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class CityGameOptionsDatabaseFrontend extends BaseDatabaseFrontend implements CityGameOptionsFrontend, Registerable { + // Constants for database table names + const DB_TABLE_GAME_OPTION_INFORMATION = 'game_options'; + + // Constants for database column names + const DB_COLUMN_GAME_OPTION_ID = 'game_id'; + const DB_COLUMN_GAME_OPTION_USER_ID = 'game_user_id'; + const DB_COLUMN_GAME_OPTION_FLAG_PAUSED = 'game_flag_paused'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this database frontend by a provided user class + * + * @return $frontendInstance An instance of the created frontend class + */ + public static final function createCityGameOptionsDatabaseFrontend () { + // Get a new instance + $frontendInstance = new CityGameOptionsDatabaseFrontend(); + + // Set (primary!) table name + $frontendInstance->setTableName(self::DB_TABLE_GAME_OPTION_INFORMATION); + + // Return the instance + return $frontendInstance; + } +} diff --git a/application/city/classes/database/frontend/game_options/class_CityGameOptionsDatabaseWrapper.php b/application/city/classes/database/frontend/game_options/class_CityGameOptionsDatabaseWrapper.php deleted file mode 100644 index 4250491..0000000 --- a/application/city/classes/database/frontend/game_options/class_CityGameOptionsDatabaseWrapper.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class CityGameOptionsDatabaseWrapper extends BaseDatabaseWrapper implements CityGameOptionsWrapper, Registerable { - // Constants for database table names - const DB_TABLE_GAME_OPTION_INFORMATION = 'game_options'; - - // Constants for database column names - const DB_COLUMN_GAME_OPTION_ID = 'game_id'; - const DB_COLUMN_GAME_OPTION_USER_ID = 'game_user_id'; - const DB_COLUMN_GAME_OPTION_FLAG_PAUSED = 'game_flag_paused'; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this database wrapper by a provided user class - * - * @return $wrapperInstance An instance of the created wrapper class - */ - public static final function createCityGameOptionsDatabaseWrapper () { - // Get a new instance - $wrapperInstance = new CityGameOptionsDatabaseWrapper(); - - // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_GAME_OPTION_INFORMATION); - - // Return the instance - return $wrapperInstance; - } -} diff --git a/application/city/classes/database/frontend/region/.htaccess b/application/city/classes/database/frontend/region/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/region/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/region/class_RegionInformationDatabaseWrapper.php b/application/city/classes/database/frontend/region/class_RegionInformationDatabaseWrapper.php index 3938f93..a670a21 100644 --- a/application/city/classes/database/frontend/region/class_RegionInformationDatabaseWrapper.php +++ b/application/city/classes/database/frontend/region/class_RegionInformationDatabaseWrapper.php @@ -6,13 +6,13 @@ namespace Org\Mxchange\City\Database\Frontend\RegionInformation; use Org\Mxchange\City\Factory\Manager\ManagerFactory; // Import framework stuff -use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseWrapper; +use Org\Mxchange\CoreFramework\Database\Frontend\BaseDatabaseFrontend; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Registry\Registerable; /** - * A database wrapper for region informations + * A database frontend for region informations * * @author Roland Haeder * @version 0.0.0 @@ -33,7 +33,7 @@ use Org\Mxchange\CoreFramework\Registry\Registerable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class RegionInformationDatabaseWrapper extends BaseDatabaseWrapper implements RegionInformationWrapper, Registerable { +class RegionInformationDatabaseFrontend extends BaseDatabaseFrontend implements RegionInformationFrontend, Registerable { // Constants for database table names const DB_TABLE_REGION_INFORMATION = 'region_data'; @@ -53,19 +53,19 @@ class RegionInformationDatabaseWrapper extends BaseDatabaseWrapper implements Re } /** - * Creates an instance of this database wrapper by a provided user class + * Creates an instance of this database frontend by a provided user class * - * @return $wrapperInstance An instance of the created wrapper class + * @return $frontendInstance An instance of the created frontend class */ - public static final function createRegionInformationDatabaseWrapper () { + public static final function createRegionInformationDatabaseFrontend () { // Get a new instance - $wrapperInstance = new RegionInformationDatabaseWrapper(); + $frontendInstance = new RegionInformationDatabaseFrontend(); // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_REGION_INFORMATION); + $frontendInstance->setTableName(self::DB_TABLE_REGION_INFORMATION); // Return the instance - return $wrapperInstance; + return $frontendInstance; } /** @@ -96,7 +96,7 @@ class RegionInformationDatabaseWrapper extends BaseDatabaseWrapper implements Re $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Search for user's cities - $searchInstance->addCriteria(RegionInformationDatabaseWrapper::DB_COLUMN_REGION_USER_ID, $userInstance->getUserId()); + $searchInstance->addCriteria(RegionInformationDatabaseFrontend::DB_COLUMN_REGION_USER_ID, $userInstance->getUserId()); // Get a result back $resultInstance = $this->doSelectByCriteria($searchInstance); @@ -128,7 +128,7 @@ class RegionInformationDatabaseWrapper extends BaseDatabaseWrapper implements Re $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Search for the region number one which is hard-coded the default - $searchInstance->addCriteria(RegionInformationDatabaseWrapper::DB_COLUMN_REGION_NAME, $regionName); + $searchInstance->addCriteria(RegionInformationDatabaseFrontend::DB_COLUMN_REGION_NAME, $regionName); $searchInstance->setLimit(1); // Get a result back diff --git a/application/city/classes/database/frontend/region_map/.htaccess b/application/city/classes/database/frontend/region_map/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/database/frontend/region_map/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/database/frontend/region_map/class_RegionMapDatabaseFrontend.php b/application/city/classes/database/frontend/region_map/class_RegionMapDatabaseFrontend.php new file mode 100644 index 0000000..6ddbdba --- /dev/null +++ b/application/city/classes/database/frontend/region_map/class_RegionMapDatabaseFrontend.php @@ -0,0 +1,109 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class RegionMapDatabaseFrontend extends BaseDatabaseFrontend implements RegionMapFrontend, Registerable { + // Constants for database table names + const DB_TABLE_REGION_MAP = 'region_map'; + + // Constants for database column names + const DB_COLUMN_REGION_ID = 'region_id'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this database frontend by a provided user class + * + * @return $frontendInstance An instance of the created frontend class + */ + public static final function createRegionMapDatabaseFrontend () { + // Get a new instance + $frontendInstance = new RegionMapDatabaseFrontend(); + + // Set (primary!) table name + $frontendInstance->setTableName(self::DB_TABLE_REGION_MAP); + + // Return the instance + return $frontendInstance; + } + + /** + * Removes non-public data from given array. + * + * @param $data An array with possible non-public data that needs to be removed. + * @return $data A cleaned up array with only public data. + */ + public function removeNonPublicDataFromArray(array $data) { + // Currently call only inner method + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REGION-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...'); + $data = parent::removeNonPublicDataFromArray($data); + + // Return cleaned data + return $data; + } + + /** + * Creates a region by given name + * + * @return void + */ + public function createRegionByName () { + // Pre-check + die(__METHOD__ . ': Unfinshed!'); + assert(!$this->ifRegionExists($regionName)); + + // Get user instance + $userInstance = GenericRegistry::getRegistry()->getInstance('user'); + + // Get a dataset instance + $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_REGION_MAP)); + + // Set the primary key + $dataSetInstance->setUniqueKey(self::DB_COLUMN_REGION_ID); + + // Add region name and assign user id + $dataSetInstance->addCriteria(self::DB_COLUMN_REGION_ID , ($this->countTotalRows() + 1)); + + // "Insert" this dataset instance completely into the database + $this->queryInsertDataSet($dataSetInstance); + + // Post-check name + assert($this->ifRegionExists($regionName)); + } +} diff --git a/application/city/classes/database/frontend/region_map/class_RegionMapDatabaseWrapper.php b/application/city/classes/database/frontend/region_map/class_RegionMapDatabaseWrapper.php deleted file mode 100644 index 9c2a2c2..0000000 --- a/application/city/classes/database/frontend/region_map/class_RegionMapDatabaseWrapper.php +++ /dev/null @@ -1,109 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class RegionMapDatabaseWrapper extends BaseDatabaseWrapper implements RegionMapWrapper, Registerable { - // Constants for database table names - const DB_TABLE_REGION_MAP = 'region_map'; - - // Constants for database column names - const DB_COLUMN_REGION_ID = 'region_id'; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this database wrapper by a provided user class - * - * @return $wrapperInstance An instance of the created wrapper class - */ - public static final function createRegionMapDatabaseWrapper () { - // Get a new instance - $wrapperInstance = new RegionMapDatabaseWrapper(); - - // Set (primary!) table name - $wrapperInstance->setTableName(self::DB_TABLE_REGION_MAP); - - // Return the instance - return $wrapperInstance; - } - - /** - * Removes non-public data from given array. - * - * @param $data An array with possible non-public data that needs to be removed. - * @return $data A cleaned up array with only public data. - */ - public function removeNonPublicDataFromArray(array $data) { - // Currently call only inner method - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REGION-WRAPPER[' . __METHOD__ . ':' . __LINE__ . ']: Calling parent::removeNonPublicDataFromArray(data) ...'); - $data = parent::removeNonPublicDataFromArray($data); - - // Return cleaned data - return $data; - } - - /** - * Creates a region by given name - * - * @return void - */ - public function createRegionByName () { - // Pre-check - die(__METHOD__ . ': Unfinshed!'); - assert(!$this->ifRegionExists($regionName)); - - // Get user instance - $userInstance = GenericRegistry::getRegistry()->getInstance('user'); - - // Get a dataset instance - $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_REGION_MAP)); - - // Set the primary key - $dataSetInstance->setUniqueKey(self::DB_COLUMN_REGION_ID); - - // Add region name and assign user id - $dataSetInstance->addCriteria(self::DB_COLUMN_REGION_ID , ($this->countTotalRows() + 1)); - - // "Insert" this dataset instance completely into the database - $this->queryInsertDataSet($dataSetInstance); - - // Post-check name - assert($this->ifRegionExists($regionName)); - } -} diff --git a/application/city/classes/factories/.htaccess b/application/city/classes/factories/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/factories/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/factories/city_daemon/.htaccess b/application/city/classes/factories/city_daemon/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/factories/city_daemon/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/factories/manager/.htaccess b/application/city/classes/factories/manager/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/factories/manager/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/factories/states/.htaccess b/application/city/classes/factories/states/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/factories/states/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/factories/states/city/.htaccess b/application/city/classes/factories/states/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/factories/states/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/.htaccess b/application/city/classes/filter/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/bootstrap/.htaccess b/application/city/classes/filter/bootstrap/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/bootstrap/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/bootstrap/city_daemon/.htaccess b/application/city/classes/filter/bootstrap/city_daemon/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/bootstrap/city_daemon/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/bootstrap/init/.htaccess b/application/city/classes/filter/bootstrap/init/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/bootstrap/init/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/city_daemon/.htaccess b/application/city/classes/filter/city_daemon/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/city_daemon/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/class_BaseCityFilter.php b/application/city/classes/filter/class_BaseCityFilter.php index 2c99486..9d35f48 100644 --- a/application/city/classes/filter/class_BaseCityFilter.php +++ b/application/city/classes/filter/class_BaseCityFilter.php @@ -41,7 +41,7 @@ abstract class BaseCityFilter extends BaseFilter { * @param $className Real name of class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); } diff --git a/application/city/classes/filter/shutdown/.htaccess b/application/city/classes/filter/shutdown/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/shutdown/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/shutdown/city/.htaccess b/application/city/classes/filter/shutdown/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/shutdown/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/task/.htaccess b/application/city/classes/filter/task/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/task/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/task/city_daemon/.htaccess b/application/city/classes/filter/task/city_daemon/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/task/city_daemon/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/verifier/.htaccess b/application/city/classes/filter/verifier/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/filter/verifier/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/filter/verifier/class_CityNameVerifierFilter.php b/application/city/classes/filter/verifier/class_CityNameVerifierFilter.php index 6e0263b..cb9e6ca 100644 --- a/application/city/classes/filter/verifier/class_CityNameVerifierFilter.php +++ b/application/city/classes/filter/verifier/class_CityNameVerifierFilter.php @@ -3,7 +3,7 @@ namespace Org\Mxchange\City\Filter\Verifier; // Import application-specific stuff -use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper; +use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend; use Org\Mxchange\City\Factory\Manager\ManagerFactory; // Import framework stuff @@ -71,7 +71,7 @@ class CityNameVerifierFilter extends BaseFilter implements Filterable { */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get city name from request - $cityName = $requestInstance->getRequestElement(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NAME); + $cityName = $requestInstance->getRequestElement(CityInformationDatabaseFrontend::DB_COLUMN_CITY_NAME); // Is the city name set? if (is_null($cityName)) { @@ -110,7 +110,7 @@ class CityNameVerifierFilter extends BaseFilter implements Filterable { * @param $cityName Cityname to check for existence * @return $alreadyTaken Whether the city name has been taken */ - private function ifCityNameIsTaken ($cityName) { + private function ifCityNameIsTaken (string $cityName) { // Get a new instance $managerInstance = ManagerFactory::createManagerByType('city'); diff --git a/application/city/classes/login/.htaccess b/application/city/classes/login/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/login/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/login/helper/.htaccess b/application/city/classes/login/helper/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/login/helper/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/.htaccess b/application/city/classes/manager/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/manager/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/city/.htaccess b/application/city/classes/manager/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/manager/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/city/class_CityManager.php b/application/city/classes/manager/city/class_CityManager.php index 6d79528..0a962d4 100644 --- a/application/city/classes/manager/city/class_CityManager.php +++ b/application/city/classes/manager/city/class_CityManager.php @@ -3,12 +3,12 @@ namespace Org\Mxchange\City\Manager\City; // Import application-specific stuff -use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper; +use Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend; use Org\Mxchange\City\Factory\Manager\ManagerFactory; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; use Org\Mxchange\CoreFramework\Request\Requestable; use Org\Mxchange\CoreFramework\Response\Responseable; @@ -54,11 +54,11 @@ class CityManager extends BaseManager implements ManageableCity { // Get new instance $managerInstance = new CityManager(); - // Get database wrapper - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class'); + // Get database frontend + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_info_db_frontend_class'); // And set it here - $managerInstance->setWrapperInstance($wrapperInstance); + $managerInstance->setFrontendInstance($frontendInstance); // Return the prepared instance return $managerInstance; @@ -71,7 +71,7 @@ class CityManager extends BaseManager implements ManageableCity { */ public function isCityAlreadyFounded () { // Check if the currently set user has already founded a city - $isFounded = $this->getWrapperInstance()->ifUserHasFoundedCity(); + $isFounded = $this->getFrontendInstance()->ifUserHasFoundedCity(); // Return result return $isFounded; @@ -83,9 +83,9 @@ class CityManager extends BaseManager implements ManageableCity { * @para $cityName Name of city * @return $isTaken Whether the given city name is already taken */ - public function ifCityNameExists ($cityName) { + public function ifCityNameExists (string $cityName) { // Check if the given city name is taken - $isTaken = $this->getWrapperInstance()->ifCityExists($cityName); + $isTaken = $this->getFrontendInstance()->ifCityExists($cityName); // Return result return $isTaken; @@ -99,10 +99,10 @@ class CityManager extends BaseManager implements ManageableCity { public function foundFirstCity () { // Check on request instance and 'city_name' element assert(FrameworkBootstrap::getRequestInstance() instanceof Requestable); - assert(FrameworkBootstrap::getRequestInstance()->isRequestElementSet(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NAME)); + assert(FrameworkBootstrap::getRequestInstance()->isRequestElementSet(CityInformationDatabaseFrontend::DB_COLUMN_CITY_NAME)); // Get city name - $cityName = FrameworkBootstrap::getRequestInstance()->getRequestElement(CityInformationDatabaseWrapper::DB_COLUMN_CITY_NAME); + $cityName = FrameworkBootstrap::getRequestInstance()->getRequestElement(CityInformationDatabaseFrontend::DB_COLUMN_CITY_NAME); // Some pre-checks assert(!$this->isCityAlreadyFounded()); @@ -122,10 +122,10 @@ class CityManager extends BaseManager implements ManageableCity { $regionData = $regionResultInstance->current(); // Add region id from it - FrameworkBootstrap::getRequestInstance()->setRequestElement(CityInformationDatabaseWrapper::DB_COLUMN_CITY_REGION_ID, $regionData[RegionInformationDatabaseWrapper::DB_COLUMN_REGION_ID]); + FrameworkBootstrap::getRequestInstance()->setRequestElement(CityInformationDatabaseFrontend::DB_COLUMN_CITY_REGION_ID, $regionData[RegionInformationDatabaseFrontend::DB_COLUMN_REGION_ID]); // Then create the first city - $this->getWrapperInstance()->createCityByRequest(FrameworkBootstrap::getRequestInstance()); + $this->getFrontendInstance()->createCityByRequest(FrameworkBootstrap::getRequestInstance()); } /** diff --git a/application/city/classes/manager/city_entities/.htaccess b/application/city/classes/manager/city_entities/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/manager/city_entities/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/city_entities/districts/.htaccess b/application/city/classes/manager/city_entities/districts/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/manager/city_entities/districts/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/city_entities/districts/class_CityDistrictsManager.php b/application/city/classes/manager/city_entities/districts/class_CityDistrictsManager.php index 038e22e..b4b26fa 100644 --- a/application/city/classes/manager/city_entities/districts/class_CityDistrictsManager.php +++ b/application/city/classes/manager/city_entities/districts/class_CityDistrictsManager.php @@ -2,9 +2,11 @@ // Own namespace namespace Org\Mxchange\City\Manager\Entities\Districts; +// Import application-specific stuff +use Org\Mxchange\City\Manager\BaseManager; + // Import framework stuff -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; -use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; use Org\Mxchange\CoreFramework\Registry\Registerable; /** @@ -29,7 +31,7 @@ use Org\Mxchange\CoreFramework\Registry\Registerable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class CityDistrictsManager extends BaseFrameworkSystem implements ManageableCityDistricts, Registerable { +class CityDistrictsManager extends BaseManager implements ManageableCityDistricts, Registerable { /** * Protected constructor * @@ -49,11 +51,11 @@ class CityDistrictsManager extends BaseFrameworkSystem implements ManageableCity // Get new instance $managerInstance = new CityDistrictsManager(); - // Get database wrapper - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_districts_db_wrapper_class'); + // Get database frontend + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_districts_db_frontend_class'); // And set it here - $managerInstance->setWrapperInstance($wrapperInstance); + $managerInstance->setFrontendInstance($frontendInstance); // Return the prepared instance return $managerInstance; diff --git a/application/city/classes/manager/city_entities/lots/.htaccess b/application/city/classes/manager/city_entities/lots/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/manager/city_entities/lots/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/city_entities/lots/class_CityLotsManager.php b/application/city/classes/manager/city_entities/lots/class_CityLotsManager.php index 9a03e67..8090ed0 100644 --- a/application/city/classes/manager/city_entities/lots/class_CityLotsManager.php +++ b/application/city/classes/manager/city_entities/lots/class_CityLotsManager.php @@ -2,9 +2,11 @@ // Own namespace namespace Org\Mxchange\City\Manager\Entities\Lots; +// Import application-specific stuff +use Org\Mxchange\City\Manager\BaseManager; + // Import framework stuff -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; -use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; use Org\Mxchange\CoreFramework\Registry\Registerable; /** @@ -29,7 +31,7 @@ use Org\Mxchange\CoreFramework\Registry\Registerable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class CityLotsManager extends BaseFrameworkSystem implements ManageableCityLots, Registerable { +class CityLotsManager extends BaseManager implements ManageableCityLots, Registerable { /** * Protected constructor * @@ -49,11 +51,11 @@ class CityLotsManager extends BaseFrameworkSystem implements ManageableCityLots, // Get new instance $managerInstance = new CityLotsManager(); - // Get database wrapper - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_lots_db_wrapper_class'); + // Get database frontend + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_lots_db_frontend_class'); // And set it here - $managerInstance->setWrapperInstance($wrapperInstance); + $managerInstance->setFrontendInstance($frontendInstance); // Return the prepared instance return $managerInstance; diff --git a/application/city/classes/manager/city_entities/sections/.htaccess b/application/city/classes/manager/city_entities/sections/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/manager/city_entities/sections/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/city_entities/sections/class_CitySectionsManager.php b/application/city/classes/manager/city_entities/sections/class_CitySectionsManager.php index 9f74e31..d9144a8 100644 --- a/application/city/classes/manager/city_entities/sections/class_CitySectionsManager.php +++ b/application/city/classes/manager/city_entities/sections/class_CitySectionsManager.php @@ -2,9 +2,11 @@ // Own namespace namespace Org\Mxchange\City\Manager\Entities\Sections; +// Load application-specific stuff +use Org\Mxchange\City\Manager\BaseManager; + // Import framework stuff -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; -use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; use Org\Mxchange\CoreFramework\Registry\Registerable; /** @@ -29,7 +31,7 @@ use Org\Mxchange\CoreFramework\Registry\Registerable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class CitySectionsManager extends BaseFrameworkSystem implements ManageableCitySections, Registerable { +class CitySectionsManager extends BaseManager implements ManageableCitySections, Registerable { /** * Protected constructor * @@ -49,11 +51,11 @@ class CitySectionsManager extends BaseFrameworkSystem implements ManageableCityS // Get new instance $managerInstance = new CitySectionsManager(); - // Get database wrapper - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_sections_db_wrapper_class'); + // Get database frontend + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_sections_db_frontend_class'); // And set it here - $managerInstance->setWrapperInstance($wrapperInstance); + $managerInstance->setFrontendInstance($frontendInstance); // Return the prepared instance return $managerInstance; @@ -70,7 +72,7 @@ class CitySectionsManager extends BaseFrameworkSystem implements ManageableCityS $requireExpansion = FALSE; // First, a simple check if the sections table contains any entries at all - if ($this->getWrapperInstance()->countTotalRows() == 0) { + if ($this->getFrontendInstance()->countTotalRows() == 0) { // This definedly requires expansion $requireExpansion = TRUE; } // END - if @@ -87,18 +89,18 @@ class CitySectionsManager extends BaseFrameworkSystem implements ManageableCityS * @todo z-coordinate not used */ public function expandMaps () { - // Get a city info wrapper instance - $cityWrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class'); + // Get a city info frontend instance + $cityFrontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('city_info_db_frontend_class'); // Get all city ids from it - $cityIds = $cityWrapperInstance->getAllCityIds(); + $cityIds = $cityFrontendInstance->getAllCityIds(); // Now check all ids foreach ($cityIds as $cityId) { // Does this id have any sections - if (!$this->getWrapperInstance()->ifCityHasSections($cityId)) { + if (!$this->getFrontendInstance()->ifCityHasSections($cityId)) { // Nothing found, so it is a brand-new city that needs first initialization - $sections = $this->getWrapperInstance()->doInitialCityExpansion($cityId); + $sections = $this->getFrontendInstance()->doInitialCityExpansion($cityId); } else { // @TODO Maybe some expansion is needed } diff --git a/application/city/classes/manager/class_BaseManager.php b/application/city/classes/manager/class_BaseManager.php index 4fc07fa..251f265 100644 --- a/application/city/classes/manager/class_BaseManager.php +++ b/application/city/classes/manager/class_BaseManager.php @@ -7,6 +7,7 @@ use Org\Mxchange\City\Generic\BaseCitySystem; // Import framework stuff use Org\Mxchange\CoreFramework\Registry\Registerable; +use Org\Mxchange\CoreFramework\Traits\Database\Frontend\DatabaseFrontendTrait; /** * A general Manager class @@ -31,13 +32,16 @@ use Org\Mxchange\CoreFramework\Registry\Registerable; * along with this program. If not, see . */ abstract class BaseManager extends BaseCitySystem implements Manageable, Registerable { + // Load traits + use DatabaseFrontendTrait; + /** * Protected constructor * * @param $className Name of the class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); } diff --git a/application/city/classes/manager/game/.htaccess b/application/city/classes/manager/game/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/manager/game/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/game/class_GameOptionsManager.php b/application/city/classes/manager/game/class_GameOptionsManager.php index 6eea04d..aa2ae4c 100644 --- a/application/city/classes/manager/game/class_GameOptionsManager.php +++ b/application/city/classes/manager/game/class_GameOptionsManager.php @@ -3,7 +3,7 @@ namespace Org\Mxchange\City\Manager\Region; // Import framework stuff -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; /** * A game manager @@ -47,11 +47,11 @@ class GameOptionsManager extends BaseManager implements ManageableGame { // Get new instance $managerInstance = new GameOptionsManager(); - // Get database wrapper - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('game_options_db_wrapper_class'); + // Get database frontend + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('game_options_db_frontend_class'); // And set it here - $managerInstance->setWrapperInstance($wrapperInstance); + $managerInstance->setFrontendInstance($frontendInstance); // Return the prepared instance return $managerInstance; diff --git a/application/city/classes/manager/region/.htaccess b/application/city/classes/manager/region/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/manager/region/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/manager/region/class_RegionManager.php b/application/city/classes/manager/region/class_RegionManager.php index 1872cf5..b5cfaf1 100644 --- a/application/city/classes/manager/region/class_RegionManager.php +++ b/application/city/classes/manager/region/class_RegionManager.php @@ -3,7 +3,7 @@ namespace Org\Mxchange\City\Manager\Region; // Import framework stuff -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; /** * A Region manager @@ -47,11 +47,11 @@ class RegionManager extends BaseManager implements ManageableRegion { // Get new instance $managerInstance = new RegionManager(); - // Get database wrapper - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('region_info_db_wrapper_class'); + // Get database frontend + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('region_info_db_frontend_class'); // And set it here - $managerInstance->setWrapperInstance($wrapperInstance); + $managerInstance->setFrontendInstance($frontendInstance); // Return the prepared instance return $managerInstance; @@ -64,7 +64,7 @@ class RegionManager extends BaseManager implements ManageableRegion { */ public function ifUserHasCreatedRegion () { // Check if the currently set user has already founded a region - $isFounded = $this->getWrapperInstance()->ifUserHasCreatedRegion(); + $isFounded = $this->getFrontendInstance()->ifUserHasCreatedRegion(); // Return result return $isFounded; @@ -78,7 +78,7 @@ class RegionManager extends BaseManager implements ManageableRegion { */ public function ifRegionNameExists ($regionName) { // Check if the given region name is taken - $isTaken = $this->getWrapperInstance()->ifRegionExists($regionName); + $isTaken = $this->getFrontendInstance()->ifRegionExists($regionName); // Return result return $isTaken; @@ -99,7 +99,7 @@ class RegionManager extends BaseManager implements ManageableRegion { assert(!$this->ifRegionNameExists($regionName)); // First region can now be created - $this->getWrapperInstance()->createRegionByName($regionName); + $this->getFrontendInstance()->createRegionByName($regionName); // Then try to find it assert($this->ifRegionNameExists($regionName)); diff --git a/application/city/classes/manager/region/class_RegionMapManager.php b/application/city/classes/manager/region/class_RegionMapManager.php index 9b894cb..1e3b774 100644 --- a/application/city/classes/manager/region/class_RegionMapManager.php +++ b/application/city/classes/manager/region/class_RegionMapManager.php @@ -3,7 +3,7 @@ namespace Org\Mxchange\City\Manager\RegionMap; // Import framework stuff -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; /** * A region map manager @@ -47,11 +47,11 @@ class RegionMapManager extends BaseManager implements ManageableRegionMap { // Get new instance $managerInstance = new RegionMapManager(); - // Get database wrapper - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('region_map_db_wrapper_class'); + // Get database frontend + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('region_map_db_frontend_class'); // And set it here - $managerInstance->setWrapperInstance($wrapperInstance); + $managerInstance->setFrontendInstance($frontendInstance); // Return the prepared instance return $managerInstance; diff --git a/application/city/classes/menu/.htaccess b/application/city/classes/menu/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/menu/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/menu/government/.htaccess b/application/city/classes/menu/government/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/menu/government/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/registration/.htaccess b/application/city/classes/registration/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/registration/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/registration/class_CityRegistration.php b/application/city/classes/registration/class_CityRegistration.php index 5c1e74b..5e2680d 100644 --- a/application/city/classes/registration/class_CityRegistration.php +++ b/application/city/classes/registration/class_CityRegistration.php @@ -5,8 +5,8 @@ namespace Org\Mxchange\City\Registration; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria; -use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseWrapper; -use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory; +use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend; +use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory; use Org\Mxchange\CoreFramework\Factory\ObjectFactory; use Org\Mxchange\CoreFramework\Registration\BaseRegistration; use Org\Mxchange\CoreFramework\Registration\User\UserRegister; @@ -132,11 +132,11 @@ class CityRegistration extends BaseRegistration implements UserRegister { * @todo Maybe add more things to perform */ public function registerNewUser () { - // Get a user database wrapper - $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('user_db_wrapper_class'); + // Get a user database frontend + $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('user_db_frontend_class'); // Use this instance to insert the whole registration instance - $wrapperInstance->insertRegistrationObject($this); + $frontendInstance->insertRegistrationObject($this); } /** @@ -207,10 +207,10 @@ class CityRegistration extends BaseRegistration implements UserRegister { } // END - foreach // Mark the username as unique key - $criteriaInstance->setUniqueKey(UserDatabaseWrapper::DB_COLUMN_USERNAME); + $criteriaInstance->setUniqueKey(UserDatabaseFrontend::DB_COLUMN_USERNAME); // Add account status as configured - $criteriaInstance->addConfiguredCriteria(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $configEntry); + $criteriaInstance->addConfiguredCriteria(UserDatabaseFrontend::DB_COLUMN_USER_STATUS, $configEntry); // Include registration timestamp $criteriaInstance->addCriteria('registered', date('Y-m-d H:i:s', time())); diff --git a/application/city/classes/resolver/.htaccess b/application/city/classes/resolver/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/resolver/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/resolver/command/.htaccess b/application/city/classes/resolver/command/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/resolver/command/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/resolver/command/console/.htaccess b/application/city/classes/resolver/command/console/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/resolver/command/console/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/resolver/command/html/.htaccess b/application/city/classes/resolver/command/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/resolver/command/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/resolver/controller/.htaccess b/application/city/classes/resolver/controller/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/resolver/controller/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/resolver/controller/console/.htaccess b/application/city/classes/resolver/controller/console/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/resolver/controller/console/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/resolver/controller/html/.htaccess b/application/city/classes/resolver/controller/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/resolver/controller/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/resolver/controller/image/.htaccess b/application/city/classes/resolver/controller/image/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/resolver/controller/image/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/states/.htaccess b/application/city/classes/states/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/states/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/states/city/.htaccess b/application/city/classes/states/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/states/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/states/city/active/.htaccess b/application/city/classes/states/city/active/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/states/city/active/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/states/city/class_BaseCityState.php b/application/city/classes/states/city/class_BaseCityState.php index 11e8dd6..0394e00 100644 --- a/application/city/classes/states/city/class_BaseCityState.php +++ b/application/city/classes/states/city/class_BaseCityState.php @@ -37,7 +37,7 @@ abstract class BaseCityState extends BaseState { * @param $className Name of the class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); } diff --git a/application/city/classes/states/city/init/.htaccess b/application/city/classes/states/city/init/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/states/city/init/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/tasks/.htaccess b/application/city/classes/tasks/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/tasks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/tasks/class_BaseCityTask.php b/application/city/classes/tasks/class_BaseCityTask.php index a489bbd..55eb89e 100644 --- a/application/city/classes/tasks/class_BaseCityTask.php +++ b/application/city/classes/tasks/class_BaseCityTask.php @@ -42,7 +42,7 @@ abstract class BaseCityTask extends BaseTask { * @param $className Name of the class * @return void */ - protected function __construct ($className) { + protected function __construct (string $className) { // Call parent constructor parent::__construct($className); } diff --git a/application/city/classes/tasks/daemon/.htaccess b/application/city/classes/tasks/daemon/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/tasks/daemon/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/tasks/daemon/building/.htaccess b/application/city/classes/tasks/daemon/building/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/tasks/daemon/building/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/tasks/daemon/household/.htaccess b/application/city/classes/tasks/daemon/household/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/tasks/daemon/household/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/tasks/daemon/map_expander/.htaccess b/application/city/classes/tasks/daemon/map_expander/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/tasks/daemon/map_expander/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/visitor/.htaccess b/application/city/classes/visitor/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/visitor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/classes/visitor/tasks/.htaccess b/application/city/classes/visitor/tasks/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/classes/visitor/tasks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/config.php b/application/city/config.php index 6a602fd..9aa9346 100644 --- a/application/city/config.php +++ b/application/city/config.php @@ -44,25 +44,25 @@ $cfg->setConfigEntry('news_process_filter_class', 'Org\Mxchange\CoreFramework\Fi $cfg->setConfigEntry('news_reader_class', 'Org\Mxchange\CoreFramework\Reader\News\Console\ConsoleNewsReader'); // CFG: CITY-INFO-DB-WRAPPER-CLASS -$cfg->setConfigEntry('city_info_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseWrapper'); +$cfg->setConfigEntry('city_info_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Information\CityInformationDatabaseFrontend'); // CFG: REGION-INFO-DB-WRAPPER-CLASS -$cfg->setConfigEntry('region_info_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\RegionInformation\RegionInformationDatabaseWrapper'); +$cfg->setConfigEntry('region_info_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\RegionInformation\RegionInformationDatabaseFrontend'); // CFG: GAME-OPTIONS-DB-WRAPPER-CLASS -$cfg->setConfigEntry('game_options_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\GameOptions\CityGameOptionsDatabaseWrapper'); +$cfg->setConfigEntry('game_options_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\GameOptions\CityGameOptionsDatabaseFrontend'); // CFG: REGION-MAP-DB-WRAPPER-CLASS -$cfg->setConfigEntry('region_map_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Region\RegionMapDatabaseWrapper'); +$cfg->setConfigEntry('region_map_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Region\RegionMapDatabaseFrontend'); // CFG: CITY-SECTIONS-DB-WRAPPER-CLASS -$cfg->setConfigEntry('city_sections_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Sections\CitySectionsDatabaseWrapper'); +$cfg->setConfigEntry('city_sections_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Sections\CitySectionsDatabaseFrontend'); // CFG: CITY-LOTS-DB-WRAPPER-CLASS -$cfg->setConfigEntry('city_lots_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Lots\CityLotsDatabaseWrapper'); +$cfg->setConfigEntry('city_lots_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Lots\CityLotsDatabaseFrontend'); // CFG: CITY-DISTRICTS-DB-WRAPPER-CLASS -$cfg->setConfigEntry('city_districts_db_wrapper_class', 'Org\Mxchange\City\Database\Frontend\Districts\CityDistrictsDatabaseWrapper'); +$cfg->setConfigEntry('city_districts_db_frontend_class', 'Org\Mxchange\City\Database\Frontend\Districts\CityDistrictsDatabaseFrontend'); // CFG: CITY-INIT-STATE-CLASS $cfg->setConfigEntry('city_init_state_class', 'Org\Mxchange\City\State\Init\CityInitState'); @@ -468,13 +468,13 @@ $cfg->setConfigEntry('government_class', 'SimplifiedGovernment'); $cfg->setConfigEntry('bank_class', 'MoneyBank'); // CFG: USER-POINTS-DB-WRAPPER-CLASS -$cfg->setConfigEntry('user_points_db_wrapper_class', 'Org\Mxchange\CoreFramework\Database\Frontend\Points\UserPointsDatabaseWrapper'); +$cfg->setConfigEntry('user_points_db_frontend_class', 'Org\Mxchange\CoreFramework\Database\Frontend\Points\UserPointsDatabaseFrontend'); // CFG: USER-GOVERNMENT-WRAPPER-CLASS -$cfg->setConfigEntry('user_government_wrapper_class', 'UserGovernmentDatabaseWrapper'); +$cfg->setConfigEntry('user_government_frontend_class', 'UserGovernmentDatabaseFrontend'); // CFG: PAYMENT-DB-WRAPPER-CLASS -$cfg->setConfigEntry('payment_db_wrapper_class', 'Org\Mxchange\CoreFramework\Database\Frontend\PaymentsDatabaseWrapper'); +$cfg->setConfigEntry('payment_db_frontend_class', 'Org\Mxchange\CoreFramework\Database\Frontend\PaymentsDatabaseFrontend'); // CFG: LOGIN-ENABLED $cfg->setConfigEntry('login_enabled', 'Y'); diff --git a/application/city/exceptions/.htaccess b/application/city/exceptions/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/exceptions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/.htaccess b/application/city/interfaces/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/.htaccess b/application/city/interfaces/database/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/.htaccess b/application/city/interfaces/database/frontend/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/frontend/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/city/.htaccess b/application/city/interfaces/database/frontend/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/frontend/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/city/class_CityInformationFrontend.php b/application/city/interfaces/database/frontend/city/class_CityInformationFrontend.php new file mode 100644 index 0000000..153245e --- /dev/null +++ b/application/city/interfaces/database/frontend/city/class_CityInformationFrontend.php @@ -0,0 +1,91 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface CityInformationFrontend extends DatabaseFrontend { + /** + * 'Registers' a new city id along with data provided in the city instance. + * This may sound confusing but avoids double code very nicely... + * + * @param $cityInstance A city instance + * @param $requestInstance An instance of a Requestable class + * @return void + */ + function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance); + + /** + * Checks whether there is an entry for given city instance + * + * @param $cityInstance An instance of a CityHelper class + * @return $isFound Whether a city id has been found for this city + */ + function ifCityDataIsFound (CityHelper $cityInstance); + + /** + * Removes non-data from given array. + * + * @param $data An array with possible non-data that needs to be removed. + * @return $data A cleaned up array with only data. + */ + function removeNonPublicDataFromArray(array $data); + + /** + * Checks whether the user has already founded a city + * + * @return $hasFounded Whether the user has already founded a city + */ + function ifUserHasFoundedCity (); + + /** + * Checks whether the given city name is taken + * + * @para $cityName Name of city + * @return $isTaken Whether the given city name is taken + */ + function ifCityExists (string $cityName); + + /** + * Creates a city from given request + * + * @para $requestInstance An instance of a Requestable class + * @return void + */ + function createCityByRequest (Requestable $requestInstance); + + /** + * Getter for all city ids as an array + * + * @return $cityIds All city ids as an array + */ + function getAllCityIds (); +} diff --git a/application/city/interfaces/database/frontend/city/class_CityInformationWrapper.php b/application/city/interfaces/database/frontend/city/class_CityInformationWrapper.php deleted file mode 100644 index 2de42b2..0000000 --- a/application/city/interfaces/database/frontend/city/class_CityInformationWrapper.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface CityInformationWrapper extends DatabaseWrapper { - /** - * 'Registers' a new city id along with data provided in the city instance. - * This may sound confusing but avoids double code very nicely... - * - * @param $cityInstance A city instance - * @param $requestInstance An instance of a Requestable class - * @return void - */ - function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance); - - /** - * Checks whether there is an entry for given city instance - * - * @param $cityInstance An instance of a CityHelper class - * @return $isFound Whether a city id has been found for this city - */ - function ifCityDataIsFound (CityHelper $cityInstance); - - /** - * Removes non-data from given array. - * - * @param $data An array with possible non-data that needs to be removed. - * @return $data A cleaned up array with only data. - */ - function removeNonPublicDataFromArray(array $data); - - /** - * Checks whether the user has already founded a city - * - * @return $hasFounded Whether the user has already founded a city - */ - function ifUserHasFoundedCity (); - - /** - * Checks whether the given city name is taken - * - * @para $cityName Name of city - * @return $isTaken Whether the given city name is taken - */ - function ifCityExists ($cityName); - - /** - * Creates a city from given request - * - * @para $requestInstance An instance of a Requestable class - * @return void - */ - function createCityByRequest (Requestable $requestInstance); - - /** - * Getter for all city ids as an array - * - * @return $cityIds All city ids as an array - */ - function getAllCityIds (); -} diff --git a/application/city/interfaces/database/frontend/city_entities/.htaccess b/application/city/interfaces/database/frontend/city_entities/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/frontend/city_entities/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/city_entities/districts/.htaccess b/application/city/interfaces/database/frontend/city_entities/districts/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/frontend/city_entities/districts/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/city_entities/districts/class_CityDistrictsFrontend.php b/application/city/interfaces/database/frontend/city_entities/districts/class_CityDistrictsFrontend.php new file mode 100644 index 0000000..383e138 --- /dev/null +++ b/application/city/interfaces/database/frontend/city_entities/districts/class_CityDistrictsFrontend.php @@ -0,0 +1,38 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface CityDistrictsFrontend extends DatabaseFrontend { + /** + * Checks if the given city id is found in districts table + * + * @param $cityId City id to check + * @return $isFound Whether the city id is found + */ + function ifCityHasDistricts (int $cityId); +} diff --git a/application/city/interfaces/database/frontend/city_entities/districts/class_CityDistrictsWrapper.php b/application/city/interfaces/database/frontend/city_entities/districts/class_CityDistrictsWrapper.php deleted file mode 100644 index 510bab2..0000000 --- a/application/city/interfaces/database/frontend/city_entities/districts/class_CityDistrictsWrapper.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface CityDistrictsWrapper extends DatabaseWrapper { - /** - * Checks if the given city id is found in districts table - * - * @param $cityId City id to check - * @return $isFound Whether the city id is found - */ - function ifCityHasDistricts ($cityId); -} diff --git a/application/city/interfaces/database/frontend/city_entities/lots/.htaccess b/application/city/interfaces/database/frontend/city_entities/lots/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/frontend/city_entities/lots/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsFrontend.php b/application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsFrontend.php new file mode 100644 index 0000000..41e2d28 --- /dev/null +++ b/application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsFrontend.php @@ -0,0 +1,38 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface CityLotsFrontend extends DatabaseFrontend { + /** + * Checks if the given city id is found in lots table + * + * @param $cityId City id to check + * @return $isFound Whether the city id is found + */ + function ifCityHasLots (int $cityId); +} diff --git a/application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsWrapper.php b/application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsWrapper.php deleted file mode 100644 index 93760a6..0000000 --- a/application/city/interfaces/database/frontend/city_entities/lots/class_CityLotsWrapper.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface CityLotsWrapper extends DatabaseWrapper { - /** - * Checks if the given city id is found in lots table - * - * @param $cityId City id to check - * @return $isFound Whether the city id is found - */ - function ifCityHasLots ($cityId); -} diff --git a/application/city/interfaces/database/frontend/city_entities/sections/.htaccess b/application/city/interfaces/database/frontend/city_entities/sections/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/frontend/city_entities/sections/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsFrontend.php b/application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsFrontend.php new file mode 100644 index 0000000..f1bfd37 --- /dev/null +++ b/application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsFrontend.php @@ -0,0 +1,47 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface CitySectionsFrontend extends DatabaseFrontend { + /** + * Checks if the given city id is found in sections table + * + * @param $cityId City id to check + * @return $isFound Whether the city id is found + */ + function ifCityHasSections (int $cityId); + + /** + * Expands the sections table with initial data for given city id + * + * @param $cityId City id to check + * @return $ids Sections ids from initial expansion + * @todo z-coordinate not used + */ + function doInitialCityExpansion (int $cityId); +} diff --git a/application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsWrapper.php b/application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsWrapper.php deleted file mode 100644 index 3d2c24d..0000000 --- a/application/city/interfaces/database/frontend/city_entities/sections/class_CitySectionsWrapper.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface CitySectionsWrapper extends DatabaseWrapper { - /** - * Checks if the given city id is found in sections table - * - * @param $cityId City id to check - * @return $isFound Whether the city id is found - */ - function ifCityHasSections ($cityId); - - /** - * Expands the sections table with initial data for given city id - * - * @param $cityId City id to check - * @return $ids Sections ids from initial expansion - * @todo z-coordinate not used - */ - function doInitialCityExpansion ($cityId); -} diff --git a/application/city/interfaces/database/frontend/game_options/.htaccess b/application/city/interfaces/database/frontend/game_options/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/frontend/game_options/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/game_options/class_CityGameOptionsFrontend.php b/application/city/interfaces/database/frontend/game_options/class_CityGameOptionsFrontend.php new file mode 100644 index 0000000..8882a07 --- /dev/null +++ b/application/city/interfaces/database/frontend/game_options/class_CityGameOptionsFrontend.php @@ -0,0 +1,31 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface CityGameOptionsFrontend extends DatabaseFrontend { +} diff --git a/application/city/interfaces/database/frontend/game_options/class_CityGameOptionsWrapper.php b/application/city/interfaces/database/frontend/game_options/class_CityGameOptionsWrapper.php deleted file mode 100644 index 8734fac..0000000 --- a/application/city/interfaces/database/frontend/game_options/class_CityGameOptionsWrapper.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface CityGameOptionsWrapper extends DatabaseWrapper { -} diff --git a/application/city/interfaces/database/frontend/region/.htaccess b/application/city/interfaces/database/frontend/region/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/database/frontend/region/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/database/frontend/region/class_RegionInformationFrontend.php b/application/city/interfaces/database/frontend/region/class_RegionInformationFrontend.php new file mode 100644 index 0000000..7a9d9ba --- /dev/null +++ b/application/city/interfaces/database/frontend/region/class_RegionInformationFrontend.php @@ -0,0 +1,61 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface RegionInformationFrontend extends DatabaseFrontend { + /** + * Removes non-data from given array. + * + * @param $data An array with possible non-data that needs to be removed. + * @return $data A cleaned up array with only data. + */ + function removeNonPublicDataFromArray(array $data); + + /** + * Checks whether the user has already founded a region + * + * @return $hasFounded Whether the user has already founded a region + */ + function ifUserHasCreatedRegion (); + + /** + * Checks whether the given region name is taken + * + * @param $regionName Name of region + * @return $isTaken Whether the given region name is taken + */ + function ifRegionExists ($regionName); + + /** + * Creates a region by given name + * + * @param $regionName Name of region + * @return void + */ + function createRegionByName ($regionName); +} diff --git a/application/city/interfaces/database/frontend/region/class_RegionInformationWrapper.php b/application/city/interfaces/database/frontend/region/class_RegionInformationWrapper.php deleted file mode 100644 index 5ee8646..0000000 --- a/application/city/interfaces/database/frontend/region/class_RegionInformationWrapper.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface RegionInformationWrapper extends DatabaseWrapper { - /** - * Removes non-data from given array. - * - * @param $data An array with possible non-data that needs to be removed. - * @return $data A cleaned up array with only data. - */ - function removeNonPublicDataFromArray(array $data); - - /** - * Checks whether the user has already founded a region - * - * @return $hasFounded Whether the user has already founded a region - */ - function ifUserHasCreatedRegion (); - - /** - * Checks whether the given region name is taken - * - * @param $regionName Name of region - * @return $isTaken Whether the given region name is taken - */ - function ifRegionExists ($regionName); - - /** - * Creates a region by given name - * - * @param $regionName Name of region - * @return void - */ - function createRegionByName ($regionName); -} diff --git a/application/city/interfaces/database/frontend/region/class_RegionMapFrontend.php b/application/city/interfaces/database/frontend/region/class_RegionMapFrontend.php new file mode 100644 index 0000000..7624732 --- /dev/null +++ b/application/city/interfaces/database/frontend/region/class_RegionMapFrontend.php @@ -0,0 +1,31 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015, 2016 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface RegionMapFrontend extends DatabaseFrontend { +} diff --git a/application/city/interfaces/database/frontend/region/class_RegionMapWrapper.php b/application/city/interfaces/database/frontend/region/class_RegionMapWrapper.php deleted file mode 100644 index dafacba..0000000 --- a/application/city/interfaces/database/frontend/region/class_RegionMapWrapper.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015, 2016 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface RegionMapWrapper extends DatabaseWrapper { -} diff --git a/application/city/interfaces/helper/.htaccess b/application/city/interfaces/helper/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/helper/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/helper/city/.htaccess b/application/city/interfaces/helper/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/helper/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/manager/.htaccess b/application/city/interfaces/manager/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/manager/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/manager/city/.htaccess b/application/city/interfaces/manager/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/manager/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/manager/city/class_ManageableCity.php b/application/city/interfaces/manager/city/class_ManageableCity.php index dd17ca3..6fe4dfc 100644 --- a/application/city/interfaces/manager/city/class_ManageableCity.php +++ b/application/city/interfaces/manager/city/class_ManageableCity.php @@ -42,7 +42,7 @@ interface ManageableCity extends Manageable { * @para $cityName Name of city * @return $isTaken Whether the given city name is already taken */ - function ifCityNameExists ($cityName); + function ifCityNameExists (string $cityName); /** * Founds the first city. A dummy region will also be created diff --git a/application/city/interfaces/manager/city_entities/.htaccess b/application/city/interfaces/manager/city_entities/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/manager/city_entities/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/manager/city_entities/districts/.htaccess b/application/city/interfaces/manager/city_entities/districts/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/manager/city_entities/districts/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/manager/city_entities/lots/.htaccess b/application/city/interfaces/manager/city_entities/lots/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/manager/city_entities/lots/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/manager/city_entities/sections/.htaccess b/application/city/interfaces/manager/city_entities/sections/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/manager/city_entities/sections/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/interfaces/manager/region/.htaccess b/application/city/interfaces/manager/region/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/interfaces/manager/region/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/language/.htaccess b/application/city/language/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/language/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/templates/.htaccess b/application/city/templates/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/templates/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/templates/code/.htaccess b/application/city/templates/code/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/templates/code/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/templates/emails/.htaccess b/application/city/templates/emails/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/templates/emails/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/templates/html/.htaccess b/application/city/templates/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/templates/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/templates/image/.htaccess b/application/city/templates/image/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/templates/image/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/templates/menu/.htaccess b/application/city/templates/menu/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/templates/menu/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/core b/core index 28ff071..303d853 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 28ff0710d8eb3a2d0c1547d6ebeaae05eb50c7f6 +Subproject commit 303d853c3d98734f9d7a1a0445c98b6d6c444945