From 1808f0a9bb027cf53d5f3761003de03623d298db Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 11 Jun 2008 22:43:06 +0000 Subject: [PATCH] Moved classes removed... ;) --- .gitattributes | 6 - ...29292aeca3f6bf78c16e25fc4f75c98.serialized | 34 -- .../main/controller/registration/.htaccess | 1 - .../class_DefaultRegistrationController.php | 71 --- inc/classes/main/database/classes/.htaccess | 1 - .../classes/class_LocalFileDatabase.php | 465 ------------------ .../main/factories/web/class_NewsFactory.php | 117 ----- 7 files changed, 695 deletions(-) delete mode 100644 db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized delete mode 100644 inc/classes/main/controller/registration/.htaccess delete mode 100644 inc/classes/main/controller/registration/class_DefaultRegistrationController.php delete mode 100644 inc/classes/main/database/classes/.htaccess delete mode 100644 inc/classes/main/database/classes/class_LocalFileDatabase.php delete mode 100644 inc/classes/main/factories/web/class_NewsFactory.php diff --git a/.gitattributes b/.gitattributes index 0ba452fbb..13522f9a1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -43,7 +43,6 @@ application/hub/middleware/.htaccess -text application/hub/starter.php -text /chat-server.php -text db/.htaccess -text -db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized -text devel/.htaccess -text devel/class_Debug.php -text docs/COPYING -text @@ -228,8 +227,6 @@ inc/classes/main/controller/default/class_WebDefaultController.php -text inc/classes/main/controller/default/class_WebDefaultNewsController.php -text inc/classes/main/controller/form/.htaccess -text inc/classes/main/controller/form/class_WebDoFormController.php -text -inc/classes/main/controller/registration/.htaccess -text -inc/classes/main/controller/registration/class_DefaultRegistrationController.php -text inc/classes/main/criteria/.htaccess -text inc/classes/main/criteria/class_DataSetCriteria.php -text inc/classes/main/criteria/class_SearchCriteria.php -text @@ -239,8 +236,6 @@ inc/classes/main/database/.htaccess -text inc/classes/main/database/class_ -text inc/classes/main/database/class_BaseDatabaseFrontend.php -text inc/classes/main/database/class_BaseDatabaseWrapper.php -text -inc/classes/main/database/classes/.htaccess -text -inc/classes/main/database/classes/class_LocalFileDatabase.php -text inc/classes/main/database/databases/.htaccess -text inc/classes/main/database/databases/class_LocalFileDatabase.php -text inc/classes/main/database/wrapper/.htaccess -text @@ -259,7 +254,6 @@ inc/classes/main/factories/class_BaseFactory.php -text inc/classes/main/factories/objects/.htaccess -text inc/classes/main/factories/objects/class_ObjectFactory.php -text inc/classes/main/factories/web/.htaccess -text -inc/classes/main/factories/web/class_NewsFactory.php -text inc/classes/main/factories/web/class_WebNewsFactory.php -text inc/classes/main/filter/.htaccess -text inc/classes/main/filter/checkboxes/.htaccess -text diff --git a/db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized b/db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized deleted file mode 100644 index d85d24448..000000000 --- a/db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized +++ /dev/null @@ -1,34 +0,0 @@ -@head^bz2:1178796141:1228:3bebdff2daf556f5af817a497d493f34 -@data^QlpoMTFBWSZTWZgImj4ACrVfgEAAEAV/+H0myAA///+6YAZ/E2:5581c6b3b029958dae7cbf33fca76967 -@data^ugGFsdJ1Z3sACEpGkGSbFPSaTYggBoAAGRMhoAqo9T1MmIwg0Z:5607b07fa186c7511760cde9d53f3275 -@data^MEYEommptFT9SGhiDIAYmCA0GnqqMhoAMhoDEaaaGjBAwGgNAA:6928989225a72071a456b166db9f6f90 -@data^BpoNANAGgKUoiY1MKaENpqZMQGgDI0wUPp7yfEmEWCYJgmE8BK:bbe0172461a813858519f7afb62d8234 -@data^fEn8/3u/ET/SfEq1JoTP8J3EwTCd4nwPcYzMzMszzE7xMuemLb:b35a8e5c41c5f5d08a5361fc97baa55b -@data^ttTpZZtObRjF6wQ2ZAhtQEEoAhGF3JvDhf48qEp0dg4veAhIBC:1df972fa2c3fec9564a68ac8661a6e0a -@data^sZqYCA1Vi4EMF5ztzLN4umJCMJgXtzLF1UohqhBGt2domt5Ln0:88bef013bf1f36f05b73fb313176e409 -@data^qSnThz1SaiYVciY55Mcubprt16cs4cNRaXZ5uaUzKQ3Fb6vneK:e634054c76ae06816ae3b233c7d28ae1 -@data^Rrdc5M6VkASW7sAjjC4oqmLFe/NjOVZD3hAQikgEIYdgQ572YE:0d84f5e53c203deac2bd44140e48ab63 -@data^JytasASUfOVIJKBkQWFg1qZpbLbTiWrEtZ1SfXzTWLceHveZBJ:1007b2f29136efbee8eaf8771e640208 -@data^5wAhEQjXO9zrGhrk1uzbvXOm0ARyglumIvxrIKPmiUF0QuYSta:01f9da46a20238dd8589aa8ea4bc5b7e -@data^YxGLd3Wz7fHb8WUY6r1XetNN7hMdpLSdhBJrXlxaXWfe5kzVam:e2091b0f8140e70861ddfc7155282762 -@data^pztsZRcYktlGopu7OczRWVLSvDSsh3dA+r55tuxjkc0z8VttOk:2c8174bdf3b35b03ade696125e83a1a2 -@data^YaMUk0clfFpCiTn3Fx3eeSBBHYRVUKqmmmbmXjPa2Zpyq17apV:76c9ed1af8d1f8b82b87b7604395ceaf -@data^2NEALRmQPYitiCS5BGkQ5Ns0TkWDQycAIcAkoTYTiJ2JqTQmhN:2d86f3f20df17c5750842af805e1b3f1 -@data^5ME3BZhbtdxOwm4ndx8hP2dqHgTQa49JMP0JqTSphMYVa6b5u1:20fd20fcc7fcc8fcd700d4d653db1129 -@data^10y3FXXSaCZhKZZiyTCddtidO4V2Rs78K8h2q8UpqyEAkAIAXA:5c70011a8022bab8809cdc4011e1170d -@data^QIhBDstSTMxgzMUiRNxavMhZSidoZyk7ACEUweVl022zN/HXXl:3944662c0c44cb012abb2009e22d4967 -@data^pu22JyJkq8SfAUP40JT3e9k95MrRmMxZlllmNSfz8SfcTlGEXk:466c0587fd6e5275d57d2ceca68ebea3 -@data^TfqX5Sd/LYq4EpvRLgQEnFmvdp0bMaqlxdpuwpxvyHwsqt5LgA:8718e937e6cecd59ceb00f76417fd346 -@data^iAKQ42adenp8Sbiewns/Enz3yc5F2J3E4E7if4T2E/UlMJ/2BP:16f7a8958473e3d7623e2e1d6204a368 -@data^WTlw8dfDy678TbXnjuW7LPe2FmlrNW8BCMZum99yyhNqzYS7PM:bc34356080c9564b0c28f9b46f1f2ed1 -@data^BEApGUeOqWEHTYwvs1sLpunXhRY0ao9jwQzBBjgAkAIACIw9+6:c65c6b1e837ca39220db3a4a471791d3 -@data^fm3xheUpUXfbd6steABE/WBBa7yeuV1teFjq6LAEN4IRfUoIbA:db333ee6a1b294b82c906effda88fec2 -@data^QRD84IIPDx1qwxtn54t+XinH8Fw8nZaC4nEqxfQBCRPygEfeT6:48f89cfe3798de4a75b2efc1c3793ecd -@data^+3Xr1J8vfVwJk8N/bntt9UKvgReonyJr0J8vvJ8oVfuTykX1+3:fe7792babc0222e9c6177d0998642183 -@data^p4dvs93lr5dlNEWwrW0skPjZyq1uzeGQELwsGETcEMoICcVVIC:24c80e453bf3b5a5b0670f83e2af4ac8 -@data^BAMhMyAEgZAgZAgQIExl90npJ5ieoJ24yeJPzKvn+fbaRaE4Ew:c1ef03cb2657421ffd2be85f8837fc8d -@data^qWEzCfMn4BNPXCr2k0k+BNSLCegmqoYTUmoT/ZORP43E7iboVb:61ce41972ca02b064f601cfe3cfd8edb -@data^+JNImn6SBhNvQTwKvpIv7J2J1JxJ3E4k5/UTCdCcyrvFD/pF5t:e137b6eb5c1cea22a1a78f100d8d942d -@data^id2hN8i7E/fiTfIGE2KsJzJ0J5E8YJ5EwKsyTmTYnInElOcgeJ:8d2eac349385494deadebd9bf1be57a0 -@data^NCd/6kXqFDiTz9eJNBQ46kWpVoTcTjCbhQ6/QnpCbybiecnq6y:97f3f499c7d2e6f7dbdbfdcb86280a81 -@data^LYnEnKTgTuJ9pF2+dT2+ijB/F3JFOFCQmAiaPg==:670330f69b80a2f2fec8b8bc882521d1 diff --git a/inc/classes/main/controller/registration/.htaccess b/inc/classes/main/controller/registration/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/inc/classes/main/controller/registration/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/inc/classes/main/controller/registration/class_DefaultRegistrationController.php b/inc/classes/main/controller/registration/class_DefaultRegistrationController.php deleted file mode 100644 index 24d7040f7..000000000 --- a/inc/classes/main/controller/registration/class_DefaultRegistrationController.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.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 DefaultRegistrationController extends BaseController implements Controller { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set part description - $this->setObjectDescription("Ein Standart-Anmelde-Controller"); - - // Create unique ID number - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - /** - * Creates an instance of this class - * - * @return $controllerInstance A prepared instance of this class - */ - public final static function createDefaultRegistrationController () { - // Create the instance - $controllerInstance = new DefaultRegistrationController(); - - // Return the prepared instance - return $controllerInstance; - } - - /** - * Handles the given request and response - * - * @param $requestInstance An instance of a request class - * @param $responseInstance An instance of a response class - * @return void - */ - public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { - die(__METHOD__.": Stub!"); - } -} - -// [EOF] -?> diff --git a/inc/classes/main/database/classes/.htaccess b/inc/classes/main/database/classes/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/inc/classes/main/database/classes/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/inc/classes/main/database/classes/class_LocalFileDatabase.php b/inc/classes/main/database/classes/class_LocalFileDatabase.php deleted file mode 100644 index 432a168f0..000000000 --- a/inc/classes/main/database/classes/class_LocalFileDatabase.php +++ /dev/null @@ -1,465 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.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 LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface { - /** - * Save path for "file database" - */ - private $savePath = ""; - - /** - * The file's extension - */ - private $fileExtension = "serialized"; - - /** - * The last read file's name - */ - private $lastFile = ""; - - /** - * The last read file's content including header information - */ - private $lastContents = array(); - - /** - * The private constructor. Do never instance from outside! - * You need to set a local file path. The class will then validate it. - * - * @return void - */ - protected function __construct() { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set description - $this->setObjectDescription("Class for local file databases"); - - // Create unique ID - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - /** - * Create an object of LocalFileDatabase and set the save path for local files. - * This method also validates the given file path. - * - * @param $savePath The local file path string - * @param $ioInstance The input/output handler. This - * should be FileIoHandler - * @return $dbInstance An instance of LocalFileDatabase - * @throws SavePathIsEmptyException If the given save path is an - * empty string - * @throws SavePathIsNoDirectoryException If the save path is no - * path (e.g. a file) - * @throws SavePathReadProtectedException If the save path is read- - * protected - * @throws SavePathWriteProtectedException If the save path is write- - * protected - */ - public final static function createLocalFileDatabase ($savePath, FileIoHandler $ioInstance) { - // Get an instance - $dbInstance = new LocalFileDatabase(); - - if (empty($savePath)) { - // Empty string - throw new SavePathIsEmptyException($dbInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!is_dir($savePath)) { - // Is not a dir - throw new SavePathIsNoDirectoryException($savePath, self::EXCEPTION_INVALID_PATH_NAME); - } elseif (!is_readable($savePath)) { - // Path not readable - throw new SavePathReadProtectedException($savePath, self::EXCEPTION_READ_PROTECED_PATH); - } elseif (!is_writeable($savePath)) { - // Path not writeable - throw new SavePathWriteProtectedException($savePath, self::EXCEPTION_WRITE_PROTECED_PATH); - } - - // Set save path and IO instance - $dbInstance->setSavePath($savePath); - $dbInstance->setFileIoInstance($ioInstance); - - // Return database instance - return $dbInstance; - } - - /** - * Setter for save path - * - * @param $savePath The local save path where we shall put our serialized classes - * @return void - */ - public final function setSavePath ($savePath) { - // Secure string - $savePath = (string) $savePath; - - // Set save path - $this->savePath = $savePath; - } - - /** - * Getter for save path - * - * @return $savePath The local save path where we shall put our serialized classes - */ - public final function getSavePath () { - return $this->savePath; - } - - /** - * Saves a given object to the local file system by serializing and - * transparently compressing it - * - * @param $object The object we shall save to the local file system - * @return void - * @throws NullPointerException If the object instance is null - * @throws NoObjectException If the parameter $object is not - * an object - */ - public final function saveObject ($object) { - // Some tests on the parameter... - if (is_null($object)) { - // Is null, throw exception - throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($object)) { - // Is not an object, throw exception - throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($object, '__toString')) { - // A highly required method was not found... :-( - throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD); - } - - // Get a string containing the serialized object. We cannot exchange - // $this and $object here because $object does not need to worry - // about it's limitations... ;-) - $serialized = $this->serializeObject($object); - - // Get a path name plus file name and append the extension - $fqfn = $this->getSavePath() . $object->getPathFileNameFromObject() . "." . $this->getFileExtension(); - - // Save the file to disc we don't care here if the path is there, - // this must be done in later methods. - $this->getFileIoInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized)); - } - - /** - * Get a serialized string from the given object - * - * @param $object The object we want to serialize and transparently - * compress - * @return $serialized A string containing the serialzed/compressed object - * @see ObjectLimits An object holding limition information - * @see SerializationContainer A special container class for e.g. - * attributes from limited objects - */ - private function serializeObject ($object) { - // If there is no limiter instance we serialize the whole object - // otherwise only in the limiter object (ObjectLimits) specified - // attributes summarized in a special container class - if ($this->getLimitInstance() === null) { - // Serialize the whole object. This tribble call is the reason - // why we need a fall-back implementation in CompressorChannel - // of the methods compressStream() and decompressStream(). - $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($object)); - } else { - // Serialize only given attributes in a special container - $container = SerializationContainer::createSerializationContainer($this->getLimitInstance(), $object); - - // Serialize the container - $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($container)); - } - - // Return the serialized object string - return $serialized; - } - - /** - * Analyses if a unique ID has already been used or not by search in the - * local database folder. - * - * @param $uniqueID A unique ID number which shall be checked - * before it will be used - * @param $inConstructor If we got called in a de/con-structor or - * from somewhere else - * @return $isUnused true = The unique ID was not found in the database, - * false = It is already in use by an other object - * @throws NoArrayCreatedException If explode() fails to create an array - * @throws InvalidArrayCountException If the array contains less or - * more than two elements - */ - public function isUniqueIdUsed ($uniqueID, $inConstructor = false) { - // Currently not used... ;-) - $isUsed = false; - - // Split the unique ID up in path and file name - $pathFile = explode("@", $uniqueID); - - // Are there two elements? Index 0 is the path, 1 the file name + global extension - if (!is_array($pathFile)) { - // No array found - if ($inConstructor) { - return false; - } else { - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); - } - } elseif (count($pathFile) != 2) { - // Invalid ID returned! - if ($inConstructor) { - return false; - } else { - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - } - - // Create full path name - $pathName = $this->getSavePath() . $pathFile[0]; - - // Check if the file is there with a file handler - if ($inConstructor) { - // No exceptions in constructors and destructors! - $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName, true); - - // Has an object being created? - if (!is_object($dirInstance)) return false; - } else { - // Outside a constructor - try { - $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName); - } catch (PathIsNoDirectoryException $e) { - // Okay, path not found - return false; - } - } - - // Initialize the search loop - $isValid = false; - while ($dataFile = $dirInstance->readDirectoryExcept(array(".", ".."))) { - // Generate FQFN for testing - $fqfn = sprintf("%s/%s", $pathName, $dataFile); - $this->setLastFile($fqfn); - - // Get instance for file handler - $inputHandler = $this->getFileIoInstance(); - - // Try to read from it. This makes it sure that the file is - // readable and a valid database file - $this->setLastFileContents($inputHandler->loadFileContents($fqfn)); - - // Extract filename (= unique ID) from it - $ID = substr(basename($fqfn), 0, -(strlen($this->getFileExtension()) + 1)); - - // Is this the required unique ID? - if ($ID == $pathFile[1]) { - // Okay, already in use! - $isUsed = true; - } - } - - // Close the directory handler - $dirInstance->closeDirectory(); - - // Now the same for the file... - return $isUsed; - } - - /** - * Setter for the last read file - * - * @param $fqfn The FQFN of the last read file - * @return void - */ - private final function setLastFile ($fqfn) { - // Cast string - $fqfn = (string) $fqfn; - $this->lastFile = $fqfn; - } - - /** - * Getter for last read file - * - * @return $lastFile The last read file's name with full path - */ - public final function getLastFile () { - return $this->lastFile; - } - - /** - * Setter for contents of the last read file - * - * @param $contents An array with header and data elements - * @return void - */ - private final function setLastFileContents ($contents) { - // Cast array - $contents = (array) $contents; - $this->lastContents = $contents; - } - - /** - * Getter for last read file's content as an array - * - * @return $lastContent The array with elements 'header' and 'data'. - */ - public final function getLastContents () { - return $this->lastContents; - } - - /** - * Getter for file extension - * - * @return $fileExtension The array with elements 'header' and 'data'. - */ - public final function getFileExtension () { - return $this->fileExtension; - } - - /** - * Get cached (last fetched) data from the local file database - * - * @param $uniqueID The ID number for looking up the data - * @return $object The restored object from the maybe compressed - * serialized data - * @throws MismatchingCompressorsException If the compressor from - * the loaded file - * mismatches with the - * current used one. - * @throws NullPointerException If the restored object - * is null - * @throws NoObjectException If the restored "object" - * is not an object instance - * @throws MissingMethodException If the required method - * toString() is missing - */ - public final function getObjectFromCachedData ($uniqueID) { - // Get instance for file handler - $inputHandler = $this->getFileIoInstance(); - - // Get last file's name and contents - $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID); - $contents = $this->repairContents($this->getLastContents(), $fqfn); - - // Let's decompress it. First we need the instance - $compressInstance = $this->getCompressorChannel(); - - // Is the compressor's extension the same as the one from the data? - if ($compressInstance->getCompressorExtension() != $contents['header'][0]) { - /** - * @todo For now we abort here but later we need to make this a little more dynamic. - */ - throw new MismatchingCompressorsException(array($this, $contents['header'][0], $fqfn, $compressInstance->getCompressorExtension()), self::EXCEPTION_MISMATCHING_COMPRESSORS); - } - - // Decompress the data now - $serialized = $compressInstance->getCompressor()->decompressStream($contents['data']); - - // And unserialize it... - $object = unserialize($serialized); - - // This must become a valid object, so let's check it... - if (is_null($object)) { - // Is null, throw exception - throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($object)) { - // Is not an object, throw exception - throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($object, '__toString')) { - // A highly required method was not found... :-( - throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD); - } - - // And return the object - return $object; - } - - /** - * Private method for re-gathering (repairing) the FQFN - * - * @param $fqfn The current FQFN we shall validate - * @param $uniqueID The unique ID number - * @return $fqfn The repaired FQFN when it is empty - * @throws NoArrayCreatedException If explode() has not - * created an array - * @throws InvalidArrayCountException If the array count is not - * as the expected - */ - private function repairFQFN ($fqfn, $uniqueID) { - // Cast both strings - $fqfn = (string) $fqfn; - $uniqueID = (string) $uniqueID; - - // Is there pre-cached data available? - if (empty($fqfn)) { - // Split the unique ID up in path and file name - $pathFile = explode("@", $uniqueID); - - // Are there two elements? Index 0 is the path, 1 the file name + global extension - if (!is_array($pathFile)) { - // No array found - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); - } elseif (count($pathFile) != 2) { - // Invalid ID returned! - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - - // Create full path name - $pathName = $this->getSavePath() . $pathFile[0]; - - // Nothing cached, so let's create a FQFN first - $fqfn = sprintf("%s/%s.%s", $pathName, $pathFile[1], $this->getFileExtension()); - $this->setLastFile($fqfn); - } - - // Return repaired FQFN - return $fqfn; - } - - /** - * Private method for re-gathering the contents of a given file - * - * @param $contents The (maybe) already cached contents as an array - * @param $fqfn The current FQFN we shall validate - * @return $contents The repaired contents from the given file - */ - private function repairContents ($contents, $fqfn) { - // Is there some content and header (2 indexes) in? - if ((!is_array($contents)) || (count($contents) != 2) || (!isset($contents['header'])) || (!isset($contents['data']))) { - // No content found so load the file again - $contents = $inputHandler->loadFileContents($fqfn); - - // And remember all data for later usage - $this->setLastContents($contents); - } - - // Return the repaired contents - return $contents; - } - - /* DUMMY */ public final function loadObject () {} -} - -// [EOF] -?> diff --git a/inc/classes/main/factories/web/class_NewsFactory.php b/inc/classes/main/factories/web/class_NewsFactory.php deleted file mode 100644 index 3da66f9f7..000000000 --- a/inc/classes/main/factories/web/class_NewsFactory.php +++ /dev/null @@ -1,117 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.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 NewsFactory extends BaseFactory { - /** - * Instance of a request class - */ - private $requestInstance = null; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set part description - $this->setObjectDescription("News-Fabrik für Webseiten"); - } - - /** - * Singleton getter for a special factory instance depending on the given - * request - * - * @param $requestInstance An instance of a request class - * @return $factoryInstance An instance of a NewsFactory class - */ - public final static function createFactoryByRequest (Requestable $requestInstance) { - // Generate the new instance - $factoryInstance = new NewsFactory(); - - // Get the element name from configuration - $element = FrameworkConfiguration::getInstance()->readConfig("app_selector_get"); - - // Analyze the request, first get the Uni* application name (short one from URL) - $appName = $requestInstance->getRequestElement($element); - - // Initialize some variables - $className = ""; - $className2 = $appName; - - // Then construct the class name - foreach (array("_", "-") as $exp) { - $array = explode($exp, $className2); - foreach ($array as $el) { - $className .= ucfirst(strtolower($el)); - } - - // Copy it back and clear the class name - $className2 = $className; - $className = ""; - } - - // After all is done, copy it back and add this class' name - $className = $className2 . $factoryInstance->__toString(); - - // Once we have that name, try to load initialize it - $realFactoryInstance = ObjectFactory::createObjectByName($className); - - // And assign it with the factory - $factoryInstance->setRealFactoryInstance($realFactoryInstance); - - // Remember the request we have used for later usage - $factoryInstance->setRequestInstance($requestInstance); - - // Return the prepared factory instance - return $factoryInstance; - } - - /** - * Setter for the request instance - * - * @param $requestInstance An instance of a request object - * @return void - */ - public final function setRequestInstance (Requestable $requestInstance) { - $this->requestInstance = $requestInstance; - } - - /** - * Creates a new object instance and returns it - * - * @return $newsInstance An instance of a news object - */ - public function createNewsObject () { - // Ask the real factory class for doing this - $newsInstance = $this->getRealFactoryInstance()->createNewObject($this->requestInstance); - - // And return it - return $newsInstance; - } -} - -// [EOF] -?> -- 2.39.5