From: Roland Häder Date: Mon, 3 Mar 2008 20:29:15 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=commitdiff_plain;h=ff66822b5fb6a92f5dc8af55290ecb89ec7f1aaf;hp=d3dc161881e77cb39100a7d9220f520a5375bb26 --- diff --git a/.gitattributes b/.gitattributes index 3d5165c..1756aab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,274 +1,274 @@ * text=auto !eol -ship-simu/Doxyfile -text -ship-simu/application/.htaccess -text -ship-simu/application/selector/.htaccess -text -ship-simu/application/selector/class_ApplicationHelper.php -text -ship-simu/application/selector/class_ApplicationSelector.php -text -ship-simu/application/selector/debug.php -text -ship-simu/application/selector/exceptions.php -text -ship-simu/application/selector/init.php -text -ship-simu/application/selector/loader.php -text -ship-simu/application/selector/starter.php -text -ship-simu/application/selector/templates/.htaccess -text -ship-simu/application/selector/templates/de/.htaccess -text -ship-simu/application/selector/templates/de/code/.htaccess -text -ship-simu/application/selector/templates/de/code/selector_apps.ctp -text -ship-simu/application/selector/templates/de/code/selector_main.ctp -text -ship-simu/application/ship-simu/.htaccess -text -ship-simu/application/ship-simu/class_ApplicationHelper.php -text -ship-simu/application/ship-simu/debug.php -text -ship-simu/application/ship-simu/exceptions.php -text -ship-simu/application/ship-simu/exceptions/.htaccess -text -ship-simu/application/ship-simu/exceptions/class_BirthdayInvalidException.php -text -ship-simu/application/ship-simu/exceptions/class_CabinShipMismatchException.php -text -ship-simu/application/ship-simu/exceptions/class_ContractAllreadySignedException.php -text -ship-simu/application/ship-simu/exceptions/class_ContractPartnerMismatchException.php -text -ship-simu/application/ship-simu/exceptions/class_DeckShipMismatchException.php -text -ship-simu/application/ship-simu/exceptions/class_EmptyStructuresListException.php -text -ship-simu/application/ship-simu/exceptions/class_InvalidContractPartnerException.php -text -ship-simu/application/ship-simu/exceptions/class_InvalidIDFormatException.php -text -ship-simu/application/ship-simu/exceptions/class_ItemNotInPriceListException.php -text -ship-simu/application/ship-simu/exceptions/class_ItemNotTradeableException.php -text -ship-simu/application/ship-simu/exceptions/class_MissingSimulatorIDException.php -text -ship-simu/application/ship-simu/exceptions/class_MotorShipMismatchException.php -text -ship-simu/application/ship-simu/exceptions/class_NoShipyardsConstructedException.php -text -ship-simu/application/ship-simu/exceptions/class_PersonellListAlreadyCreatedException.php -text -ship-simu/application/ship-simu/exceptions/class_RoomShipMismatchException.php -text -ship-simu/application/ship-simu/exceptions/class_ShipNotConstructedException.php -text -ship-simu/application/ship-simu/exceptions/class_ShipPartNotConstructableException.php -text -ship-simu/application/ship-simu/exceptions/class_StructureShipMismatchException.php -text -ship-simu/application/ship-simu/exceptions/class_StructuresOutOfBoundsException.php -text -ship-simu/application/ship-simu/exceptions/class_ToMuchEmployeesException.php -text -ship-simu/application/ship-simu/exceptions/class_TotalPriceNotCalculatedException.php -text -ship-simu/application/ship-simu/exceptions/class_UnsupportedLimitationPartException.php -text -ship-simu/application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php -text -ship-simu/application/ship-simu/init.php -text -ship-simu/application/ship-simu/interfaces/.htaccess -text -ship-simu/application/ship-simu/interfaces/class_ConstructableShip.php -text -ship-simu/application/ship-simu/interfaces/class_ConstructableShipPart.php -text -ship-simu/application/ship-simu/interfaces/class_ContractPartner.php -text -ship-simu/application/ship-simu/interfaces/class_Customer.php -text -ship-simu/application/ship-simu/interfaces/class_ItemIsTradeable.php -text -ship-simu/application/ship-simu/interfaces/class_Personellizer.php -text -ship-simu/application/ship-simu/loader.php -text -ship-simu/application/ship-simu/main/.htaccess -text -ship-simu/application/ship-simu/main/class_ -text -ship-simu/application/ship-simu/main/class_BasePersonell.php -text -ship-simu/application/ship-simu/main/class_BaseSimulator.php -text -ship-simu/application/ship-simu/main/class_Merchant.php -text -ship-simu/application/ship-simu/main/class_WorksContract.php -text -ship-simu/application/ship-simu/main/companies/.htaccess -text -ship-simu/application/ship-simu/main/companies/class_ShippingCompany.php -text -ship-simu/application/ship-simu/main/constructions/.htaccess -text -ship-simu/application/ship-simu/main/constructions/berths/.htaccess -text -ship-simu/application/ship-simu/main/constructions/berths/class_Berth.php -text -ship-simu/application/ship-simu/main/constructions/class_BaseConstruction.php -text -ship-simu/application/ship-simu/main/constructions/docks/.htaccess -text -ship-simu/application/ship-simu/main/constructions/docks/class_DryDock.php -text -ship-simu/application/ship-simu/main/constructions/harbors/.htaccess -text -ship-simu/application/ship-simu/main/constructions/harbors/class_Harbor.php -text -ship-simu/application/ship-simu/main/constructions/terminals/.htaccess -text -ship-simu/application/ship-simu/main/constructions/terminals/class_Terminal.php -text -ship-simu/application/ship-simu/main/constructions/yards/.htaccess -text -ship-simu/application/ship-simu/main/constructions/yards/class_Shipyard.php -text -ship-simu/application/ship-simu/main/drives/.htaccess -text -ship-simu/application/ship-simu/main/drives/class_BaseDrive.php -text -ship-simu/application/ship-simu/main/drives/motor/.htaccess -text -ship-simu/application/ship-simu/main/drives/motor/class_Motor.php -text -ship-simu/application/ship-simu/main/parts/.htaccess -text -ship-simu/application/ship-simu/main/parts/class_BaseShipPart.php -text -ship-simu/application/ship-simu/main/parts/maschineroom/.htaccess -text -ship-simu/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php -text -ship-simu/application/ship-simu/main/personell/.htaccess -text -ship-simu/application/ship-simu/main/personell/class_SimulatorPersonell.php -text -ship-simu/application/ship-simu/main/personell/company/.htaccess -text -ship-simu/application/ship-simu/main/personell/company/class_CompanyEmployee.php -text -ship-simu/application/ship-simu/main/ships/.htaccess -text -ship-simu/application/ship-simu/main/ships/class_BaseShip.php -text -ship-simu/application/ship-simu/main/ships/passenger/.htaccess -text -ship-simu/application/ship-simu/main/ships/passenger/class_PassengerShip.php -text -ship-simu/application/ship-simu/main/structures/.htaccess -text -ship-simu/application/ship-simu/main/structures/class_BaseStructure.php -text -ship-simu/application/ship-simu/main/structures/extended/.htaccess -text -ship-simu/application/ship-simu/main/structures/extended/cabines/.htaccess -text -ship-simu/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php -text -ship-simu/application/ship-simu/main/structures/extended/cabines/ship/.htaccess -text -ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php -text -ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php -text -ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php -text -ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php -text -ship-simu/application/ship-simu/main/structures/extended/class_ -text -ship-simu/application/ship-simu/main/structures/extended/class_BaseCabinStructure.php -text -ship-simu/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php -text -ship-simu/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php -text -ship-simu/application/ship-simu/main/structures/extended/decks/.htaccess -text -ship-simu/application/ship-simu/main/structures/extended/decks/cargo/.htaccess -text -ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php -text -ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php -text -ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php -text -ship-simu/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php -text -ship-simu/application/ship-simu/main/structures/extended/lower/.htaccess -text -ship-simu/application/ship-simu/main/structures/extended/upper/.htaccess -text -ship-simu/application/ship-simu/main/structures/extended/upper/class_Bridge.php -text -ship-simu/application/ship-simu/starter.php -text -ship-simu/application/ship-simu/templates/.htaccess -text -ship-simu/application/ship-simu/templates/de/.htaccess -text -ship-simu/application/ship-simu/templates/de/html/.htaccess -text -ship-simu/application/ship-simu/templates/de/html/selector_ship-simu.tpl -text -ship-simu/db/.htaccess -text -ship-simu/devel/.htaccess -text -ship-simu/devel/class_Debug.php -text -ship-simu/docs/THANKS -text -ship-simu/inc/.htaccess -text -ship-simu/inc/classes.php -text -ship-simu/inc/classes/.htaccess -text -ship-simu/inc/classes/exceptions/.htaccess -text -ship-simu/inc/classes/exceptions/class_FrameworkException.php -text -ship-simu/inc/classes/exceptions/compressor/.htaccess -text -ship-simu/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php -text -ship-simu/inc/classes/exceptions/container/.htaccess -text -ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php -text -ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNullException.php -text -ship-simu/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php -text -ship-simu/inc/classes/exceptions/database/.htaccess -text -ship-simu/inc/classes/exceptions/database/local_file/.htaccess -text -ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php -text -ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php -text -ship-simu/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php -text -ship-simu/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php -text -ship-simu/inc/classes/exceptions/io/.htaccess -text -ship-simu/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text -ship-simu/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php -text -ship-simu/inc/classes/exceptions/io/class_InvalidDataLengthException.php -text -ship-simu/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php -text -ship-simu/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php -text -ship-simu/inc/classes/exceptions/io/class_PathIsEmptyException.php -text -ship-simu/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php -text -ship-simu/inc/classes/exceptions/io/class_PathReadProtectedException.php -text -ship-simu/inc/classes/exceptions/language/.htaccess -text -ship-simu/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php -text -ship-simu/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php -text -ship-simu/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php -text -ship-simu/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php -text -ship-simu/inc/classes/exceptions/main/.htaccess -text -ship-simu/inc/classes/exceptions/main/class_ClassMismatchException.php -text -ship-simu/inc/classes/exceptions/main/class_ClassNotFoundException.php -text -ship-simu/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php -text -ship-simu/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php -text -ship-simu/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php -text -ship-simu/inc/classes/exceptions/main/class_ExceptionNotChangedException.php -text -ship-simu/inc/classes/exceptions/main/class_ExceptionNotFoundException.php -text -ship-simu/inc/classes/exceptions/main/class_GetterNotFoundException.php -text -ship-simu/inc/classes/exceptions/main/class_InvalidArrayCountException.php -text -ship-simu/inc/classes/exceptions/main/class_InvalidObjectException.php -text -ship-simu/inc/classes/exceptions/main/class_MissingArrayElementsException.php -text -ship-simu/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php -text -ship-simu/inc/classes/exceptions/main/class_MissingMethodException.php -text -ship-simu/inc/classes/exceptions/main/class_NoArrayCreatedException.php -text -ship-simu/inc/classes/exceptions/main/class_NoArrayException.php -text -ship-simu/inc/classes/exceptions/main/class_NoObjectException.php -text -ship-simu/inc/classes/exceptions/main/class_NullPointerException.php -text -ship-simu/inc/classes/exceptions/main/class_VariableIsNotSetException.php -text -ship-simu/inc/classes/exceptions/template/.htaccess -text -ship-simu/inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text -ship-simu/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -text -ship-simu/inc/classes/exceptions/template/class_BasePathReadProtectedException.php -text -ship-simu/inc/classes/exceptions/template/class_InvalidBasePathStringException.php -text -ship-simu/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php -text -ship-simu/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text -ship-simu/inc/classes/interfaces/.htaccess -text -ship-simu/inc/classes/interfaces/application/.htaccess -text -ship-simu/inc/classes/interfaces/application/class_ManageableApplication.php -text -ship-simu/inc/classes/interfaces/class_FrameworkInterface.php -text -ship-simu/inc/classes/interfaces/compressor/.htaccess -text -ship-simu/inc/classes/interfaces/compressor/class_Compressor.php -text -ship-simu/inc/classes/interfaces/database/.htaccess -text -ship-simu/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php -text -ship-simu/inc/classes/interfaces/database/frontend/.htaccess -text -ship-simu/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php -text -ship-simu/inc/classes/interfaces/database/middleware/.htaccess -text -ship-simu/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php -text -ship-simu/inc/classes/interfaces/debug/.htaccess -text -ship-simu/inc/classes/interfaces/debug/class_Debugger.php -text -ship-simu/inc/classes/interfaces/extended/.htaccess -text -ship-simu/inc/classes/interfaces/extended/class_LimitableObject.php -text -ship-simu/inc/classes/interfaces/io/.htaccess -text -ship-simu/inc/classes/interfaces/io/class_Streamable.php -text -ship-simu/inc/classes/interfaces/io/file/.htaccess -text -ship-simu/inc/classes/interfaces/io/file/class_FileInputStreamer.php -text -ship-simu/inc/classes/interfaces/io/file/class_FileOutputStreamer.php -text -ship-simu/inc/classes/interfaces/io/output/.htaccess -text -ship-simu/inc/classes/interfaces/io/output/class_OutputStreamer.php -text -ship-simu/inc/classes/interfaces/language/.htaccess -text -ship-simu/inc/classes/interfaces/language/class_ManageableLanguage.php -text -ship-simu/inc/classes/interfaces/template/.htaccess -text -ship-simu/inc/classes/interfaces/template/class_CompileableTemplate.php -text -ship-simu/inc/classes/main/.htaccess -text -ship-simu/inc/classes/main/class_BaseFrameworkSystem.php -text -ship-simu/inc/classes/main/class_FrameworkArrayObject.php -text -ship-simu/inc/classes/main/compressor/.htaccess -text -ship-simu/inc/classes/main/compressor/class_Bzip2Compressor.php -text -ship-simu/inc/classes/main/compressor/class_GzipCompressor.php -text -ship-simu/inc/classes/main/compressor/class_NullCompressor.php -text -ship-simu/inc/classes/main/console/.htaccess -text -ship-simu/inc/classes/main/console/class_ConsoleTools.php -text -ship-simu/inc/classes/main/database/.htaccess -text -ship-simu/inc/classes/main/database/class_BaseDatabaseFrontend.php -text -ship-simu/inc/classes/main/database/classes/.htaccess -text -ship-simu/inc/classes/main/database/classes/class_LocalFileDatabase.php -text -ship-simu/inc/classes/main/debug/.htaccess -text -ship-simu/inc/classes/main/debug/class_DebugConsoleOutput.php -text -ship-simu/inc/classes/main/debug/class_DebugErrorLogOutput.php -text -ship-simu/inc/classes/main/debug/class_DebugWebOutput.php -text -ship-simu/inc/classes/main/extended/.htaccess -text -ship-simu/inc/classes/main/extended/class_ObjectLimits.php -text -ship-simu/inc/classes/main/extended/class_SerializationContainer.php -text -ship-simu/inc/classes/main/io/.htaccess -text -ship-simu/inc/classes/main/io/class_FileIOStream.php -text -ship-simu/inc/classes/main/io/class_FrameworkDirectoryPointer.php -text -ship-simu/inc/classes/main/io/class_FrameworkFileInputPointer.php -text -ship-simu/inc/classes/main/io/class_FrameworkFileOutputPointer.php -text -ship-simu/inc/classes/main/language/.htaccess -text -ship-simu/inc/classes/main/language/class_LanguageSystem.php -text -ship-simu/inc/classes/main/output/.htaccess -text -ship-simu/inc/classes/main/output/class_ConsoleOutput.php -text -ship-simu/inc/classes/main/output/class_WebOutput.php -text -ship-simu/inc/classes/main/template/.htaccess -text -ship-simu/inc/classes/main/template/class_TemplateEngine.php -text -ship-simu/inc/classes/middleware/.htaccess -text -ship-simu/inc/classes/middleware/class_BaseMiddleware.php -text -ship-simu/inc/classes/middleware/compressor/.htaccess -text -ship-simu/inc/classes/middleware/compressor/class_CompressorChannel.php -text -ship-simu/inc/classes/middleware/database/.htaccess -text -ship-simu/inc/classes/middleware/database/class_DatabaseConnection.php -text -ship-simu/inc/classes/middleware/debug/.htaccess -text -ship-simu/inc/classes/middleware/debug/class_DebugMiddleware.php -text -ship-simu/inc/classes/middleware/io/.htaccess -text -ship-simu/inc/classes/middleware/io/class_FileIOHandler.php -text -ship-simu/inc/config.php -text -ship-simu/inc/config/.htaccess -text -ship-simu/inc/config/class_FrameworkConfiguration.php -text -ship-simu/inc/database.php -text -ship-simu/inc/database/.htaccess -text -ship-simu/inc/database/lib-local.php -text -ship-simu/inc/file_io.php -text -ship-simu/inc/includes.php -text -ship-simu/inc/language.php -text -ship-simu/inc/language/.htaccess -text -ship-simu/inc/loader/.htaccess -text -ship-simu/inc/loader/class_ClassLoader.php -text -ship-simu/inc/output.php -text -ship-simu/inc/selector.php -text -ship-simu/index.php -text -ship-simu/rebuild_doc.sh -text -ship-simu/templates/.htaccess -text -ship-simu/templates/_compiled/.htaccess -text -ship-simu/templates/de/.htaccess -text -ship-simu/templates/de/code/.htaccess -text -ship-simu/templates/de/code/emergency_exit.ctp -text -ship-simu/templates/de/code/footer_msg.ctp -text -ship-simu/templates/de/code/header.ctp -text -ship-simu/templates/de/html/.htaccess -text -ship-simu/tests/contract-test.php -text -ship-simu/tests/loader-test.php -text -ship-simu/tests/personell-test.php -text +/Doxyfile -text +application/.htaccess -text +application/selector/.htaccess -text +application/selector/class_ApplicationHelper.php -text +application/selector/class_ApplicationSelector.php -text +application/selector/debug.php -text +application/selector/exceptions.php -text +application/selector/init.php -text +application/selector/loader.php -text +application/selector/starter.php -text +application/selector/templates/.htaccess -text +application/selector/templates/de/.htaccess -text +application/selector/templates/de/code/.htaccess -text +application/selector/templates/de/code/selector_apps.ctp -text +application/selector/templates/de/code/selector_main.ctp -text +application/ship-simu/.htaccess -text +application/ship-simu/class_ApplicationHelper.php -text +application/ship-simu/debug.php -text +application/ship-simu/exceptions.php -text +application/ship-simu/exceptions/.htaccess -text +application/ship-simu/exceptions/class_BirthdayInvalidException.php -text +application/ship-simu/exceptions/class_CabinShipMismatchException.php -text +application/ship-simu/exceptions/class_ContractAllreadySignedException.php -text +application/ship-simu/exceptions/class_ContractPartnerMismatchException.php -text +application/ship-simu/exceptions/class_DeckShipMismatchException.php -text +application/ship-simu/exceptions/class_EmptyStructuresListException.php -text +application/ship-simu/exceptions/class_InvalidContractPartnerException.php -text +application/ship-simu/exceptions/class_InvalidIDFormatException.php -text +application/ship-simu/exceptions/class_ItemNotInPriceListException.php -text +application/ship-simu/exceptions/class_ItemNotTradeableException.php -text +application/ship-simu/exceptions/class_MissingSimulatorIDException.php -text +application/ship-simu/exceptions/class_MotorShipMismatchException.php -text +application/ship-simu/exceptions/class_NoShipyardsConstructedException.php -text +application/ship-simu/exceptions/class_PersonellListAlreadyCreatedException.php -text +application/ship-simu/exceptions/class_RoomShipMismatchException.php -text +application/ship-simu/exceptions/class_ShipNotConstructedException.php -text +application/ship-simu/exceptions/class_ShipPartNotConstructableException.php -text +application/ship-simu/exceptions/class_StructureShipMismatchException.php -text +application/ship-simu/exceptions/class_StructuresOutOfBoundsException.php -text +application/ship-simu/exceptions/class_ToMuchEmployeesException.php -text +application/ship-simu/exceptions/class_TotalPriceNotCalculatedException.php -text +application/ship-simu/exceptions/class_UnsupportedLimitationPartException.php -text +application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php -text +application/ship-simu/init.php -text +application/ship-simu/interfaces/.htaccess -text +application/ship-simu/interfaces/class_ConstructableShip.php -text +application/ship-simu/interfaces/class_ConstructableShipPart.php -text +application/ship-simu/interfaces/class_ContractPartner.php -text +application/ship-simu/interfaces/class_Customer.php -text +application/ship-simu/interfaces/class_ItemIsTradeable.php -text +application/ship-simu/interfaces/class_Personellizer.php -text +application/ship-simu/loader.php -text +application/ship-simu/main/.htaccess -text +application/ship-simu/main/class_ -text +application/ship-simu/main/class_BasePersonell.php -text +application/ship-simu/main/class_BaseSimulator.php -text +application/ship-simu/main/class_Merchant.php -text +application/ship-simu/main/class_WorksContract.php -text +application/ship-simu/main/companies/.htaccess -text +application/ship-simu/main/companies/class_ShippingCompany.php -text +application/ship-simu/main/constructions/.htaccess -text +application/ship-simu/main/constructions/berths/.htaccess -text +application/ship-simu/main/constructions/berths/class_Berth.php -text +application/ship-simu/main/constructions/class_BaseConstruction.php -text +application/ship-simu/main/constructions/docks/.htaccess -text +application/ship-simu/main/constructions/docks/class_DryDock.php -text +application/ship-simu/main/constructions/harbors/.htaccess -text +application/ship-simu/main/constructions/harbors/class_Harbor.php -text +application/ship-simu/main/constructions/terminals/.htaccess -text +application/ship-simu/main/constructions/terminals/class_Terminal.php -text +application/ship-simu/main/constructions/yards/.htaccess -text +application/ship-simu/main/constructions/yards/class_Shipyard.php -text +application/ship-simu/main/drives/.htaccess -text +application/ship-simu/main/drives/class_BaseDrive.php -text +application/ship-simu/main/drives/motor/.htaccess -text +application/ship-simu/main/drives/motor/class_Motor.php -text +application/ship-simu/main/parts/.htaccess -text +application/ship-simu/main/parts/class_BaseShipPart.php -text +application/ship-simu/main/parts/maschineroom/.htaccess -text +application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php -text +application/ship-simu/main/personell/.htaccess -text +application/ship-simu/main/personell/class_SimulatorPersonell.php -text +application/ship-simu/main/personell/company/.htaccess -text +application/ship-simu/main/personell/company/class_CompanyEmployee.php -text +application/ship-simu/main/ships/.htaccess -text +application/ship-simu/main/ships/class_BaseShip.php -text +application/ship-simu/main/ships/passenger/.htaccess -text +application/ship-simu/main/ships/passenger/class_PassengerShip.php -text +application/ship-simu/main/structures/.htaccess -text +application/ship-simu/main/structures/class_BaseStructure.php -text +application/ship-simu/main/structures/extended/.htaccess -text +application/ship-simu/main/structures/extended/cabines/.htaccess -text +application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php -text +application/ship-simu/main/structures/extended/cabines/ship/.htaccess -text +application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php -text +application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php -text +application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php -text +application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php -text +application/ship-simu/main/structures/extended/class_ -text +application/ship-simu/main/structures/extended/class_BaseCabinStructure.php -text +application/ship-simu/main/structures/extended/class_BaseDeckStructure.php -text +application/ship-simu/main/structures/extended/class_BaseUpperStructure.php -text +application/ship-simu/main/structures/extended/decks/.htaccess -text +application/ship-simu/main/structures/extended/decks/cargo/.htaccess -text +application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php -text +application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php -text +application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php -text +application/ship-simu/main/structures/extended/decks/class_BaseDeck.php -text +application/ship-simu/main/structures/extended/lower/.htaccess -text +application/ship-simu/main/structures/extended/upper/.htaccess -text +application/ship-simu/main/structures/extended/upper/class_Bridge.php -text +application/ship-simu/starter.php -text +application/ship-simu/templates/.htaccess -text +application/ship-simu/templates/de/.htaccess -text +application/ship-simu/templates/de/html/.htaccess -text +application/ship-simu/templates/de/html/selector_ship-simu.tpl -text +db/.htaccess -text +devel/.htaccess -text +devel/class_Debug.php -text +docs/THANKS -text +inc/.htaccess -text +inc/classes.php -text +inc/classes/.htaccess -text +inc/classes/exceptions/.htaccess -text +inc/classes/exceptions/class_FrameworkException.php -text +inc/classes/exceptions/compressor/.htaccess -text +inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php -text +inc/classes/exceptions/container/.htaccess -text +inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php -text +inc/classes/exceptions/container/class_ContainerItemIsNullException.php -text +inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php -text +inc/classes/exceptions/database/.htaccess -text +inc/classes/exceptions/database/local_file/.htaccess -text +inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php -text +inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php -text +inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php -text +inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php -text +inc/classes/exceptions/io/.htaccess -text +inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text +inc/classes/exceptions/io/class_FilePointerNotOpenedException.php -text +inc/classes/exceptions/io/class_InvalidDataLengthException.php -text +inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php -text +inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php -text +inc/classes/exceptions/io/class_PathIsEmptyException.php -text +inc/classes/exceptions/io/class_PathIsNoDirectoryException.php -text +inc/classes/exceptions/io/class_PathReadProtectedException.php -text +inc/classes/exceptions/language/.htaccess -text +inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php -text +inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php -text +inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php -text +inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php -text +inc/classes/exceptions/main/.htaccess -text +inc/classes/exceptions/main/class_ClassMismatchException.php -text +inc/classes/exceptions/main/class_ClassNotFoundException.php -text +inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php -text +inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php -text +inc/classes/exceptions/main/class_DimNotFoundInArrayException.php -text +inc/classes/exceptions/main/class_ExceptionNotChangedException.php -text +inc/classes/exceptions/main/class_ExceptionNotFoundException.php -text +inc/classes/exceptions/main/class_GetterNotFoundException.php -text +inc/classes/exceptions/main/class_InvalidArrayCountException.php -text +inc/classes/exceptions/main/class_InvalidObjectException.php -text +inc/classes/exceptions/main/class_MissingArrayElementsException.php -text +inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php -text +inc/classes/exceptions/main/class_MissingMethodException.php -text +inc/classes/exceptions/main/class_NoArrayCreatedException.php -text +inc/classes/exceptions/main/class_NoArrayException.php -text +inc/classes/exceptions/main/class_NoObjectException.php -text +inc/classes/exceptions/main/class_NullPointerException.php -text +inc/classes/exceptions/main/class_VariableIsNotSetException.php -text +inc/classes/exceptions/template/.htaccess -text +inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text +inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -text +inc/classes/exceptions/template/class_BasePathReadProtectedException.php -text +inc/classes/exceptions/template/class_InvalidBasePathStringException.php -text +inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php -text +inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text +inc/classes/interfaces/.htaccess -text +inc/classes/interfaces/application/.htaccess -text +inc/classes/interfaces/application/class_ManageableApplication.php -text +inc/classes/interfaces/class_FrameworkInterface.php -text +inc/classes/interfaces/compressor/.htaccess -text +inc/classes/interfaces/compressor/class_Compressor.php -text +inc/classes/interfaces/database/.htaccess -text +inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php -text +inc/classes/interfaces/database/frontend/.htaccess -text +inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php -text +inc/classes/interfaces/database/middleware/.htaccess -text +inc/classes/interfaces/database/middleware/class_DatabaseConnector.php -text +inc/classes/interfaces/debug/.htaccess -text +inc/classes/interfaces/debug/class_Debugger.php -text +inc/classes/interfaces/extended/.htaccess -text +inc/classes/interfaces/extended/class_LimitableObject.php -text +inc/classes/interfaces/io/.htaccess -text +inc/classes/interfaces/io/class_Streamable.php -text +inc/classes/interfaces/io/file/.htaccess -text +inc/classes/interfaces/io/file/class_FileInputStreamer.php -text +inc/classes/interfaces/io/file/class_FileOutputStreamer.php -text +inc/classes/interfaces/io/output/.htaccess -text +inc/classes/interfaces/io/output/class_OutputStreamer.php -text +inc/classes/interfaces/language/.htaccess -text +inc/classes/interfaces/language/class_ManageableLanguage.php -text +inc/classes/interfaces/template/.htaccess -text +inc/classes/interfaces/template/class_CompileableTemplate.php -text +inc/classes/main/.htaccess -text +inc/classes/main/class_BaseFrameworkSystem.php -text +inc/classes/main/class_FrameworkArrayObject.php -text +inc/classes/main/compressor/.htaccess -text +inc/classes/main/compressor/class_Bzip2Compressor.php -text +inc/classes/main/compressor/class_GzipCompressor.php -text +inc/classes/main/compressor/class_NullCompressor.php -text +inc/classes/main/console/.htaccess -text +inc/classes/main/console/class_ConsoleTools.php -text +inc/classes/main/database/.htaccess -text +inc/classes/main/database/class_BaseDatabaseFrontend.php -text +inc/classes/main/database/classes/.htaccess -text +inc/classes/main/database/classes/class_LocalFileDatabase.php -text +inc/classes/main/debug/.htaccess -text +inc/classes/main/debug/class_DebugConsoleOutput.php -text +inc/classes/main/debug/class_DebugErrorLogOutput.php -text +inc/classes/main/debug/class_DebugWebOutput.php -text +inc/classes/main/extended/.htaccess -text +inc/classes/main/extended/class_ObjectLimits.php -text +inc/classes/main/extended/class_SerializationContainer.php -text +inc/classes/main/io/.htaccess -text +inc/classes/main/io/class_FileIOStream.php -text +inc/classes/main/io/class_FrameworkDirectoryPointer.php -text +inc/classes/main/io/class_FrameworkFileInputPointer.php -text +inc/classes/main/io/class_FrameworkFileOutputPointer.php -text +inc/classes/main/language/.htaccess -text +inc/classes/main/language/class_LanguageSystem.php -text +inc/classes/main/output/.htaccess -text +inc/classes/main/output/class_ConsoleOutput.php -text +inc/classes/main/output/class_WebOutput.php -text +inc/classes/main/template/.htaccess -text +inc/classes/main/template/class_TemplateEngine.php -text +inc/classes/middleware/.htaccess -text +inc/classes/middleware/class_BaseMiddleware.php -text +inc/classes/middleware/compressor/.htaccess -text +inc/classes/middleware/compressor/class_CompressorChannel.php -text +inc/classes/middleware/database/.htaccess -text +inc/classes/middleware/database/class_DatabaseConnection.php -text +inc/classes/middleware/debug/.htaccess -text +inc/classes/middleware/debug/class_DebugMiddleware.php -text +inc/classes/middleware/io/.htaccess -text +inc/classes/middleware/io/class_FileIOHandler.php -text +inc/config.php -text +inc/config/.htaccess -text +inc/config/class_FrameworkConfiguration.php -text +inc/database.php -text +inc/database/.htaccess -text +inc/database/lib-local.php -text +inc/file_io.php -text +inc/includes.php -text +inc/language.php -text +inc/language/.htaccess -text +inc/loader/.htaccess -text +inc/loader/class_ClassLoader.php -text +inc/output.php -text +inc/selector.php -text +/index.php -text +/rebuild_doc.sh -text +templates/.htaccess -text +templates/_compiled/.htaccess -text +templates/de/.htaccess -text +templates/de/code/.htaccess -text +templates/de/code/emergency_exit.ctp -text +templates/de/code/footer_msg.ctp -text +templates/de/code/header.ctp -text +templates/de/html/.htaccess -text +tests/contract-test.php -text +tests/loader-test.php -text +tests/personell-test.php -text diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..0312e4b --- /dev/null +++ b/Doxyfile @@ -0,0 +1,1321 @@ +# Doxyfile 1.5.4 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Ship-Simulator + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.1a + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = /var/www/htdocs/ship-simu/docs/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class " \ + "The $name widget " \ + "The $name file " \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = YES + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = /var/www/htdocs/ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = YES + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = YES + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is +# documented as struct with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code where the coding convention is that all structs are +# typedef'ed and only the typedef is referenced never the struct's name. + +TYPEDEF_HIDES_STRUCT = NO + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = YES + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text " + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = /var/www/htdocs/ship-simu/docs/warn.log + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = /var/www/htdocs/ship-simu/ + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.php + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = */docs/* \ + */ship-simu.org/* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = YES + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = YES + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = NO + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = YES + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = YES diff --git a/application/.htaccess b/application/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/selector/.htaccess b/application/selector/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/selector/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/selector/class_ApplicationHelper.php b/application/selector/class_ApplicationHelper.php new file mode 100644 index 0000000..19b45b7 --- /dev/null +++ b/application/selector/class_ApplicationHelper.php @@ -0,0 +1,169 @@ + + * @version 0.1 + */ +class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplication { + /** + * The version number of this application + */ + private $appVersion = ""; + + /** + * The human-readable name for this application + */ + private $appName = ""; + + /** + * The short uni*-like name of this application + */ + private $shortName = ""; + + /** + * An instance of this class + */ + private static $thisInstance = null; + + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Application-Helper"); + + // Create an unique ID + $this->createUniqueID(); + + // Tidy up a little + $this->removeSystemArray(); + } + + /** + * Getter for an instance of this class + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance () { + // Is the instance there? + if (is_null(self::$thisInstance)) { + self::$thisInstance = new ApplicationHelper(); + } + + // Return the instance + return self::$thisInstance; + } + + /** + * Getter for the version number + * + * @return $appVersion The application's version number + */ + public final function getAppVersion () { + return $this->appVersion; + } + + /** + * Setter for the version number + * + * @param $appVersion The application's version number + * @return void + */ + public final function setAppVersion ($appVersion) { + // Cast and set it + $appVersion = (string) $appVersion; + $this->appVersion = $appVersion; + } + + /** + * Getter for human-readable name + * + * @return $appName The application's human-readable name + */ + public final function getAppName () { + return $this->appName; + } + + /** + * Setter for human-readable name + * + * @param $appName The application's human-readable name + * @return void + */ + public final function setAppName ($appName) { + // Cast and set it + $appName = (string) $appName; + $this->appName = $appName; + } + + /** + * Getter for short uni*-like name + * + * @return $shortName The application's short uni*-like name + */ + public final function getAppShortName () { + return $this->shortName; + } + + /** + * Setter for short uni*-like name + * + * @param $shortName The application's short uni*-like name + * @return void + */ + public final function setAppShortName ($shortName) { + // Cast and set it + $shortName = (string) $shortName; + $this->shortName = $shortName; + } + + /** + * Launcher for the application selector + * + * @return void + * @see ApplicationSelector + */ + public final function entryPoint () { + // Get a prepared instance of ApplicationSelector + $selInstance = ApplicationSelector::createApplicationSelector(LanguageSystem::getInstance(), FileIOHandler::getInstance()); + + // Remove the ignore list from the object + $selInstance->removeDirIgnoreList(); + + // Next load all templates for the respective short app names + $selInstance->loadApplicationTemplates(); + + // Then load the selector's own template + $selInstance->loadSelectorTemplate(); + + // Insert all application templates + $selInstance->insertApplicationTemplates(); + } +} + +// [EOF] +?> diff --git a/application/selector/class_ApplicationSelector.php b/application/selector/class_ApplicationSelector.php new file mode 100644 index 0000000..bd3a86b --- /dev/null +++ b/application/selector/class_ApplicationSelector.php @@ -0,0 +1,460 @@ + + * @version 0.1 + */ +class ApplicationSelector extends BaseFrameworkSystem { + /** + * An ArrayObject for all found applications + */ + private $foundApps = null; + + /** + * An array object for all loaded application templates (selector_app-name.tpl) + */ + private $loadedTemplates = null; + + /** + * The application selector's own template engine handler + */ + private $selectorTplEngine = null; + + /** + * A list of items we shall ignore while reading from directories + */ + private $dirIgnoreList = array( + ".", + "..", + ".htaccess" + ); + + /** + * The language instance for the template loader + */ + private $langInstance = null; + + /** + * The file I/O instance for the template loader + */ + private $fileIOInstance = null; + + /** + * The private constructor. No direct instances can be created from this. + * + * @return void + */ + private function __construct() { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Applikationswechsler"); + + // Create unique ID number + $this->createUniqueID(); + + // Remove system array and thousand seperator + $this->removeSystemArray(); + $this->removeNumberFormaters(); + + // Initialize the array lists + $this->initializeAppsList(); + $this->initializeTemplatesList(); + } + + /** + * Create a prepared instance of ApplicationSelector + * + * @param $langInstance The language sub-system: LanguageSystem + * @param $fileIOInstance The file I/O instance + * @return $selInstance An instance of ApplicationSelector + */ + public static function createApplicationSelector (ManageableLanguage $langInstance, FileIOHandler $fileIOInstance) { + // Get a new instance + $selInstance = new ApplicationSelector(); + + // Get all applications + $selInstance->readApplicationDirectory(); + + // Set language and file I/O instances + $selInstance->setLanguageInstance($langInstance); + $selInstance->setFileIOInstance($fileIOInstance); + + // Return the prepared instance + return $selInstance; + } + + /** + * Initialize the application list + * + * @return void + */ + private function initializeAppsList () { + $this->foundApps = new FrameworkArrayObject(); + } + + /** + * Initialize the loaded templates list + * + * @return void + */ + private function initializeTemplatesList () { + $this->loadedTemplates = new FrameworkArrayObject(); + } + + /** + * Private getter for language instance + * + * @return $langInstance An instance to the language sub-system + */ + private function getLanguageInstance () { + return $this->langInstance; + } + + /** + * Private getter for file IO instance + * + * @return $fileIOInstance An instance to the file I/O sub-system + */ + private function getFileIOInstance () { + return $this->fileIOInstance; + } + + /** + * Prepare the template engine (TemplateEngine by default) for a give + * application helper instance (ApplicationHelper by default). + * + * @param $appInstance An application helper instance + * @return $tplEngine The template engine instance + * @throws NullPointerException If the template engine could not + * be initialized + * @throws NoObjectException If $tplEngine is not an object + * @throws MissingMethodException If $tplEngine misses a required + * method 'loadWebTemplate()' + */ + private function prepareTemplateEngine (BaseFrameworkSystem $appInstance) { + // Generate FQFN for all application templates + $fqfn = sprintf("%s%s/%s/%s", + PATH, + $this->getConfigInstance()->readConfig("application_path"), + strtolower($appInstance->getAppShortName()), + $this->getConfigInstance()->readConfig("tpl_base_path") + ); + + // Initialize the template engine + $tplEngine = null; + $eval = sprintf("\$tplEngine = %s::create%s( + \"%s\", + \$this->getLanguageInstance(), + \$this->getFileIOInstance() +);", + $this->getConfigInstance()->readConfig("tpl_engine"), + $this->getConfigInstance()->readConfig("tpl_engine"), + $fqfn + ); + + // Debug message + if ((!is_null($this->getDebugInstance())) && (defined('DEBUG_EVAL'))) { + $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + $this->__toString(), + htmlentities($eval) + )); + } + + // Run the command + @eval($eval); + + // Is it a valid instance? + if (is_null($tplEngine)) { + // No class returned + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($tplEngine)) { + // Not an object! ;-( + throw new NoObjectException($tplEngine, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($tplEngine, 'loadWebTemplate')) { + // Nope, so throw exception + throw new MissingMethodException(array($tplEngine, 'loadWebTemplate'), self::EXCEPTION_MISSING_METHOD); + } + + // Return the prepared instance + return $tplEngine; + } + + /** + * Load the init.php script of an application and append the application + * instance to $foundApps + * + * @param $initScript The FQFN of init.php + * @param $appName The application's Uni* name + * @return void + * @throws AppVarIsNotSetException If 'app' is not set + * @throws NullPointerException If 'app' is null + * @throws NoObjectException If 'app' is not an object + * @throws MissingMethodException If a required method is missing + */ + private function loadInitScript ($initScript, $appName) { + // Is it a file and readable? + if ((is_file($initScript)) && (is_readable($initScript))) { + // Then include it + include ($initScript); + + // We now should have $app re-defined! + if (!isset($app)) { + // This application shall not be loaded + return; + } elseif (is_null($app)) { + // The class instance is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($app)) { + // Not an object + throw new NoObjectException($app, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($app, $this->getConfigInstance()->readConfig("entry_method"))) { + // Method not found! + throw new MissingMethodException(array($app, $this->getConfigInstance()->readConfig("entry_method")), self::EXCEPTION_MISSING_METHOD); + } + + // Add the current instance to the list + $this->foundApps->append($app); + + } // END - if ((is_file(... + } + + /** + * Setter for the selector's template engine instance + * + * @param $tplEngine An instance of TemplateEngine + */ + private function setSelectorTemplateEngine (CompileableTemplate $tplEngine) { + $this->selectorTplEngine = $tplEngine; + } + + /** + * Getter for the selector's template engine instance + * + * @return $selectTplEngine The selector's template engine + */ + private function getSelectorTemplateEngine () { + return $this->selectorTplEngine; + } + + /** + * Getter for the $loadedTemplates array object + * + * @return $loadedTemplates An array object holding all loaded + * application templates + */ + private function getLoadedTemplates () { + return $this->loadedTemplates; + } + + /** + * Method for compatiblity with prepareTemplateEngine() + * + * @return $shortName This selector's short name + */ + private function getAppShortName() { + $shortName = $this->getConfigInstance()->readConfig("selector_path"); + return $shortName; + } + + /** + * Add a directory/file to the ignore list + * + * @param $ignoreItem The file/directory we shall ignore + * @return void + */ + public function addDirIgnoreList ($ignoreItem) { + // Cast and add it + $ignoreItem = (string) $ignoreItem; + $this->dirIgnoreList[] = $ignoreItem; + } + + /** + * Setter for language instance + * + * @param $langInstance An instance to the language sub-system + * @return void + * @see LanguageSystem + */ + public function setLanguageInstance (ManageableLanguage $langInstance) { + $this->langInstance = $langInstance; + } + + /** + * Setter for file I/O instance + * + * @param $fileIOInstance An instance to the file I/O sub-system + * @return void + */ + public function setFileIOInstance (FileIOHandler $fileIOInstance) { + $this->fileIOInstance = $fileIOInstance; + } + + /** + * Read the base path for all applications (application/) and create a + * list of all found applications + * + * @return void + */ + public function readApplicationDirectory () { + // Generate the base path for all applications + $appBasePath = sprintf("%s%s/", + PATH, + $this->getConfigInstance()->readConfig("application_path") + ); + + // Add the selector path to the ignore list + $this->addDirIgnoreList($this->getConfigInstance()->readConfig("selector_path")); + + // Get a directory pointer for the application path + $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($appBasePath); + + // Backup and remove the 'app' from global name space + /*$appBackup = $app; + unset($app);*/ + + // Read all directories&files except some parts + while ($appName = $dirInstance->readDirectoryExcept($this->dirIgnoreList)) { + // Generate FQFN for the application name (or better directory name) + $fqfn = sprintf("%s%s", $appBasePath, $appName); + + // Is this a readable directory? (files will be ignored silently) + if ((is_dir($fqfn)) && (is_readable($fqfn))) { + // Then get the init.php script for analyzing + $initScript = sprintf("%s/init%s", $fqfn, $this->getConfigInstance()->readConfig("php_extension")); + + // Load the application's init.php script and append the + // application to the ArrayObject + $this->loadInitScript($initScript, $appName); + + } // END - if ((is_dir(... + + } // END - while + + // Close directory pointer + $dirInstance->closeDirectory(); + + // Restore old 'app' from backup + //$app = $appBackup; + } + + /** + * Load all templates for found applications in previous scan + * + * @return void + */ + public function loadApplicationTemplates () { + // Iterate through all applications + for ($idx = $this->foundApps->getIterator(); $idx->valid(); $idx->next()) { + // Get current application + $appInstance = $idx->current(); + + // Prepare the template engine for the current template + $tplEngine = $this->prepareTemplateEngine($appInstance); + + // Try to load the web template + $tplEngine->loadWebTemplate(sprintf("%s_%s", + $this->getConfigInstance()->readConfig("tpl_selector_prefix"), + strtolower($appInstance->getAppShortName()) + )); + + // Remember this template and the application for later usage + $this->loadedTemplates->append(array( + 'tpl_engine' => $tplEngine, + 'app_instance' => $appInstance + )); + } + + // Re-initialize the application list to avoid double loading + $this->initializeAppsList(); + } + + /** + * Removes $dirIgnoreList from the object to save some memory + * + * @return void + */ + public function removeDirIgnoreList () { + unset($this->dirIgnoreList); + } + + /** + * Loads the selector's own main template. This step is not linking the + * application's templates into the main one. + * + * @return void + */ + public function loadSelectorTemplate () { + // Prepare the template engine + $tplEngine = $this->prepareTemplateEngine($this); + + // Load the selector's template + $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig("selector_main_tpl")); + + // Now store it in the class + $this->setSelectorTemplateEngine($tplEngine); + } + + /** + * Inserts all loaded application templates into the selector's template + * + * @return void + * @throws NullPointerException If $curr is null + * @throws NoArrayException If $curr is not an array + * @throws InvalidArrayCountException If $curr contains an + * unexpected count of elements + * @throws MissingArrayElementsException If $curr is missing expected + * array elements + */ + public function insertApplicationTemplates () { + // First prepare the instance + $tplEngine = $this->prepareTemplateEngine($this); + + // Load template which shall later hold all application templates + $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig("selector_apps_tpl")); + + // Add all loaded application templates together + $dummy = ""; + for ($idx = $this->getLoadedTemplates()->getIterator(); $idx->valid(); $idx->next()) { + // Get current item from array object + $curr = $idx->current(); + + // Do some sanity checks on the loaded item + if (is_null($curr)) { + // $curr is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_array($curr)) { + // Not an array + throw new NoArrayException($curr, self::EXCEPTION_IS_NO_ARRAY); + } elseif (count($curr) != 2) { + // Not expected count of entries + throw new InvalidArrayCountException(array($this, "curr", count($curr), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + } elseif (!isset($curr['tpl_engine']) || (!isset($curr['app_instance']))) { + // Expected entries missing + throw new MissingArrayElementsException(array($this, "curr", array('tpl_engine', 'app_instance')), self::EXCEPTION_ARRAY_ELEMENTS_MISSING); + } + die("
".print_r($curr, true)."
"); + + } // END - for + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } +} + +// [EOF] +?> diff --git a/application/selector/debug.php b/application/selector/debug.php new file mode 100644 index 0000000..2322bb5 --- /dev/null +++ b/application/selector/debug.php @@ -0,0 +1,5 @@ + diff --git a/application/selector/exceptions.php b/application/selector/exceptions.php new file mode 100644 index 0000000..c0d5422 --- /dev/null +++ b/application/selector/exceptions.php @@ -0,0 +1,7 @@ + diff --git a/application/selector/init.php b/application/selector/init.php new file mode 100644 index 0000000..a1255a9 --- /dev/null +++ b/application/selector/init.php @@ -0,0 +1,28 @@ +readConfig("app_helper_class") +); +eval($eval); + +// Set application name and version +$app->setAppName("Applikationsauswähler"); +$app->setAppVersion("0.1a"); +$app->setAppShortName(FrameworkConfiguration::getInstance()->readConfig("selector_name")); + +// Initialize output system +require(PATH . "inc/output.php"); + +// Initialize file i/o system +require(PATH . "inc/file_io.php"); + +// Include the language sub-system +require(PATH . "inc/language.php"); + +// [EOF] +?> diff --git a/application/selector/loader.php b/application/selector/loader.php new file mode 100644 index 0000000..46f5bf8 --- /dev/null +++ b/application/selector/loader.php @@ -0,0 +1,19 @@ +application nicht gefunden!"); +} + +// Load all classes +ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application)); + +// Include all classes +ClassLoader::getInstance()->includeAllClasses(); + +// Clean up the global namespace +unset($lowerClasses); +unset($class); + +// [EOF] +?> diff --git a/application/selector/starter.php b/application/selector/starter.php new file mode 100644 index 0000000..1e6e523 --- /dev/null +++ b/application/selector/starter.php @@ -0,0 +1,42 @@ +%s kann nicht gestartet werden, da die Hilfsklasse %s nicht geladen ist!", + $application, + FrameworkConfiguration::getInstance()->readConfig("app_helper_class") + )); +} elseif (!is_object($app)) { + // No object! + ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die 'app' kein Objekt ist!", + $application + )); +} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) { + // Method not found! + ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die Methode %s fehlt!", + $application, + FrameworkConfiguration::getInstance()->readConfig("entry_method") + )); +} + +// Call the entry point method +try { + $eval = sprintf("%s::getInstance()->%s();", + FrameworkConfiguration::getInstance()->readConfig("app_helper_class"), + FrameworkConfiguration::getInstance()->readConfig("entry_method") + ); + eval($eval); +} catch (FrameworkException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden. Grund: %s", + $application, + $e->getMessage() + )); +} + + +// [EOF] +?> diff --git a/application/selector/templates/.htaccess b/application/selector/templates/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/selector/templates/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/selector/templates/de/.htaccess b/application/selector/templates/de/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/selector/templates/de/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/selector/templates/de/code/.htaccess b/application/selector/templates/de/code/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/selector/templates/de/code/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/selector/templates/de/code/selector_apps.ctp b/application/selector/templates/de/code/selector_apps.ctp new file mode 100644 index 0000000..00d37a1 --- /dev/null +++ b/application/selector/templates/de/code/selector_apps.ctp @@ -0,0 +1,2 @@ + +$content[apps_list] diff --git a/application/selector/templates/de/code/selector_main.ctp b/application/selector/templates/de/code/selector_main.ctp new file mode 100644 index 0000000..6e10877 --- /dev/null +++ b/application/selector/templates/de/code/selector_main.ctp @@ -0,0 +1,15 @@ + + +{?header:title={--WELCOME_APPLICATION_SELECTOR--}?} + +{?navigation:nav_row=home;imprint;contact?} + +
+ {--HEADER_APPLICATION_SELECTOR--} +
+ +
+ {?selector_apps?} +
+ +{?footer_msg:footer_msg={--FOOTER_APPLICATION_SELECTOR--}?} diff --git a/application/ship-simu/.htaccess b/application/ship-simu/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/class_ApplicationHelper.php b/application/ship-simu/class_ApplicationHelper.php new file mode 100644 index 0000000..a177d34 --- /dev/null +++ b/application/ship-simu/class_ApplicationHelper.php @@ -0,0 +1,156 @@ + + * @version 0.1 + */ +class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplication { + /** + * The version number of this application + */ + private $appVersion = ""; + + /** + * The human-readable name for this application + */ + private $appName = ""; + + /** + * The short uni*-like name for this application + */ + private $shortName = ""; + + /** + * An instance of this class + */ + private static $thisInstance = null; + + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Application-Helper"); + + // Create an unique ID + $this->createUniqueID(); + + // Tidy up a little + $this->removeSystemArray(); + } + + /** + * Getter for an instance of this class + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance () { + // Is the instance there? + if (is_null(self::$thisInstance)) { + self::$thisInstance = new ApplicationHelper(); + } + + // Return the instance + return self::$thisInstance; + } + + /** + * Getter for the version number + * + * @return $appVersion The application's version number + */ + public final function getAppVersion () { + return $this->appVersion; + } + + /** + * Setter for the version number + * + * @param $appVersion The application's version number + * @return void + */ + public final function setAppVersion ($appVersion) { + // Cast and set it + $appVersion = (string) $appVersion; + $this->appVersion = $appVersion; + } + + /** + * Getter for human-readable name + * + * @return $appName The application's human-readable name + */ + public final function getAppName () { + return $this->appName; + } + + /** + * Setter for human-readable name + * + * @param $appName The application's human-readable name + * @return void + */ + public final function setAppName ($appName) { + // Cast and set it + $appName = (string) $appName; + $this->appName = $appName; + } + + /** + * Getter for short uni*-like name + * + * @return $shortName The application's short uni*-like name + */ + public final function getAppShortName () { + return $this->shortName; + } + + /** + * Setter for short uni*-like name + * + * @param $shortName The application's short uni*-like name + * @return void + */ + public final function setAppShortName ($shortName) { + // Cast and set it + $shortName = (string) $shortName; + $this->shortName = $shortName; + } + + /** + * Launches the ship-simulator game + * + * @return void + */ + public final function entryPoint () { + // Must still be implemented! + trigger_error(__METHOD__.": Not implemented yet!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/debug.php b/application/ship-simu/debug.php new file mode 100644 index 0000000..5c6e9c8 --- /dev/null +++ b/application/ship-simu/debug.php @@ -0,0 +1,40 @@ + diff --git a/application/ship-simu/exceptions.php b/application/ship-simu/exceptions.php new file mode 100644 index 0000000..df23634 --- /dev/null +++ b/application/ship-simu/exceptions.php @@ -0,0 +1,7 @@ + diff --git a/application/ship-simu/exceptions/.htaccess b/application/ship-simu/exceptions/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/exceptions/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/exceptions/class_BirthdayInvalidException.php b/application/ship-simu/exceptions/class_BirthdayInvalidException.php new file mode 100644 index 0000000..032d5e4 --- /dev/null +++ b/application/ship-simu/exceptions/class_BirthdayInvalidException.php @@ -0,0 +1,25 @@ +%s ist leider falsch.", + date("d.m.Y", mktime( + 0, 0, 0, + $birthArray[1], + $birthArray[2], + $birthArray[0] + )) + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_CabinShipMismatchException.php b/application/ship-simu/exceptions/class_CabinShipMismatchException.php new file mode 100644 index 0000000..25890a9 --- /dev/null +++ b/application/ship-simu/exceptions/class_CabinShipMismatchException.php @@ -0,0 +1,8 @@ + diff --git a/application/ship-simu/exceptions/class_ContractAllreadySignedException.php b/application/ship-simu/exceptions/class_ContractAllreadySignedException.php new file mode 100644 index 0000000..03b4f6e --- /dev/null +++ b/application/ship-simu/exceptions/class_ContractAllreadySignedException.php @@ -0,0 +1,22 @@ +%s und %s haben den Vertrag bereits unterzeichnet!", + $classArray[0]->__toString(), + $classArray[1]->getCompanyName(), + $classArray[2]->getCompanyName() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_ContractPartnerMismatchException.php b/application/ship-simu/exceptions/class_ContractPartnerMismatchException.php new file mode 100644 index 0000000..2195fbb --- /dev/null +++ b/application/ship-simu/exceptions/class_ContractPartnerMismatchException.php @@ -0,0 +1,22 @@ +%s ist ungütig (%s) und darf diesen Vertrag nicht unterzeichnen!", + $classArray[0]->__toString(), + $classArray[1]->getCompanyName(), + $classArray[2]->getCompanyName() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_DeckShipMismatchException.php b/application/ship-simu/exceptions/class_DeckShipMismatchException.php new file mode 100644 index 0000000..f4967aa --- /dev/null +++ b/application/ship-simu/exceptions/class_DeckShipMismatchException.php @@ -0,0 +1,8 @@ + diff --git a/application/ship-simu/exceptions/class_EmptyStructuresListException.php b/application/ship-simu/exceptions/class_EmptyStructuresListException.php new file mode 100644 index 0000000..d84efb7 --- /dev/null +++ b/application/ship-simu/exceptions/class_EmptyStructuresListException.php @@ -0,0 +1,17 @@ +__toString() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_InvalidContractPartnerException.php b/application/ship-simu/exceptions/class_InvalidContractPartnerException.php new file mode 100644 index 0000000..0b1c304 --- /dev/null +++ b/application/ship-simu/exceptions/class_InvalidContractPartnerException.php @@ -0,0 +1,18 @@ +%s ist kein gütiger Vertragspartner.", + $class->__toString(), + $class->getPartDescr() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_InvalidIDFormatException.php b/application/ship-simu/exceptions/class_InvalidIDFormatException.php new file mode 100644 index 0000000..3ce2e0d --- /dev/null +++ b/application/ship-simu/exceptions/class_InvalidIDFormatException.php @@ -0,0 +1,17 @@ +__toString() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_ItemNotInPriceListException.php b/application/ship-simu/exceptions/class_ItemNotInPriceListException.php new file mode 100644 index 0000000..500ba92 --- /dev/null +++ b/application/ship-simu/exceptions/class_ItemNotInPriceListException.php @@ -0,0 +1,18 @@ +%s %s nicht gefunden.", + $class->__toString(), + $class->getPartDescr() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_ItemNotTradeableException.php b/application/ship-simu/exceptions/class_ItemNotTradeableException.php new file mode 100644 index 0000000..a83485f --- /dev/null +++ b/application/ship-simu/exceptions/class_ItemNotTradeableException.php @@ -0,0 +1,18 @@ +%s ist nicht handelbar!", + $classArray[0]->__toString(), + $classArray[1]->getPartDescr() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_MissingSimulatorIDException.php b/application/ship-simu/exceptions/class_MissingSimulatorIDException.php new file mode 100644 index 0000000..d656dde --- /dev/null +++ b/application/ship-simu/exceptions/class_MissingSimulatorIDException.php @@ -0,0 +1,18 @@ +%s scheint ungültig zu sein.", + $classArray[0]->__toString(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_MotorShipMismatchException.php b/application/ship-simu/exceptions/class_MotorShipMismatchException.php new file mode 100644 index 0000000..ce48791 --- /dev/null +++ b/application/ship-simu/exceptions/class_MotorShipMismatchException.php @@ -0,0 +1,8 @@ + diff --git a/application/ship-simu/exceptions/class_NoShipyardsConstructedException.php b/application/ship-simu/exceptions/class_NoShipyardsConstructedException.php new file mode 100644 index 0000000..32e1339 --- /dev/null +++ b/application/ship-simu/exceptions/class_NoShipyardsConstructedException.php @@ -0,0 +1,22 @@ +__toString() + ); + } else { + // No class given + $message = sprintf("Please provide a class for %s", __CLASS__); + } + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_PersonellListAlreadyCreatedException.php b/application/ship-simu/exceptions/class_PersonellListAlreadyCreatedException.php new file mode 100644 index 0000000..3ac9078 --- /dev/null +++ b/application/ship-simu/exceptions/class_PersonellListAlreadyCreatedException.php @@ -0,0 +1,17 @@ +__toString() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_RoomShipMismatchException.php b/application/ship-simu/exceptions/class_RoomShipMismatchException.php new file mode 100644 index 0000000..19d5eed --- /dev/null +++ b/application/ship-simu/exceptions/class_RoomShipMismatchException.php @@ -0,0 +1,8 @@ + diff --git a/application/ship-simu/exceptions/class_ShipNotConstructedException.php b/application/ship-simu/exceptions/class_ShipNotConstructedException.php new file mode 100644 index 0000000..07b9bb9 --- /dev/null +++ b/application/ship-simu/exceptions/class_ShipNotConstructedException.php @@ -0,0 +1,8 @@ + diff --git a/application/ship-simu/exceptions/class_ShipPartNotConstructableException.php b/application/ship-simu/exceptions/class_ShipPartNotConstructableException.php new file mode 100644 index 0000000..338386e --- /dev/null +++ b/application/ship-simu/exceptions/class_ShipPartNotConstructableException.php @@ -0,0 +1,17 @@ +%s ist nicht constrierbar!", + $partArray[0] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_StructureShipMismatchException.php b/application/ship-simu/exceptions/class_StructureShipMismatchException.php new file mode 100644 index 0000000..273c405 --- /dev/null +++ b/application/ship-simu/exceptions/class_StructureShipMismatchException.php @@ -0,0 +1,8 @@ + diff --git a/application/ship-simu/exceptions/class_StructuresOutOfBoundsException.php b/application/ship-simu/exceptions/class_StructuresOutOfBoundsException.php new file mode 100644 index 0000000..8b5d4cd --- /dev/null +++ b/application/ship-simu/exceptions/class_StructuresOutOfBoundsException.php @@ -0,0 +1,15 @@ +%s liegt ausserhalb des gütigen Bereiches! Schiffsteil nicht auffindbar.", $idx); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_ToMuchEmployeesException.php b/application/ship-simu/exceptions/class_ToMuchEmployeesException.php new file mode 100644 index 0000000..227c379 --- /dev/null +++ b/application/ship-simu/exceptions/class_ToMuchEmployeesException.php @@ -0,0 +1,21 @@ +%d Leute nicht einstellbar, da nur %d arbeitslos sind!", + $amountArray[0], + $amountArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_TotalPriceNotCalculatedException.php b/application/ship-simu/exceptions/class_TotalPriceNotCalculatedException.php new file mode 100644 index 0000000..c649bed --- /dev/null +++ b/application/ship-simu/exceptions/class_TotalPriceNotCalculatedException.php @@ -0,0 +1,17 @@ +__toString() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_UnsupportedLimitationPartException.php b/application/ship-simu/exceptions/class_UnsupportedLimitationPartException.php new file mode 100644 index 0000000..152a898 --- /dev/null +++ b/application/ship-simu/exceptions/class_UnsupportedLimitationPartException.php @@ -0,0 +1,15 @@ +%s wird derzeit nicht unterstützt.", $str); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php b/application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php new file mode 100644 index 0000000..ae12ce5 --- /dev/null +++ b/application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php @@ -0,0 +1,15 @@ +%s Ist nicht M (Männlich) oder F (Weiblich).", $gender); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/init.php b/application/ship-simu/init.php new file mode 100644 index 0000000..0446060 --- /dev/null +++ b/application/ship-simu/init.php @@ -0,0 +1,40 @@ +isClass("ApplicationSelector"))) { return; } +// +// isset() is required to prevent a warning and is_object() is highly required +// when the application itself is requested in URL (hint: index.php?app=your_app) +// +// Get an instance of the helper +$eval = sprintf("\$app = %s::getInstance();", + FrameworkConfiguration::getInstance()->readConfig("app_helper_class") +); +eval($eval); + +// Set application name and version +$app->setAppName("Ship-Simu Schiffsimulator"); +$app->setAppVersion("0.1"); +$app->setAppShortName("ship-simu"); + +// Initialize output system +require(PATH . "inc/output.php"); + +// Initialize file i/o system +require(PATH . "inc/file_io.php"); + +// Include the language sub-system +require(PATH . "inc/language.php"); + +// This application needs a database connection then we have to simply include +// the inc/database.php script +require(PATH . "inc/database.php"); + +// [EOF] +?> diff --git a/application/ship-simu/interfaces/.htaccess b/application/ship-simu/interfaces/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/interfaces/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/interfaces/class_ConstructableShip.php b/application/ship-simu/interfaces/class_ConstructableShip.php new file mode 100644 index 0000000..9804433 --- /dev/null +++ b/application/ship-simu/interfaces/class_ConstructableShip.php @@ -0,0 +1,12 @@ + + * @version 0.1 + */ +interface ConstructableShip extends FrameworkInterface { +} + +// [EOF] +?> diff --git a/application/ship-simu/interfaces/class_ConstructableShipPart.php b/application/ship-simu/interfaces/class_ConstructableShipPart.php new file mode 100644 index 0000000..0721b8c --- /dev/null +++ b/application/ship-simu/interfaces/class_ConstructableShipPart.php @@ -0,0 +1,12 @@ + + * @version 0.1 + */ +interface ConstructableShipPart extends FrameworkInterface { +} + +// [EOF] +?> diff --git a/application/ship-simu/interfaces/class_ContractPartner.php b/application/ship-simu/interfaces/class_ContractPartner.php new file mode 100644 index 0000000..9b1bb8c --- /dev/null +++ b/application/ship-simu/interfaces/class_ContractPartner.php @@ -0,0 +1,20 @@ + + * @version 0.1 + */ +interface ContractPartner extends FrameworkInterface { + /** + * This is a contract partner + * + * @param $contractInstance Must be a valid instance of WorksContract + * @return boolean true = can be a contract partner, + * false = no partner for contracts + */ + function isContractPartner (WorksContract $contractInstance); +} + +// [EOF] +?> diff --git a/application/ship-simu/interfaces/class_Customer.php b/application/ship-simu/interfaces/class_Customer.php new file mode 100644 index 0000000..a49150e --- /dev/null +++ b/application/ship-simu/interfaces/class_Customer.php @@ -0,0 +1,46 @@ + + * @version 0.1 + */ +interface Customer extends FrameworkInterface { + /** + * Adds a contract to the customer's list + * + * @param $contractInstance A valid instance to WorksContract + * @return void + */ + function addNewWorksContract (WorksContract $contractInstance); + + /** + * Signs a works contract. + * + * @param $contractInstance A valid instance to WorksContract + * @param $partnerInstance An instance the other + * contract partner + * @return void + * @throws NullPointerException If an instance variable + * is null + * @throws NoObjectException If an instance variable + * is not an object + * @throws MissingMethodException If a required method was + * not found in $contractInstance + * @throws InvalidContractPartnerException If the in $contractInstance + * set contract partner is + * not the expected + */ + function signContract (WorksContract $contractInstance, ContractPartner $partnerInstance); + + /** + * Withdraw from a signed contract + * + * @param $contractInstance A valid instance to WorksContract + * @return void + */ + function withdrawFromContract (WorksContract $contractInstance); +} + +// [EOF] +?> diff --git a/application/ship-simu/interfaces/class_ItemIsTradeable.php b/application/ship-simu/interfaces/class_ItemIsTradeable.php new file mode 100644 index 0000000..8952000 --- /dev/null +++ b/application/ship-simu/interfaces/class_ItemIsTradeable.php @@ -0,0 +1,19 @@ + + * @version 0.1 + */ +interface ItemIsTradeable extends FrameworkInterface { + /** + * Is this item (=object) tradeable? + * + * @return boolean true = is a tradeable object, + * false = is not tradeable + */ + function isTradeable (); +} + +// [EOF] +?> diff --git a/application/ship-simu/interfaces/class_Personellizer.php b/application/ship-simu/interfaces/class_Personellizer.php new file mode 100644 index 0000000..f4474e7 --- /dev/null +++ b/application/ship-simu/interfaces/class_Personellizer.php @@ -0,0 +1,184 @@ + + * @version 0.1 + */ +interface Personellizer extends FrameworkInterface { + /////////////////////// + /// General methods /// + /////////////////////// + + /** + * Remove min/max age + * + * @return void + */ + function removeMinMaxAge (); + + /** + * Create a valid birthday + * + * @return void + */ + function createBirthday (); + + /** + * Verify if given year/month/day is a valid date combination + * + * @param $year 4-digit year (valid : 2007, 1946, + * invalid: 24, 2a, aa) + * @param $month 1 to 2-digit month (range: 1 to 12) + * @param $day 1 to 2-digit day (range: 1 to 31/30/29/28) + * @return boolean true = date is valid, + * false = date is invalid + */ + function isDateValid ($year, $month, $day); + + ///////////////////////// + //// Status requests //// + ///////////////////////// + + /** + * Is the person employed? + * + * @return boolean true = person is employed + * false = person is umemployed + */ + function isEmployed (); + + /** + * Is the person married? (to which one doesn't matter here) + * + * @return boolean true = person is married + * false = person is not married + */ + function isMarried (); + + /** + * Is the person a male? + * + * @return boolean true = person is male + * false = person is not male (maybe female? ;-)) + */ + function isMale (); + + /** + * Is the person a female? + * + * @return boolean true = person is female + * false = person is not female (maybe male? ;-)) + */ + function isFemale (); + + ///////////////// + //// Getters //// + ///////////////// + + /** + * Getter for surname + * + * @return $surname The person's surname + */ + function getSurname (); + + /** + * Getter for family name + * + * @return $family The person's family name + */ + function getFamily (); + + /** + * Getter for gender + * + * @return $gender The person's gender (F/M) + */ + function getGender (); + + /** + * Getter for salary + * + * @return $salary The person's current salary + */ + function getSalary (); + + ///////////////// + //// Setters //// + ///////////////// + + /** + * Setter for surname + * + * @param $surname The person's new surname as a string + * @return void + */ + function setSurname ($surname); + + /** + * Setter for family name + * + * @param $family The person's new family name as a string + * @return void + */ + function setFamily ($family); + + /** + * Setter for gender. Do not use this so often... ;-) + * This method shall only be used when the person is "created" + * + * @param $gender The person's new gender as a 1-char string (M/F) + * @return void + */ + function setGender ($gender); + + /** + * Setter for employment status + * + * @param $employed The person's new employment stats + * @return void + */ + function setEmployed ($employed); + + /** + * Setter for marrital status + * + * @param $married The person's new marrital status + * @return void + */ + function setMarried ($married); + + /** + * Setter for a already validated birthday. + * + * @param $year The person's new year-of-birth (4 digits) + * @param $month The person's new month-of-birth (1 to 2 digits) + * @param $day The person's new day-of-birth (1 to 2 digits) + * @return void + */ + function setBirthday ($year, $month, $day); + + ///////////////////////////////////// + //// Methods for changing salary //// + ///////////////////////////////////// + + /** + * Increase person's salary by a specified amount + * + * @param $add Add this float amount to current salary + * @return void + */ + function increaseSalary ($add); + + /** + * Decrease person's salary by a specified amount + * + * @param $sub Subtract this float amount to current salary + * @return void + */ + function decreaseSalary ($sub); +} + +// [EOF] +?> diff --git a/application/ship-simu/loader.php b/application/ship-simu/loader.php new file mode 100644 index 0000000..41dca7d --- /dev/null +++ b/application/ship-simu/loader.php @@ -0,0 +1,44 @@ +application nicht gefunden!"); +} + +// Load all classes for the application +foreach ($lowerClasses as $class) { + // Try to load the application classes + try { + ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application, $class)); + } catch (PathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", + $class, + $e->getMessage() + )); + } catch (PathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", + $class, + $e->getMessage() + )); + } catch (PathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", + $class, + $e->getMessage() + )); + } catch (DirPointerNotOpenedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", + $class, + $e->getMessage() + )); + } +} + +// Include all classes +ClassLoader::getInstance()->includeAllClasses(); + +// Clean up the global namespace +unset($lowerClasses); +unset($class); + +// [EOF] +?> diff --git a/application/ship-simu/main/.htaccess b/application/ship-simu/main/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/class_ b/application/ship-simu/main/class_ new file mode 100644 index 0000000..9644fd5 --- /dev/null +++ b/application/ship-simu/main/class_ @@ -0,0 +1,7 @@ + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + die("limitObject() reached! Stub!"); + } diff --git a/application/ship-simu/main/class_BasePersonell.php b/application/ship-simu/main/class_BasePersonell.php new file mode 100644 index 0000000..6f78c65 --- /dev/null +++ b/application/ship-simu/main/class_BasePersonell.php @@ -0,0 +1,240 @@ +getDebugInstance()->output("[PersonellBase:] Konstruktor erreicht.
\n"); + + // Beschreibung setzen + $this->setPartDescr("Personal"); + } + + // Calls the constructor + public function constructor ($class) { + $this->__construct($class); + } + + // Remove min/max ages + public final function removeMinMaxAge () { + if (defined('DEBUG_PERSONELL')) $this->getDebugInstance()->output(sprintf("[%s:%d] Minimum-/Maximum-Alter entfernt.
\n", + __CLASS__, + __LINE__ + )); + unset($this->MIN_AGE); + unset($this->MAX_AGE); + } + + // Generates a birthday based on MAX_AGE/MIN_AGE and the current date + public final function createBirthday () { + // Is the birthday already set? + if ($this->isDateValid($this->yearBirth, $this->monthBirth, $this->dayBirth)) return false; + + // Get current year + $currYear = date("Y", time()); + + // Generate random year/month/day + $year = mt_rand(($currYear - $this->MIN_AGE), ($currYear - $this->MAX_AGE)); + $month = 0; + $day = 0; + while (!$this->isDateValid($year, $month, $day)) { + $month = mt_rand(1, 12); + switch ($month) { + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: + $day = mt_rand(1, 31); + break; + + case 4: + case 6: + case 9: + case 11: + $day = mt_rand(1, 30); + break; + + case 2: // February + if ($year % 4 == 0) { + // Is a "Schaltjahr" + $day = mt_rand(1, 29); + } else { + // Regular year + $day = mt_rand(1, 28); + } + break; + } // switch - END + } // while - END + + // Set the new birthday + $this->setBirthday($year, $month, $day); + } + + // Is the current day valid? + public final function isDateValid ($year, $month, $day) { + // Create timestamp + $stamp = mktime(0, 0, 0, $month, $day, $year); + + // Get year/month/day back + $y = date("Y", $stamp); + $m = date("m", $stamp); + $d = date("d", $stamp); + + // Compare all + return (($y == $year) && ($m == $month) && ($d == $day)); + } + + // Employed? + public final function isEmployed () { + return $this->employed; + } + + // Married? + public final function isMarried () { + return $this->married; + } + + // Male? + public final function isMale () { + return ($this->gender == "M"); + } + + // Female + public final function isFemale () { + return ($this->gender == "F"); + } + + // Setter for surname + public final function setSurname ($surname) { + $this->surname = (string) $surname; + } + + // Getter for surname + public function getSurname () { + return $this->surname; + } + + // Setter for family name + public final function setFamily ($family) { + $this->family = (string) $family; + } + + // Getter for family name + public final function getFamily () { + return $this->family; + } + + // Setter for gender + public final function setGender ($gender) { + // Set random gender here + if (($gender == "M") || ($gender == "F") || ((empty($gender)) && ($this->getSurname() == ""))) { + $this->gender = $gender; + } else { + throw new WrongGenderSpecifiedException($gender, self::EXCEPTION_GENDER_IS_WRONG); + } + } + + // Getter for gender + public final function getGender () { + return $this->gender; + } + + // Setter for employment status + public final function setEmployed ($employed) { + $this->employed = (boolean) $employed; + } + + // Setter for marriage status + public final function setMarried ($married) { + $this->married = (boolean) $married; + } + + // Getter for salary + public final function getSalary () { + return $this->salary; + } + + // Increase salary + public final function increaseSalary ($add) { + $this->salary += (float) abs($add); + } + + // Decrease salary + public final function decreaseSalary ($sub) { + $this->salary -= (float) abs($sub); + } + + // Setter for birthday + public final function setBirthday ($year, $month, $day) { + $this->yearBirth = (int) abs($year); + $this->monthBirth = (int) abs($month); + $this->dayBirth = (int) abs($day); + } + + // Remove gender + public function removeGender () { + unset($this->gender); + } + + // Remove both names + public function removeNames () { + unset($this->surname); + unset($this->family); + } + + // Remove complete birthday + public function removeBirthday () { + unset($this->yearBirth); + unset($this->monthBirth); + unset($this->dayBirth); + } + + // Remove salary + public function removeSalary () { + unset($this->salary); + } + + // Remove employment status + public function removeEmployed () { + unset($this->employed); + } + + // Remove marrital status + public function removeMarried () { + unset($this->married); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/class_BaseSimulator.php b/application/ship-simu/main/class_BaseSimulator.php new file mode 100644 index 0000000..4726d29 --- /dev/null +++ b/application/ship-simu/main/class_BaseSimulator.php @@ -0,0 +1,392 @@ + 1, + 'height' => 1, + 'length' => 1 + ); + + // Konstruktor + private function __construct ($class) { + // Call highest constructor + parent::constructor($class); + + if ((defined('DEBUG_CORE')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Set part description and class name + $this->setPartDescr("Simulator-Basis-Einheit"); + + // Etwas aufraeumen, dies sollte ganz zum Schluss erfolgen! + $this->removeResizeFactorArray(); + $this->removeCurrPart(); + $this->removeCurrShip(); + } + + // Public constructor + public function constructor ($class) { + // Call real constructor + $this->__construct($class); + } + + // Magic __isset method + private function __isset ($var) { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Checking %s in class.
\n", + $this->__toString(), $var + )); + return isset($this->$var); + } + + // Magic __unset method + private function __unset($var) { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Removing %s from class.
\n", + $this->__toString(), $var + )); + unset($this->$var); + } + + // Setter-Methode fuer Laenge + public function setLength ($length) { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Länge gesetzt.
\n", + $this->__toString(), + $length + )); + $this->length = (float) $length; + } + + // Setter-Methode fuer Breite + public function setWidth ($width) { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Breite gesetzt.
\n", + $this->__toString(), + $width + )); + $this->width = (float) $width; + } + + // Setter-Methode fuer Hoehe + public function setHeight ($height) { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Höhe gesetzt.
\n", + $this->__toString(), + $height + )); + $this->height = (float) $height; + } + + // Getter-Methode fuer Laenge + public function getLength () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge angefordert.
\n", + $this->__toString() + )); + return $this->length; + } + + // Getter-Methode fuer Breite + public function getWidth () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge angefordert.
\n", + $this->__toString() + )); + return $this->width; + } + + // Getter-Methode fuer Hoehe + public function getHeight () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe angefordert.
\n", + $this->__toString() + )); + return $this->height; + } + + // Setter-Methode fuer Teil-Instanz + public function setPartInstance ($struct) { + $this->partInstance = (Object) $struct; + } + + // Getter-Methode fuer Teil-Instanz + public function getPartInstance () { + if (!isset($this->partInstance)) { + return null; + } + return $this->partInstance; + } + + // Remover-Methode fuer die Teil-Instanz + public function removePartInstance () { + if ($this->getPartInstance() !== null) { + // Warnung ausgeben + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] partInstance ist nicht null! Instanz-Attribut wird nicht entfernt.
\n", + $this->__toString() + )); + } else { + // Leere Instanz kann entfernt werden + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] partInstance wurde entfernt.
\n", + $this->__toString() + )); + unset($this->partInstance); + } + } + + // Prueft ob all Umberechnungsfaktoren gesetzt sind + private function isResizeFactorValid () { + return (($this->getResizeFactorElement('width') > 1) + || ($this->getResizeFactorElement('height') > 1) + || ($this->getResizeFactorElement('length') > 1) + ); + } + + // Baut einen Motor in das Schiff ein + public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $partInstance) { + // Schiff/-steil merken + $this->currShip = $shipInstance; + $this->currPart = $partInstance; + + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Maschinenraum mit Motor %s wird fuer das Schiff %s konstruiert.
\n", + $this->__toString(), + $this->currPart->getPartDescr(), + $this->currShip->getShipName() + )); + + // Passt ueberhaupt das Schiffsteil in's Schiff? + if ($this->isShipPartSizeValid()) { + // Berechnungen fuer umliegendes Objekt anpassen + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil %s vom Typ %s passt in das Schiff %s hinein.
\n", + $this->__toString(), + $this->currPart->getPartDescr(), + $this->currPart->__toString(), + $this->currShip->getShipName() + )); + + // Muessen die Masse angepasst werden? + if ($this->isResizeFactorValid()) { + // Neue Angaben berechnen (wir lassen etwas Lust fuer Kabelbaeume, Roehren, Maschinisten, etc.) + $this->newWidth = (float) $this->currPart->getWidth() * $this->resizeFactorArray['width']; + $this->newHeight = (float) $this->currPart->getHeight() * $this->resizeFactorArray['height']; + $this->newLength = (float) $this->currPart->getLength() * $this->resizeFactorArray['length']; + + // Passt dies nun immer noch? + if ($this->isNewSizeValid()) { + // Das passt auch, dann Werte setzen und Motor-Instanz merken + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil %s passt in das Schiff %s hinein.
\n", + $this->__toString(), + $this->getPartDescr(), + $this->currShip->getShipName() + )); + $this->setWidth($this->newWidth); + $this->setHeight($this->newHeight); + $this->setLength($this->newLength); + + // Einige Dinge entfernen... + $this->removeAllNewAttr(); + } else { + // Passt nicht! Also wieder Exception werfen... + throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil %s vom Typ %s ist zu gross für das Schiff!", + $this->currPart->__toString(), + $this->currPart->getPartDescr(), + $this->currPart->__toString() + ), 2); + } + } elseif ($this->currPart != null) { + // Aktuelle Masse setzen + $this->setWidth($this->currPart->getWidth()); + $this->setHeight($this->currPart->getHeight()); + $this->setLength($this->currPart->getLength()); + } + + // Existiert ein Schiffsteil? + if (!is_null($this->currPart)) { + // Debug-Meldung ausgeben + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Schiffsteil %s gefunden.
\n", + $this->currPart->realClass, + $this->currPart->getPartDescr() + )); + + // Schiffsteil-Instanz setzen + $this->setPartInstance($this->currPart); + + // Instanzen entfernen + $this->currPart->removeCurrShip(); + $this->currPart->removeCurrPart(); + $this->currPart->removePartInstance(); + $this->currPart->removeResizeFactorArray(); + } + } else { + // Exception werfen! + throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil %s vom Typ %s passt nicht in das Schiff!", + $this->currPart->realClass, + $this->currPart->getPartDescr(), + $this->currPart->__toString() + ), 1); + } + + // Nochmals etwas aufraeumen + $this->removeResizeFactorArray(); + $this->removeCurrShip(); + $this->removeCurrPart(); + } + + // Array fuer Umrechnungstabelle entfernen + public function removeResizeFactorArray () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeResizeFactor erreicht.
\n", + $this->__toString() + )); + unset($this->resizeFactorArray); + } + + // Alle newXXX-Attribute entfernen + public function removeAllNewAttr () { + unset($this->newWidth); + unset($this->newHeight); + unset($this->newLength); + } + + // Aktuelle Schiff-Instanz entfernen + public function removeCurrShip () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrShip erreicht.
\n", + $this->__toString() + )); + unset($this->currShip); + } + + // Aktuelle Schiff-Instanz entfernen + public function removeCurrPart () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrPart erreicht.
\n", + $this->__toString() + )); + unset($this->currPart); + } + + // Breite entfernen + public function removeWidth () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Breite entfernt.
\n", + $this->__toString() + )); + unset($this->width); + } + + // Hoehe entfernen + public function removeHeight () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe entfernt.
\n", + $this->__toString() + )); + unset($this->height); + } + + // Laenge entfernen + public function removeLength () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge entfernt.
\n", + $this->__toString() + )); + unset($this->length); + } + + // Tiefgang entfernen + public function removeDraught () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Tiefgang entfernt.
\n", + $this->__toString() + )); + unset($this->draught); + } + + // Getter-Methode fuer Element aus resizeFactor + public function getResizeFactorElement ($el) { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] getResizeFactorElement erreicht. (element=%s)
\n", + $this->__toString(), + $el + )); + if (isset($this->resizeFactorArray[$el])) { + // Element gefunden + return $this->resizeFactorArray[$el]; + } else { + // Element nicht gefunden! + return 0; + } + } + + // Setter-Methode fuer Element in resizeFactor + public function setResizeFactorElement ($el, $value) { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Umberechnungsfaktor %s=%s gesetzt.
\n", + $this->__toString(), + $el, + $value + )); + $this->resizeFactorArray[$el] = (float) $value; + } + + // Kontrolliert, ob die Abmasse Schiffsteil->Schiff stimmen + public function isShipPartSizeValid () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] isShipPartSizeValid erreicht.
\n", + $this->__toString() + )); + return ( + ( + ( // Already defined ship messurings + ($this->currPart->getWidth() < $this->currShip->getWidth()) + && ($this->currPart->getHeight() < $this->currShip->getDraught()) + && ($this->currPart->getLength() < $this->currShip->getLength()) + ) || ( // Ship messurings shall be calculated + ($this->currShip->getWidth() == 0) + && ($this->currShip->getHeight() == 0) + && ($this->currShip->getLength() == 0) + ) + // The inserted part must be messured! + ) && ($this->currPart->getWidth() > 0) + && ($this->currPart->getHeight() > 0) + && ($this->currPart->getLength() > 0) + ); + } + + // Kontrolliert, ob die Abmasse Maschinenraum->Schiff stimmen + public function isNewSizeValid () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] isNewSizeValid erreicht.
\n", + $this->__toString() + )); + return ( + ( // Already defined ship messurings + ($this->newWidth < $this->currShip->getWidth()) + && ($this->newHeight < $this->currShip->getDraught()) + && ($this->newLength < $this->currShip->getLength()) + ) || ( // Ship messurings shall be calculated + ($this->currShip->getWidth() == 0) + && ($this->currShip->getHeight() == 0) + && ($this->currShip->getLength() == 0) + ) + ); + } + + // Masse extrahieren + public function extractDimensions ($dim) { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] extractDimensions erreicht für %s.
\n", + $this->__toString(), + $this->getPartDescr() + )); + + // Abmasse setzen + if ((isset($dim)) && (is_array($dim)) && (count($dim) == 3)) { + // Abmasse aus Array holen + $this->setWidth($dim[0]); + $this->setHeight($dim[1]); + $this->setLength($dim[2]); + } else { + // Nicht gefundene Abmasse! + throw new DimNotFoundInArrayException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); + } + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/class_Merchant.php b/application/ship-simu/main/class_Merchant.php new file mode 100644 index 0000000..1ef6dbd --- /dev/null +++ b/application/ship-simu/main/class_Merchant.php @@ -0,0 +1,188 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Händler"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Haendler mit Namen erzeugen + public static function createMerchant ($merchantName, Harbor $harborInstance) { + // String absichern + $merchantName = (string) $merchantName; + + // Instanz holen + $merchantInstance = new Merchant(); + + // Debug message + if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) { + $merchantInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Händler %s wird angelegt und soll sich am %s niederlassen.
\n", + __CLASS__, + __LINE__, + $merchantName, + $harborInstance->getHarborName() + )); + } + + // Haendlernamen setzen + $merchantInstance->setMerchantName($merchantName); + + // In dem angegebenen Hafen den Haendler ansiedeln + $merchantInstance->setHarborInstance($harborInstance); + + // Preisliste initialisieren + $merchantInstance->createPriceList(); + + // Instanz zurueckliefern + return $merchantInstance; + } + + // Initialize pricing list + private function createPriceList () { + if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler %s erhält eine leere Preisliste.
\n", + __CLASS__, + __LINE__, + $this->getMerchantName() + )); + $this->priceList = new FrameworkArrayObject(); + } + + // Setter for merchant name + public function setMerchantName ($merchantName) { + // Secure string + $merchantName = (string) $merchantName; + + // Debug message + if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händlername %s ist nun bekannt.
\n", + __CLASS__, + __LINE__, + $merchantName + )); + $this->merchantName = $merchantName; + } + + // Getter for merchant name + public function getMerchantName () { + if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händlername %s wird verlangt.
\n", + __CLASS__, + __LINE__, + $this->merchantName + )); + return $this->merchantName; + } + + // Setter for harbor instance + public function setHarborInstance (Harbor $harborInstance) { + if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler %s lässt sich am %s nieder.
\n", + __CLASS__, + __LINE__, + $this->getMerchantName(), + $harborInstance->getHarborName() + )); + $this->harborInstance = $harborInstance; + } + + // Getter for harbor instance + public function getHarborInstance () { + if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler %s hat sich am %s niedergelassen.
\n", + __CLASS__, + __LINE__, + $this->getMerchantName(), + $harborInstance->getHarborName() + )); + return $this->harborInstance; + } + + // Add new item to merchant's price list + public function addItemToPriceList (ItemIsTradeable $itemInstance, $price) { + // Secure pricing + $price = (float) $price; + + // Debug message + if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler %s kann nun das Schiffsteil %s "%s" zu %s verkaufen.
\n", + __CLASS__, + __LINE__, + $this->getMerchantName(), + $itemInstance->__toString(), + $itemInstance->getPartDescr(), + $this->formatCurrency($price) + )); + + // Construct pricing item and add it to the list + $this->priceList->append(array( + 'item' => $itemInstance, + 'price' => $price + )); + + // Remove price attribute + $itemInstance->removePrice(); + } + + // Get a price from the merchant's list + public function getPriceFromList (ItemIsTradeable $itemInstance) { + $price = 0; + + // Iterate throw whole list + for ($iter = $this->priceList->getIterator(); $iter->valid(); $iter->next()) { + // Get current item + $item = $iter->current(); + + // Does this item match? The unique ID may not work... + if ($item['item']->itemMatches($itemInstance)) { + // Extract price and stop searching + $price = $item['price']; + break; + } + } + + // Was the item found? + if ($price === 0) { + // Throw exception + throw new ItemNotInPriceListException($itemInstance, self::EXCEPTION_ITEM_NOT_IN_PRICE_LIST); + } + + // Return price + return $price; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/class_WorksContract.php b/application/ship-simu/main/class_WorksContract.php new file mode 100644 index 0000000..961ef17 --- /dev/null +++ b/application/ship-simu/main/class_WorksContract.php @@ -0,0 +1,444 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Bauvertrag"); + + // Unique-ID generieren + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Neuen Bauvertrag generieren + public static function createWorksContract ($shipType, $shipName, ContractPartner $partnerInstance) { + // Strings absichern + $shipType = (string) $shipType; + $shipName = (string) $shipName; + + // Is the other one a contract partner? + if (is_null($partnerInstance)) { + // Opps! Empty partner instance? + throw new NullPointerException($partnerInstance, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($partnerInstance)) { + // Not an object! ;-( + throw new NoObjectException($partnerInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($partnerInstance, 'isContractPartner')) { + // Does not have the required feature (method) + throw new MissingMethodException(array($partnerInstance, 'isContractPartner'), self::EXCEPTION_MISSING_METHOD); + } + + // Instanz holen + $contractInstance = new WorksContract(); + + // Debug-Meldung ausgeben + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->getDebugInstance()->output(sprintf("[%s:%d] Neuer Bauvertrag wird für das Schiff %s mit der %s %s erstellt.
\n", + __CLASS__, + __LINE__, + $shipName, + $partnerInstance->getPartDescr(), + $partnerInstance->getCompanyName() + )); + + // Schiffsnamen setzen + $contractInstance->setShipName($shipName); + + // Existiert die Klasse ueberhaupt? + if (!class_exists($shipType)) { + // Klasse nicht gefunden + throw new ClassNotFoundException ($shipType, 0); + } + + // Schiff-Instanz temporaer erzeugen und in den Bauvertrag einfuegen + $eval = sprintf("\$contractInstance->setShipInstance(%s::create%s(\"%s\"));", + $shipType, + $shipType, + $shipName + ); + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $contractInstance->getDebugInstance()->output(sprintf("[%s:%d] Konstruierte PHP-Anweisung:
%s

\n", + __CLASS__, + __LINE__, + htmlentities($eval) + )); + + // Execute constructed command + @eval($eval); + + // Set itself as contract partner + $contractInstance->setContractPartner($partnerInstance); + + // Instanz zurueckgeben + return $contractInstance; + } + + // Setter for ship instance + private function setShipInstance (ConstructableShip $shipInstance) { + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s wird in den Bauvertrag aufgenommen.
\n", + __CLASS__, + __LINE__, + $shipInstance->getShipName() + )); + $this->shipInstance = $shipInstance; + } + + // Setter for ship name + private function setShipName ($shipName) { + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das neue Schiff wird %s heissen.
\n", + __CLASS__, + __LINE__, + $shipName + )); + $this->shipName = (string) $shipName; + } + + // Getter for ship name + public function getShipName () { + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Schiffsname %s angefordert.
\n", + __CLASS__, + __LINE__, + $this->shipName + )); + return $this->shipName; + } + + // Getter for ship instance + public function getShipInstance () { + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Schiff-Instanz angefordert.
\n", + __CLASS__, + __LINE__ + )); + return $this->shipInstance; + } + + // Add detail to the contract + public function addContractDetails ($shipPart, $parentPart, array $dataArray) { + // Secure strings + $shipPart = (string) $shipPart; + $parentPart = (string) $parentPart; + + // Debug message + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiffsteil %s wird zusammen mit dem Konstruktionsteil %s in den Bauvertrag aufgenommen.
\n", + __CLASS__, + __LINE__, + $shipPart, + $parentPart + )); + + // Initialize the instance (shall not be done within dynamic part) + $instance = null; + + // Prepare the big command for everthing + $eval = "try { + \$instance = ".$shipPart."::create".$shipPart."("; + foreach ($dataArray as $pIdx => $parts) { + if (is_string($parts)) { + // String einbauen + $eval .= "\"".$parts."\", "; + } elseif (is_array($parts)) { + // Ist ein weiteres Array! + $eval .= "array("; + foreach ($parts as $idx2 => $sub) { + $eval .= "'".$idx2."' => "; + if (is_string($sub)) { + // Ist erneut ein String + $eval .= "\"".$sub."\""; + } elseif (is_array($sub)) { + // Wird nicht mehr unterstuetzt! + ApplicationEntryPoint::app_die("No more arrays!"); + } else { + // Direkt anhaengen + $eval .= $sub; + } + $eval .= ", "; + } + + // Letztes Komma entfernen + $eval = substr($eval, 0, -2); + $eval .= "), "; + } else { + // Etwas anderes direkt! + $eval .= $parts.", "; + } + } + + // Letztes Komma abhaengen + $eval = substr($eval, 0, -2); + $eval .= "); +} catch (DimNotFoundInArrayException \$e) { + \$this->getDebugInstance()->output(sprintf(\"[main:] Die %s konnte nicht vervollständigt werden. Grund: %s
\\n\", + \$this->getShipInstance()->getShipName(), + \$e->getMessage() + )); + \$instance = null; +}"; + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Ship:] Konstruierte PHP-Anweisung:
%s

\n", + htmlentities($eval) + )); + + // Code ausfuhren + @eval($eval); + + // Try to add the ship part to the contract + try { + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.
\n", + __CLASS__, + __LINE__ + )); + if (!$instance instanceof ConstructableShipPart) { + // Ship part not constructable! + throw new ShipPartNotConstructableException(array($shipPart), self::EXCEPTION_NOT_CONSTRUCTABLE); + } elseif (!$this->getShipInstance()->createShipPart($instance, $parentPart)) { + // Schiff konnte nicht gebaut werden! + throw new ShipNotConstructedException(sprintf("Das Schiff %s konnte wegen eines Fehlers nicht gebaut werden. Siehe obere Meldungen.", + $this->getShipInstance()->getShipName() + )); + } + } catch(ClassNotFoundException $e) { + // Throw it again... + throw new ClassNotFoundException($e->getMessage(), $e->getCode()); + } + + // Get price for this item + $price = $this->getMerchantInstance()->getPriceFromList($instance); + + // Final debug message + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %s kostet %s.
\n", + __CLASS__, + __LINE__, + $instance->getPartDescr(), + $this->getMerchantInstance()->formatCurrency($price) + )); + + // Add price + $instance->setPrice($price); + + // Final debug message + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %s wurde in den Bauvertrag aufgenommen.
\n", + __CLASS__, + __LINE__, + $instance->getPartDescr() + )); + } + + // Setter for contract partner + public function setContractPartner (ContractPartner $partnerInstance) { + $this->contractPartner = $partnerInstance; + } + + // Getter for contract partner + public function getContractPartner () { + return $this->contractPartner; + } + + // Setter for contract party + public function setContractParty (ContractPartner $partyInstance) { + $this->contractParty = $partyInstance; + } + + // Getter for contract party + public function getContractParty () { + return $this->contractParty; + } + + // Setter for signature + public function setSigned ($signed) { + $this->signed = (boolean) $signed; + } + + // Getter for signature + public function isSigned () { + return $this->signed; + } + + // Sign the contract + public function signContract (ContractPartner $partnerInstance, ContractPartner $partyInstance) { + // Is this contract already signed? + if ($this->isSigned()) { + // Throw an exception + throw new ContractAllreadySignedException(array($this, $this->getContractPartner(), $this->getContractParty()), self::EXCEPTION_CONTRACT_ALREADY_SIGNED); + } + + // Is the first contract partner still the same? + if ($partnerInstance->equals($this->getContractPartner())) { + // Set contract party (other partner is already set) + $this->setContractParty($partyInstance); + + // Finally sign it + $this->setSigned(true); + } else { + // Throw an exception + throw new ContractPartnerMismatchException(array($this, $this->getContractPartner(), $partyInstance), self::EXCEPTION_CONTRACT_PARTNER_MISMATCH); + } + + // Debug message + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) { + if ($partnerInstance->equals($partyInstance)) { + // With itself + $this->getDebugInstance()->output(sprintf("[%s:%d] Die %s %s stimmt einem Bauvertrag über das %s %s zu.
\n", + __CLASS__, + __LINE__, + $partnerInstance->getPartDescr(), + $partnerInstance->getCompanyName(), + $this->getShipInstance()->getPartDescr(), + $this->getShipInstance()->getShipName() + )); + } else { + // Other contract party + $this->getDebugInstance()->output(sprintf("[%s:%d] Die %s %s geht mit der %s %s einen Bauvertrag über das %s %s ein.
\n", + __CLASS__, + __LINE__, + $partnerInstance->getPartDescr(), + $partnerInstance->getCompanyName(), + $partyInstance->getPartDescr(), + $partyInstance->getCompanyName(), + $this->getShipInstance()->getPartDescr(), + $this->getShipInstance()->getShipName() + )); + } + } + } + + // Setter for merchant instance + public function setMerchantInstance (Merchant $merchantInstance) { + $this->merchantInstance = $merchantInstance; + } + + // Getter for merchant instance + public function getMerchantInstance () { + return $this->merchantInstance; + } + + // Getter for total price + public function getTotalPrice () { + // Get ship instance + $shipInstance = $this->getShipInstance(); + + // Is this a ship? + if (is_null($shipInstance)) { + // Opps! Empty partner instance? + throw new NullPointerException($shipInstance, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipInstance)) { + // Not an object! ;-( + throw new NoObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!$shipInstance instanceof ConstructableShip) { + // Does not have the required feature (method) + throw new ShipIsInvalidException(array($shipInstance), self::EXCEPTION_INVALID_SHIP_INSTANCE); + } + + // Get the structure array + $struct = $shipInstance->getStructuresArray(); + + // Is this a ship? + if (is_null($struct)) { + // Opps! Empty partner instance? + throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY); + } + + // Init total price + $totalPrice = 0; + + // Iterate through the list + for ($iter = $struct->getIterator(); $iter->valid(); $iter->next()) { + // Get item + $item = $iter->current(); + + // Is this a ship? + if (is_null($item)) { + // Opps! Empty partner instance? + throw new NullPointerException($item, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($item)) { + // Not an object! ;-( + throw new NoObjectException($item, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($item, 'getPartInstance')) { + // Does not have the required feature (method) + throw new MissingMethodException(array($item, 'getPartInstance'), self::EXCEPTION_MISSING_METHOD); + } + + // Get part instance + $part = $item->getPartInstance(); + + // Is this a ship? + if (is_null($part)) { + // Opps! Empty partner instance? + throw new NullPointerException($part, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($part)) { + // Not an object! ;-( + throw new NoObjectException($part, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($part, 'getPrice')) { + // Does not have the required feature (method) + throw new MissingMethodException(array($part, 'getPrice'), self::EXCEPTION_MISSING_METHOD); + } + + // Get price for one item + $price = $part->getPrice(); + + // Is there numCabin() available? + if (method_exists($item, 'getNumCabin')) { + // Get total cabin and multiply it with the price + $price = $price * $item->getNumCabin(); + } + + // Add price to total price + $totalPrice += $price; + } + + // Total price calculated? + if ($totalPrice === 0) { + // Throw exception + throw new TotalPriceNotCalculatedException($this, self::EXCEPTION_TOTAL_PRICE_NOT_CALCULATED); + } + + // Return total price + return $totalPrice; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/companies/.htaccess b/application/ship-simu/main/companies/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/companies/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/companies/class_ShippingCompany.php b/application/ship-simu/main/companies/class_ShippingCompany.php new file mode 100644 index 0000000..54b3e28 --- /dev/null +++ b/application/ship-simu/main/companies/class_ShippingCompany.php @@ -0,0 +1,636 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Reederei"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Reederei gruenden (create wegen Namenskonvention) + public static function createShippingCompany ($companyName, Harbor $hqInstance) { + // Instanz holen + $companyInstance = new ShippingCompany(); + + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $companyInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s wird gegründet.
\n", + __CLASS__, + __LINE__, + $companyName + )); + + // Firmennamen setzen + $companyInstance->setCompanyName($companyName); + + // Kuerzel setzen + $companyInstance->createShortName(); + + // Sitz festlegen + $companyInstance->setHQInstance($hqInstance); + + // Werftenliste erstellen + $companyInstance->createshipyardList(); + + // Angestellten-Liste erstellen + $companyInstance->createEmployeeList(); + + // Auftragsliste erstellen + $companyInstance->createContractList(); + + // Etwas aufraeumen + $companyInstance->removeWidth(); + $companyInstance->removeHeight(); + $companyInstance->removeLength(); + $companyInstance->removeDraught(); + $companyInstance->removePartInstance(); + + // Instanz zurueckgeben + return $companyInstance; + } + + // Angestellten-Liste erstellen + private function createEmployeeList () { + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erhält eine Angestelltenliste.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName() + )); + $this->employeeList = new FrameworkArrayObject(); + } + + // Werftenliste erstellen + public function createShipyardList () { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erhält eine Werftsliste.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName() + )); + $this->shipyardList = new FrameworkArrayObject(); + } + + // Auftragsliste erstellen + public function createContractList () { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erhält eine Auftragsliste.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName() + )); + $this->contractList = new FrameworkArrayObject(); + } + + // Setter-Methode fuer Firmennamen + public function setCompanyName ($companyName) { + $this->companyName = (string) $companyName; + } + + // Getter-Methode fuer Firmennamen + public function getCompanyName () { + return $this->companyName; + } + + // Setter-Methode fuer Firmensitz + public function setHQInstance (Harbor $hqInstance) { + $this->hqInstance = $hqInstance; + } + + // Kuerzel setzen + private function createShortName () { + // Mindestens eine Leerstelle? + $dummy = explode(" ", $this->getCompanyName()); + foreach ($dummy as $part) { + $this->shortName .= substr($part, 0, 1); + } + } + + // Reedereien Werften bauen lassen + public function createShipyardInHarbor($shipyardName, Harbor $harborInstance) { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s baut im %s eine Werft %s.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $harborInstance->getHarborName(), + $shipyardName + )); + + // Wird im HQ gebaut? + if ($this->hqInstance->equals($harborInstance)) { + // Die neue Werft wird im HQ gebaut! + $this->hqInstance->addNewShipyardNotify($shipyardName, $this); + // Die Werft drueber in Kenntnis setzen, welcher Reederei sie angehoert + } else { + // Ausserhalb des Heimathafens soll eine Werft gebaut werden + $harborInstance->addNewShipyardNotify($shipyardName, $this); + } + } + + // Setter fuer Reederei-Gruender + public function setCompanyFounder(CompanyEmployee $founderInstance) { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s ist von %s %s gegründet worden.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $founderInstance->getSurname(), + $founderInstance->getFamily() + )); + $this->founderInstance = $founderInstance; + } + + // Getter for founder instance + public function getFounderInstance () { + return $this->founderInstance; + } + + // Neue(n) Angestellte(n) in Angestellten-Liste aufnehmen + public function addNewEmployee (SimulatorPersonell $employeeInstance) { + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %s %s tritt der Reederei %s als %s bei und erhält ein Gehalt von %s.
\n", + __CLASS__, + __LINE__, + $employeeInstance->getSurname(), + $employeeInstance->getFamily(), + $this->getCompanyName(), + $employeeInstance->getPartDescr(), + $this->formatCurrency($employeeInstance->getSalary()) + )); + $this->employeeList->append($employeeInstance); + } + + // Neue Werft in Liste aufnehmen + public function addNewShipyard (Shipyard $shipyardInstance) { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erhält die Werft %s hinzugefügt.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $shipyardInstance->getShipyardName() + )); + $this->shipyardList->append($shipyardInstance); + } + + // Neue Mitarbeiter per Zufall einstellen/rekrutieren + public function recruitRandomEmployees($amount, SimulatorPersonell $personellInstance) { + // Anzahl Mitarbeiter absichern + $amount = (int) $amount; + + // Debug-Meldung ausgeben + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s stellt per Zufall %d neue Mitarbeiter ein.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $amount + )); + + // Gesamtanzahl verfuegbarer Erwerbsloser holen + $totalUnemployed = $personellInstance->getAllUnemployed(); + + // Existiert die gewuenschte Anzahl freier Arbeiter? (doppelt geht derzeit nicht) + if ($totalUnemployed < $amount) { + // Reichte nicht aus! + throw new ToMuchEmployeesException(array($amount, $personellInstance->getAllUnemployed()), self::EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES); + } + + // Get list for all unemployed people + $list = $personellInstance->getSpecialPersonellList(false); // Should be cached + + // Get iterator of the list + $iterator = $list->getIterator(); + + // Get the requested amount of personell + for ($idx = 0; $idx < $amount; $idx++) { + $employee = null; + // Is this personl unemployed? + while (is_null($employee) || $employee->isEmployed()) { + // Generate random number + $pos = mt_rand(0, ($totalUnemployed - 1)); // Don't remove the -1 here: + // E.g. 100 entries means latest position is 99... + + // Seek for the position + $iterator->seek($pos); + + // Is the current position valid? + if ($iterator->valid()) { + // Element holen + $employee = $iterator->current(); + } else { + // Should normally not happen... :( + throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS); + } + } + + // A dummy just for the description and real class + $dummy = CompanyEmployee::createCompanyEmployee("", "", "M", 1970, 1, 1, $employee->isMarried(), 0); + + // Make this person employed and give him some money to work + $employee->setEmployed(true); + $employee->setPartDescr($dummy->getPartDescr()); + $employee->setRealClass($dummy->__toString()); + $employee->increaseSalary((mt_rand(7, 14) * 100)); // Are 700 to 1400 EUR for the begin okay? + + // Debug message + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s stellt den/die Angestellte(n) %s %s ein.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $employee->getSurname(), + $employee->getFamily() + )); + + // Add this employee + $this->addNewEmployee($employee); + } // End - for + + // Cache resetten + $personellInstance->resetCache(); + + // Debug-Meldung ausgeben + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s hat per Zufall %d neue Mitarbeiter eingestellt.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $amount + )); + } // End - method + + // Distribute all personells on all shipyards + public function distributeAllPersonellOnShipyards () { + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s verteilt alle ihre %d Mitarbeiter auf alle %d Werft(en).
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $this->getTotalEmployee(), + $this->getTotalShipyards() + )); + + // Do we have some shipyards? + if (is_null($this->shipyardList)) { + // No shipyards created + throw new NoShipyardsConstructedException($this, self::EXCEPTION_HARBOR_HAS_NO_SHIPYARDS); + } + + // Get iterator for shipyards + $shipyardIter = $this->shipyardList->getIterator(); + + // Iterate through all employees + for ($idx = $this->employeeList->getIterator(); $idx->valid(); $idx->next()) { + // Is the shipyard iterator still okay? + if (!$shipyardIter->valid()) { + // Rewind to first position + $shipyardIter->seek(0); + } + + // Get Shipyard object + $shipyard = $shipyardIter->current(); + + // Is this a Shipyard object? + if (is_null($shipyard)) { + // No class returned + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipyard)) { + // Not an object! ;-( + throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!$shipyard->isClass("Shipyard")) { + // Nope, so throw exception + throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); + } + + // Add employee to the shipyard + $shipyard->addNewPersonell($idx->current()); + + // Continue to next shipyard + $shipyardIter->next(); + } + } + + // Getter for total employees + public function getTotalEmployee () { + // Count all... + $total = $this->employeeList->count(); + + // Debug message + if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s hat %d Mitarbeiter.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $total + )); + + // Return amount + return $total; + } + + // Getter for total shipyards + public function getTotalShipyards () { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Für die Reederei %s werden die Anzahl der Werften in allen Häfen ermittelt.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName() + )); + + // Do we have some shipyards? + if (is_null($this->shipyardList)) { + // No shipyards created + throw new NoShipyardsConstructedException($this, self::EXCEPTION_HARBOR_HAS_NO_SHIPYARDS); + } + + // Get iterator + $total = $this->shipyardList->count(); + + // Debug message + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s hat %d Werft(en).
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $total + )); + + // Return amount + return $total; + } + + // Add a ship type (class) to all shipyards + public function addShipTypeToAllShipyards ($shipType) { + // Secure strings + $shipType = (string) $shipType; + + // Is the class there? + if (!class_exists($shipType)) { + // Throw exception + throw new ClassNotFoundException($shipType, 0); + } + + // Create dummy ship + eval(sprintf("\$shipInstance = %s::create%s(\"M/S Dummy\");", + $shipType, + $shipType + )); + + // Debug message + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s baut in allen Werften bald Schiffe vom Typ %s.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $shipInstance->getPartDescr() + )); + + // Iterate shipyard list + for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) { + // Get current element + $shipyard = $idx->current(); + + // Is this a shipyard? + if (is_null($shipyard)) { + // Opps! Empty list? + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipyard)) { + // Not an object! ;-( + throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!$shipyard->isClass("Shipyard")) { + // Class is not a shipyard + throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); + } + + // Add the new ship type to the shipyard + $shipyard->addNewConstructableShipType($shipType); + } + } + + // Validate the requested ship type with the company if they can construct it + public function validateWorksContractShipType (WorksContract $contractInstance) { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s prüft den Bauauftrag der %s.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $contractInstance->getShipName() + )); + + // First get the ship type + $shipInstance = $contractInstance->getShipInstance(); + + // Ist there a ship instance? + if (is_null($shipInstance)) { + // Opps! Empty entry? + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipInstance)) { + // Not an object! ;-( + throw new NoObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); + } + + // Get it's real class name + $shipType = $shipInstance->__toString(); + + // Debug message + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s prüft, ob die %s (Typ:%s) gebaut werden kann.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $contractInstance->getShipName(), + $shipInstance->getPartDescr() + )); + + // Now check if the ship type is in any list and return the result + return ($this->isShipTypeConstructable($shipType)); + } + + // Is the ship type constructable? + public function isShipTypeConstructable ($shipType) { + // The type must be a string! + $shipType = (string) $shipType; + + // Debug message + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s fragt alle Werften ab, ob diese Schiffe vom Typ %s bauen können.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $shipType + )); + + // First everthing is failed... + $result = false; + + // Iterate through all shipyards + for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) { + // Get current Shipyard instance + $shipyard = $idx->current(); + + // Is this a shipyard? + if (is_null($shipyard)) { + // Opps! Empty list? + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($shipyard)) { + // Not an object! ;-( + throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!$shipyard->isClass("Shipyard")) { + // Class is not a shipyard + throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); + } + + // Validate if the first found shipyard can construct the requested type + $result = $shipyard->isShipTypeConstructable($shipType); + + // Does this shipyard construct the requested ship type? + if ($result) break; // Then abort the search! + } + + // Debug message + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s hat die Suche nach einer Werft beendet, die Schiffe vom Typ %s bauen kann.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $shipType + )); + + // Return result + return $result; + } + + // As a customer the shipping company can add new contracts + public function addNewWorksContract (WorksContract $contractInstance) { + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erstellt einen Bauauftrag für ein %s mit dem Namen %s.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $contractInstance->getShipInstance()->getPartDescr(), + $contractInstance->getShipInstance()->getShipName() + )); + $this->contractList->append($contractInstance); + } + + // As a customer the shippng company can withdraw from a contract + public function withdrawFromContract (WorksContract $contractInstance) { + ApplicationEntryPoint::app_die("WITHDRAW:
".print_r($contractInstance, true)."
"); + } + + // Get latest added contract instance + public function getLastContractInstance () { + // Get iterator + $iter = $this->contractList->getIterator(); + + // Get latest entry (total - 1) + $iter->seek($iter->count() - 1); + + // Return entry + return $iter->current(); + } + + // Sign a contract with an other party which must also implement Customer + public function signContract (WorksContract $contractInstance, ContractPartner $partnerInstance) { + if (!$partnerInstance->isContractPartner($contractInstance)) { + // Invalid contract partner! + throw new InvalidContractPartnerException($partnerInstance, self::EXCEPTION_CONTRACT_PARTNER_INVALID); + } + + // Determine if company "signs" own contract (must be done) or with an other party + if ($this->equals($partnerInstance)) { + // With itself + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erteilt an sich selbst einen Bauauftrag für das %s "%s".
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $contractInstance->getShipInstance()->getPartDescr(), + $contractInstance->getShipInstance()->getShipName() + )); + } else { + // Other external company + if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s unterzeichnet einen Bauauftrag für das %s "%s" mit der %s.
\n", + __CLASS__, + __LINE__, + $this->getCompanyName(), + $contractInstance->getShipInstance()->getPartDescr(), + $contractInstance->getShipInstance()->getShipName(), + $partnerInstance->getCompanyName() + )); + } + + // Sign the contract + $contractInstance->signContract($this, $partnerInstance); + + /** + * @todo Maybe do something more here... + */ + } + + // Is this the right contract partner? + public function isContractPartner (WorksContract $contractInstance) { + // Get contract partner instance and compare it with $this contract partner + return ($this->equals($contractInstance->getContractPartner())); + } + + // Setter for merchant instance + public function setMerchantInstance (Merchant $merchantInstance) { + // Get contract + $contractInstance = $this->getLastContractInstance(); + + if (is_null($contractInstance)) { + // Opps! Empty contract instance? + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($contractInstance)) { + // Not an object! ;-( + throw new NoObjectException($contractInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!$contractInstance->isClass('WorksContract')) { + // Is not a merchant + throw new ClassMismatchException(array($contractInstance->__toString(), "WorksContract"), self::EXCEPTION_CLASSES_NOT_MATCHING); + } + + // Set the merchant in the contract (for getting prices) + $contractInstance->setMerchantInstance($merchantInstance); + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/constructions/.htaccess b/application/ship-simu/main/constructions/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/constructions/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/constructions/berths/.htaccess b/application/ship-simu/main/constructions/berths/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/constructions/berths/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/constructions/berths/class_Berth.php b/application/ship-simu/main/constructions/berths/class_Berth.php new file mode 100644 index 0000000..06eac84 --- /dev/null +++ b/application/ship-simu/main/constructions/berths/class_Berth.php @@ -0,0 +1,48 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Eltern-Konstruktor aufrufen + parent::constructor(__CLASS__); + + // Beschreibung setzen + $this->setPartDescr("Liegeplatz"); + + // Unique-ID erzeugen + $this->createUniqueID(); + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/constructions/class_BaseConstruction.php b/application/ship-simu/main/constructions/class_BaseConstruction.php new file mode 100644 index 0000000..16ef468 --- /dev/null +++ b/application/ship-simu/main/constructions/class_BaseConstruction.php @@ -0,0 +1,39 @@ +getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Beschreibung setzen + $this->setPartDescr("Namenlose Landkonstruktion"); + + // Etwas aufraeumen (brauchen wir hier nicht) + $this->removeNumberFormaters(); + } + + // Konstruktor aufrufen + public function constructor ($class) { + $this->__construct($class); + } + + // Tiefgang entfernen + public function removeDraught () { + if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Tiefgang wird entfernt.
\n", + $this->__toString() + )); + unset($this->draught); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/constructions/docks/.htaccess b/application/ship-simu/main/constructions/docks/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/constructions/docks/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/constructions/docks/class_DryDock.php b/application/ship-simu/main/constructions/docks/class_DryDock.php new file mode 100644 index 0000000..b0f19e6 --- /dev/null +++ b/application/ship-simu/main/constructions/docks/class_DryDock.php @@ -0,0 +1,41 @@ +getDebugInstance()->output("[DryDock:] Konstruktor erreicht.
\n"); + + // Eltern-Konstruktor aufrufen + parent::constructor(__CLASS__); + + // Beschreibung setzen + $this->setPartDescr("Trockendock"); + + // Unique-ID erzeugen + $this->createUniqueID(); + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/constructions/harbors/.htaccess b/application/ship-simu/main/constructions/harbors/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/constructions/harbors/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/constructions/harbors/class_Harbor.php b/application/ship-simu/main/constructions/harbors/class_Harbor.php new file mode 100644 index 0000000..1839754 --- /dev/null +++ b/application/ship-simu/main/constructions/harbors/class_Harbor.php @@ -0,0 +1,116 @@ +getDebugInstance()->output("[Harbor:] Konstruktor erreicht.
\n"); + + // Beschreibung setzen + $this->setPartDescr("Hafen"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + $this->removePartInstance(); + } + + // Creates a harbor + public static function createHarbor ($harborName) { + // Hafen-Instanz holen + $harborInstance = new Harbor(); + + // Debug message + if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $harborInstance->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen %s wird konstruiert.
\n", $harborName)); + + // Hafenname setzen + $harborInstance->setHarborName($harborName); + + // Werftliste initialisieren + $harborInstance->createshipyardList(); + + // Debug-Meldung ausgeben + if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $harborInstance->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen %s ist jetzt fertig gebaut.
\n", $harborName)); + + // Instanz zurueckliefern + return $harborInstance; + } + + // Werft-Liste generieren + public function createshipyardList () { + if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Werft-Liste wird für den Hafen %s erstellt.
\n", + $this->getHarborName() + )); + $this->shipyardList = new FrameworkArrayObject(); + } + + // Setter fuer Hafennamen + public function setHarborName ($harborName) { + if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen heisst jetzt %s.
\n", $harborName)); + $this->harborName = (string) $harborName; + } + + // Getter fuer Hafennamen + public function getHarborName () { + if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Hafenname %s wurde angefordert.
\n", $this->harborName)); + return $this->harborName; + } + + // Werft in den Hafen einbauen und Werft->Reederei zuweisen + public function addNewShipyardNotify ($shipyardName, ShippingCompany $companyInstance) { + if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Die Werft %s wird im Hafen %s gebaut.
\n", + $shipyardName, $this->getHarborName() + )); + + // Werft generieren und in die Werftliste aufnehmen + $this->shipyardList->append(Shipyard::createShipyardNotify($this, $shipyardName, $companyInstance)); + } + + // Werft in den Hafen einbauen ohne Zuweisung einer Reederei (gehoert der "Stadt" dann) + public function addNewShipyard ($shipyardName) { + if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Die Werft %s wird im Hafen %s gebaut.
\n", + $shipyardName, $this->getHarborName() + )); + + // Werft generieren und in die Werftliste aufnehmen + $this->shipyardList->append(Shipyard::createShipyard($this, $shipyardName)); + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/constructions/terminals/.htaccess b/application/ship-simu/main/constructions/terminals/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/constructions/terminals/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/constructions/terminals/class_Terminal.php b/application/ship-simu/main/constructions/terminals/class_Terminal.php new file mode 100644 index 0000000..ca61501 --- /dev/null +++ b/application/ship-simu/main/constructions/terminals/class_Terminal.php @@ -0,0 +1,46 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Eltern-Konstruktor aufrufen + parent::constructor(__CLASS__); + + // Beschreibung setzen + $this->setPartDescr("Anlegebrücke"); + + // Unique-ID erzeugen + $this->createUniqueID(); + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/constructions/yards/.htaccess b/application/ship-simu/main/constructions/yards/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/constructions/yards/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/constructions/yards/class_Shipyard.php b/application/ship-simu/main/constructions/yards/class_Shipyard.php new file mode 100644 index 0000000..9d555dd --- /dev/null +++ b/application/ship-simu/main/constructions/yards/class_Shipyard.php @@ -0,0 +1,241 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Werft"); + + // Staff-Liste/Schiffstyp-Liste erzeugen + $this->createStaffList(); + $this->createShipTypeList(); + + // Unique-ID erzeugen + $this->createUniqueID(); + } + + // Create a shipyard and notify it about it's owner + public static function createShipyardNotify (Harbor $harborInstance, $shipyardName, ShippingCompany $companyInstance) { + // Werft-Instanz holen + $shipyardInstance = self::createShipyard($harborInstance, $shipyardName); + + // Reederei der Werft zuweisen + $shipyardInstance->setCompanyInstance($companyInstance); + + // Die Reederei ueber ihre Werft informieren + $companyInstance->addNewShipyard($shipyardInstance); + + // Instanz zurueckgeben + return $shipyardInstance; + } + + // Create a shipyard, first we need to create a harbor + public final static function createShipyard (Harbor $harborInstance, $shipyardName) { + // Instanz temporaer holen + $shipyardInstance = new Shipyard(); + + // Debug message + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Werft mit dem Namen %s wird im Hafen %s konstruiert.
\n", + __CLASS__, + __LINE__, + $shipyardName, + $harborInstance->getHarborName() + )); + + // Werft-Name setzen + $shipyardInstance->setShipyardName($shipyardName); + + // Hafen-Instanz setzen + $shipyardInstance->setHarborInstance($harborInstance); + + // Abmasse setzen in Meter + $shipyardInstance->setWidth(30); + $shipyardInstance->setHeight(30); + $shipyardInstance->setLength(100); + + // Etwas aufraeumen + $shipyardInstance->removeDraught(); + $shipyardInstance->removeSystemArray(); + + // Debug-Meldung + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s wurde gebaut.
\n", + __CLASS__, + __LINE__, + $shipyardName + )); + + // Instanz zurueckliefern + return $shipyardInstance; + } + + // Create staff list + private function createStaffList () { + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s erhält eine Arbeiterliste.
\n", + __CLASS__, + __LINE__, + $this->getShipyardName() + )); + $this->staffList = new FrameworkArrayObject(); + } + + // Create ship type list + private function createShipTypeList () { + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s erhält eine Typenliste.
\n", + __CLASS__, + __LINE__, + $this->getShipyardName() + )); + $this->shipTypeList = new FrameworkArrayObject(); + } + + // Setter-Methode fuer Werft-Name + public function setShipyardName ($shipyardName) { + $this->shipyardName = (string) $shipyardName; + } + + // Getter-Methode fuer Werft-Name + public function getShipyardName () { + return $this->shipyardName; + } + + // Setter-Methode fuer Hafen-Instanz + public function setHarborInstance (Harbor $harborInstance) { + $this->harborInstance = $harborInstance; + } + + // Getter-Methode fuer Hafen-Instanz + public function getHarborInstance () { + return $this->harborInstance; + } + + // Setter fuer Reederei-Instanz + public function setCompanyInstance (ShippingCompany $companyInstance) { + $this->shippingCompany = $companyInstance; + } + + // Getter fuer Reederei-Instanz + public function getCompanyInstance () { + return $this->shippingCompany; + } + + // Add new personell + public function addNewPersonell ($personell) { + if (is_null($this->staffList)) { + // Opps, not initialized! + ApplicationEntryPoint::app_die("New personell:
".print_r($this, true)."
"); + } + + // Add to list + $this->staffList->append($personell); + } + + // Add a new ship type to our list + public function addNewConstructableShipType ($shipType) { + // This must be a string! + $shipType = (string) $shipType; + + // Debug message + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s kann bald Schiffe vom Typ %s bauen.
\n", + __CLASS__, + __LINE__, + $this->getShipyardName(), + $shipType + )); + + // Add to list + $this->shipTypeList->append($shipType); + } + + // Is the specified ship type in our list? + public function isShipTypeConstructable ($shipType) { + // First we can't build this ship + $result = false; + + // This must be a string! + $shipType = (string) $shipType; + + // Debug message + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s prüft, ob Schiffe vom Typ %s baubar sind.
\n", + __CLASS__, + __LINE__, + $this->getShipyardName(), + $shipType + )); + + // Iterate through all types + for ($idx = $this->shipTypeList->getIterator(); $idx->valid(); $idx->next()) { + // Get current ship type + $type = (string) $idx->current(); + + // Is both the same? + $result = ($type == $shipType); + + // Type is found? + if ($result) break; // Then abort the search! + } + + // Debug message + if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s hat die Suche nach dem Schiffstyp %s abgeschlossen.
\n", + __CLASS__, + __LINE__, + $this->getShipyardName(), + $shipType + )); + + // Return result + return $result; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/drives/.htaccess b/application/ship-simu/main/drives/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/drives/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/drives/class_BaseDrive.php b/application/ship-simu/main/drives/class_BaseDrive.php new file mode 100644 index 0000000..7ebef58 --- /dev/null +++ b/application/ship-simu/main/drives/class_BaseDrive.php @@ -0,0 +1,74 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Namenloser Antrieb"); + + // Etwas aufraeumen + $this->removeNumberFormaters(); + $this->removePartInstance(); + } + + // Konstruktor aufrufen + public function constructor ($class) { + $this->__construct($class); + } + + // Setter-Methode fuert PS-Zahl + public function setHorsePower ($hp) { + if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Antriebsleistung wird auf %d PS gesetzt.
\n", + __CLASS__, + __LINE__, + $hp + )); + $this->horsePower = (int) $hp; + } + + // Setter-Methode fuer Nockenanzahl + public function setNumCams ($cams) { + if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Nockenanzahl wird auf %d Nocken gesetzt.
\n", + __CLASS__, + __LINE__, + $cams + )); + $this->numCams = (int) $cams; + } + + // Setter for price + public function setPrice ($price) { + $this->price = (float) $price; + } + + // Getter for price + public function getPrice () { + return $this->price; + } + + public function removePrice () { + unset($this->price); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/drives/motor/.htaccess b/application/ship-simu/main/drives/motor/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/drives/motor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/drives/motor/class_Motor.php b/application/ship-simu/main/drives/motor/class_Motor.php new file mode 100644 index 0000000..0af6b97 --- /dev/null +++ b/application/ship-simu/main/drives/motor/class_Motor.php @@ -0,0 +1,78 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Namenloser Motor"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Einen Motor erstellen + public static function createMotor ($descr, $hp, $cams, $w, $h, $l) { + // Instanz holen + $motorInstance = new Motor(); + + // Debug message + if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $motorInstance->getDebugInstance()->output(sprintf("[%s:%d] Motor %s wird gebaut...
\n", + __CLASS__, + __LINE__, + $descr + )); + + // Beschreibung und Abmasse setzen + $motorInstance->setPartDescr($descr); + $motorInstance->setWidth($w); + $motorInstance->setHeight($h); + $motorInstance->setLength($l); + + // Weitere Daten setzen + $motorInstance->setHorsePower($hp); + $motorInstance->setNumCams($cams); + + // Instanz zurueckgeben + return $motorInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/parts/.htaccess b/application/ship-simu/main/parts/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/parts/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/parts/class_BaseShipPart.php b/application/ship-simu/main/parts/class_BaseShipPart.php new file mode 100644 index 0000000..4ce775f --- /dev/null +++ b/application/ship-simu/main/parts/class_BaseShipPart.php @@ -0,0 +1,50 @@ +getDebugInstance()->output(sprintf("[%s:%d:] Kontruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung + $this->setPartDescr("Schiffsteil"); + + // Etwas aufraeumen + $this->removeNumberFormaters(); + } + + // Konstruktor aufrufen + public function constructor ($class) { + $this->__construct($class); + } + + // Setter for price + public function setPrice ($price) { + $this->price = (float) $price; + } + + // Getter for price + public function getPrice () { + return $this->price; + } + + // Remove price + public function removePrice () { + unset($this->price); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/parts/maschineroom/.htaccess b/application/ship-simu/main/parts/maschineroom/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/parts/maschineroom/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php b/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php new file mode 100644 index 0000000..0e3f472 --- /dev/null +++ b/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php @@ -0,0 +1,67 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Maschinenraum"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Maschinenraum erstellen + public static function createMaschineRoom () { + // Instanz holen + $roomInstance = new MaschineRoom(); + + // Debug message + if ((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) $roomInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Maschinenraum wird konstruiert.
\n", + __CLASS__, + __LINE__ + )); + + // Umrechnungsfaktoren setzen + $roomInstance->setResizeFactorElement('width' , 1.3); + $roomInstance->setResizeFactorElement('height', 1.8); + $roomInstance->setResizeFactorElement('length', 1.3); + + // Instanz zurueckgeben + return $roomInstance; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/personell/.htaccess b/application/ship-simu/main/personell/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/personell/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/personell/class_SimulatorPersonell.php b/application/ship-simu/main/personell/class_SimulatorPersonell.php new file mode 100644 index 0000000..8581536 --- /dev/null +++ b/application/ship-simu/main/personell/class_SimulatorPersonell.php @@ -0,0 +1,467 @@ +getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Set description + $this->setPartDescr("Simulationspersonal"); + + // Create unique ID + $this->createUniqueID(); + + // Clean-up a little + $this->removeSystemArray(); + } + + /** + * Magic wake-up method called when unserialize() is called. This is + * neccessary because in this case a personell does not need to know the + * min/max ages range and system classes. This would anyway use more RAM + * what is not required. + * + * @return void + */ + public function __wakeup () { + // Tidy up a little + $this->removePersonellList(); + $this->removeMinMaxAge(); + $this->removeCache(); + $this->removeSystemArray(); + } + + /** + * Generate a specified amount of personell and return the prepared instance + * + * @param $amountPersonell Number of personell we shall + * generate + * @return $personellInstance An instance of this object with a + * list of personells + */ + public static function createSimulatorPersonell ($amountPersonell) { + // Make sure only integer can pass + $amountPersonell = (int) $amountPersonell; + + // Get a new instance + $personellInstance = new SimulatorPersonell(); + + // Generate unique ID number + $personellInstance->createUniqueID(); + + // Debug message + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Es werden %d Personal bereitgestellt.
\n", + __CLASS__, + __LINE__, + $amountPersonell + )); + + // Initialize the personell list + $personellInstance->createPersonellList(); + + // Create requested amount of personell + for ($idx = 0; $idx < $amountPersonell; $idx++) { + $personellInstance->addPersonell(); + } + + // Debug message + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] %d Personal bereitgestellt.
\n", + __CLASS__, + __LINE__, + $amountPersonell + )); + + // Tidy up a little + $personellInstance->removeGender(); + $personellInstance->removeNames(); + $personellInstance->removeBirthday(); + $personellInstance->removeSalary(); + $personellInstance->removeEmployed(); + $personellInstance->removeMarried(); + $personellInstance->removeNumberFormaters(); + //$personellInstance->removeCache(); + $personellInstance->removeSystemArray(); + + // Instanz zurueckgeben + return $personellInstance; + } + + /** + * Create a SimulatorPersonell object by loading the specified personell + * list from an existing database backend + * + * @param $idNumber The ID number (only right part) of the list + * @return $personellInstance An instance of + * @throws InvalidIDFormatException If the given id number + * $idNumber is invalid + * @throws NullPointerException If a null pointer (instance) + * has been returned. + * @throws NoObjectException If a non-object has been + * returned + * @throws MissingMethodException If a required method is missing + * @throws MissingSimulatorIDException If an ID number was not found + */ + public final static function createSimulatorPersonellByID ($idNumber) { + // Add the class name if it was not found + if (count(explode("@", $idNumber)) < 2) { + // Add class name in front of the incomplete ID number + $tempID = sprintf("%s@%s", __CLASS__, $idNumber); + } else { + // Use the direct ID number + $tempID = $idNumber; + } + + // Validate the ID number + if (!preg_match(sprintf("/%s\@([a-f0-9]){32}/i", __CLASS__), $tempID)) { + // Invalid format + throw new InvalidIDFormatException(new SimulatorPersonell(), self::EXCEPTION_ID_IS_INVALID_FORMAT); + } + + // Get instance + $personellInstance = new SimulatorPersonell(false); + + // Get database instance + $dbInstance = $personellInstance->getDatabaseInstance(); + + // Is this a valid database instance? + if (is_null($dbInstance)) { + // No class returned + throw new NullPointerException($personellInstance, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($dbInstance)) { + // Not an object! ;-( + throw new NoObjectException($dbInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($dbInstance, 'isUniqueIdUsed')) { + // Required method not found + throw new MissingMethodException(array($dbInstance, 'isUniqueIdUsed'), self::EXCEPTION_MISSING_METHOD); + } + + // Is the unique ID already used? Then it must be there! + if (!$dbInstance->isUniqueIdUsed($tempID)) { + // Entry not found! + throw new MissingSimulatorIDException(array($personellInstance, $idNumber), self::EXCEPTION_SIMULATOR_ID_INVALID); + } + + // Load the personell list and add it to this object + $personellInstance->loadPersonellList($tempID); + + // Clean-up a little + $personellInstance->removeGender(); + $personellInstance->removeNames(); + $personellInstance->removeBirthday(); + $personellInstance->removeSalary(); + $personellInstance->removeEmployed(); + $personellInstance->removeMarried(); + $personellInstance->removeNumberFormaters(); + //$personellInstance->removeCache(); + $personellInstance->removeSystemArray(); + + // Return instance + return $personellInstance; + } + + // Create personell list + public function createPersonellList () { + if (is_null($this->personellList)) { + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Personell-Liste erstellt.
\n", + __CLASS__, + __LINE__ + )); + $this->personellList = new FrameworkArrayObject(); + } else { + throw new PersonellListAlreadyCreatedException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); + } + } + + // Remove the personell list + private function removePersonellList () { + if (defined('DEBUG_PERSONELL')) $this->getDebugInstance()->output(sprintf("[%s:%d] Personell-Liste entfernt.
\n", + __CLASS__, + __LINE__ + )); + unset($this->personellList); + } + + // Add new personell object to our list + public function addPersonell () { + // Gender list... + $genders = array('M', 'F'); + + // Create new personell members + $personellInstance = new SimulatorPersonell(); + + // Set a randomized gender + $personellInstance->setGender($genders[mt_rand(0, 1)]); + + // Set a randomized birthday (maximum age required, see const MAX_AGE) + $personellInstance->createBirthday(); + + // Married? Same values means: married + if (mt_rand(0, 5) == mt_rand(0, 5)) $personellInstance->setMarried(true); + + // Tidy up a little + $personellInstance->removePersonellList(); + $personellInstance->removeMinMaxAge(); + $personellInstance->removeCache(); + $personellInstance->removeSystemArray(); + + // Add new member to the list + $this->personellList->append($personellInstance); + } + + /** + * Get a specifyable list of our people, null or empty string will be ignored! + * + * @return $cacheList A list of cached personells + */ + function getSpecialPersonellList ($isEmployed = null, $isMarried = null, $hasGender = "") { + // Serialize the conditions for checking if we can take the cache + $serialized = serialize(array($isEmployed, $isMarried, $hasGender)); + + // The same (last) conditions? + if (($serialized == $this->cacheCond) && (!is_null($this->cacheCond))) { + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Gecachte Liste wird verwendet.
\n", + __CLASS__, + __LINE__ + )); + + // Return cached list + return $this->cacheList; + } + + // Output debug message + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...
\n", + __CLASS__, + __LINE__ + )); + + // Remember the conditions + $this->setCacheCond($serialized); + + // Create cached list + $this->setAllCacheList(new FrameworkArrayObject()); + + // Search all unemployed personells + for ($idx = $this->personellList->getIterator(); $idx->valid(); $idx->next()) { + // Element holen + $el = $idx->current(); + + // Check currenylt all single conditions (combined conditions are not yet supported) + if ((!is_null($isEmployed)) && ($el->isEmployed() == $isEmployed)) { + // Add this one (employed status asked) + $this->cacheList->append($el); + } elseif ((!is_null($isMarried)) && ($el->isMarried() == $isMarried)) { + // Add this one (marrital status asked) + $this->cacheList->append($el); + } elseif ((!empty($hasGender)) && ($el->getGender() == $hasGender)) { + // Add this one (specified gender) + $this->cacheList->append($el); + } + } + + // Return the completed list + return $this->cacheList; + } + + /** + * Get amount of unemployed personell + * + * @return $count Amount of unemployed personell + */ + public function getAllUnemployed () { + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Es werden alle erwerbslosen Personen gesucht.
\n", + __CLASS__, + __LINE__ + )); + + // Get a temporary list + $list = $this->getSpecialPersonellList(false); + + // Anzahl zurueckliefern + return $list->count(); + } + + /** + * Remove cache things + * + * @return void + */ + private function removeCache () { + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Cache-Attribute entfernt.
\n", + __CLASS__, + __LINE__ + )); + + // Remove cache data + unset($this->cacheList); + unset($this->cacheCond); + } + + /** + * Setter for cache list + * + * @param $cacheList The new cache list to set or null for initialization/reset + * @return void + */ + private function setAllCacheList (FrameworkArrayObject $cacheList = null) { + $this->cacheList = $cacheList; + } + + /** + * Setter for cache conditions + * + * @param $cacheCond The new cache conditions to set + * @return void + */ + private function setCacheCond ($cacheCond) { + $this->cacheCond = (string) $cacheCond; + } + + /** + * Reset cache list + * + * @return void + */ + public function resetCache () { + if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Cache-Liste zurückgesetzt.
\n", + __CLASS__, + __LINE__ + )); + $this->setAllCacheList(null); + $this->setCacheCond(""); + } + + /** + * Getter for surname. If no surname is set then default surnames are set + * for male and female personells. + * + * @return $surname The personell' surname + */ + public final function getSurname () { + $surname = parent::getSurname(); + // Make sure every one has a surname... + if (empty($surname)) { + if ($this->isMale()) { + // Typical male name + $surname = "John"; + } else { + // Typical female name + $surname = "Jennifer"; + } + + // Set typical family name + parent::setFamily("Smith"); + } + return $surname; + } + + /** + * Saves only the personell list to the database + * + * @return void + */ + public function saveObjectToDatabase () { + // Get the database + $dbInstance = $this->getDatabaseInstance(); + + // Prepare the limitation object. We just need the personellList array object. + $limitInstance = ObjectLimits::createObjectLimits(array("personellList")); + + // Limitate the saving amount + $dbInstance->limitObject($limitInstance); + + // Save this object + $dbInstance->saveObject($this); + } + + /** + * Getter for personell list + * + * @return $personellList The list of all personells + */ + public function getPersonellList () { + return $this->personellList; + } + + /** + * Loads the mostly pre-cached personell list + * + * @param $idNumber The ID number we shall use for looking up + * the right data. + * @return void + * @throws ContainerItemIsNullException If a container item is null + * @throws ContainerItemIsNoArrayException If a container item is + * not an array + * @throws ContainerMaybeDamagedException If the container item + * is missing the indexes + * 'name' and/or 'value' + * @see SerializationContainer A special container class which + * helps storing only some attributes + * of a class. + */ + public function loadPersonellList ($idNumber) { + // Get database instance + $dbInstance = $this->getDatabaseInstance(); + + // Get the serialization container within the personell list from + // the database layer + $containerInstance = $dbInstance->getObjectFromCachedData($idNumber); + + // Iterate through the whole container + for ($idx = $containerInstance->getIterator(); $idx->valid(); $idx->next()) { + // Get current item from container + $item = $idx->current(); + + // Validate it a bit + if (is_null($item)) { + // Is null + throw new ContainerItemIsNullException($this, self::EXCEPTION_CONTAINER_ITEM_IS_NULL); + } elseif (!is_array($item)) { + // Is not an array + throw new ContainerItemIsNoArrayException($this, self::EXCEPTION_ITEM_IS_NO_ARRAY); + } elseif ((!isset($item['name'])) || (!isset($item['value']))) { + // Missing elements + throw new ContainerMaybeDamagedException($this, self::EXCEPTION_CONTAINER_MAYBE_DAMAGED); + } + + // Okay, now we can get the item and generate a valid command for eval(). + // We need to convert the first letter to lower-case but keep all others intact + $eval = sprintf("\$this->%s = \$item['value'];", + strtolower(substr($item['name'], 0, 1)) + . + substr($item['name'], 1) + ); + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruierte PHP-Anweisung:
%s

\n", + __CLASS__, + __LINE__, + htmlentities($eval) + )); + + // Run the command + @eval($eval); + } + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/personell/company/.htaccess b/application/ship-simu/main/personell/company/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/personell/company/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/personell/company/class_CompanyEmployee.php b/application/ship-simu/main/personell/company/class_CompanyEmployee.php new file mode 100644 index 0000000..1ea8ab2 --- /dev/null +++ b/application/ship-simu/main/personell/company/class_CompanyEmployee.php @@ -0,0 +1,102 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Firmenangestellte(r)"); + + // Create unique ID + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Generate a specified amount of personell + public static function createCompanyEmployee ($surname, $family, $gender, $year, $month, $day, $married, $salary) { + // Get instance + $personellInstance = new CompanyEmployee(); + + // Debug message + if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) { + $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Der/Die Angestellte %s %s wird angelegt.
\n", + __CLASS__, + __LINE__, + $surname, + $family + )); + } + + // Ist the given birthday valid? + if ($personellInstance->isDateValid($year, $month, $day)) { + // Set birthday + $personellInstance->setBirthday($year, $month, $day); + } else { + // Something is wrong ... + throw new BirthdayInvalidException(array($year, $month, $day), self::EXCEPTION_BIRTH_DATE_IS_INVALID); + } + + // Set as employed/marrital status + $personellInstance->setEmployed(true); + $personellInstance->setMarried($married); + + // Set surname/family/gender + $personellInstance->setSurname($surname); + $personellInstance->setFamily($family); + $personellInstance->setGender($gender); + + // Set salary + $personellInstance->increaseSalary($salary); + + // Tidy up a little + $personellInstance->removeEmployeeList(); + $personellInstance->removeMinMaxAge(); + + // Return prepared instance + return $personellInstance; + } + + // Remove the employee list + private function removeEmployeeList () { + if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) { + $this->getDebugInstance()->output(sprintf("[%s:%d] Angestellten-List entfernt.
\n", + __CLASS__, + __LINE__ + )); + } + unset($this->employeeList); + } + + /** + * Call parent method + */ + public function saveObjectToDatabase () { + parent::saveObjectToDatabase(); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + parent::limitObject($limitInstance); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/ships/.htaccess b/application/ship-simu/main/ships/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/ships/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/ships/class_BaseShip.php b/application/ship-simu/main/ships/class_BaseShip.php new file mode 100644 index 0000000..65e4da0 --- /dev/null +++ b/application/ship-simu/main/ships/class_BaseShip.php @@ -0,0 +1,233 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Bezeichnung setzen + $this->setPartDescr("Schiff"); + + // Array-Objekt generieren + $this->createStructuresArray(); + + // Instanz entfernen + $this->removePartInstance(); + $this->removeNumberFormaters(); + } + + // Konstruktor aufrufen + public function constructor ($class) { + $this->__construct($class); + } + + // Array-Objekt anlegen + private function createStructuresArray () { + $this->structures = new FrameworkArrayObject(); + } + + // Schiffsteil generieren (kann alles sein) + // buildInstance = Das was in das Schiffsteil evtl. eingebaut werden soll (null = kein besonderes Teil einbauen!) + // partClass = Das zu konstruierende Schiffsteil + public function createShipPart (ConstructableShipPart $buildInstance, $partClass) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s erhält ein neues Schiffsteil (%s).
\n", + __CLASS__, + __LINE__, + $this->getShipName(), + $partClass + )); + + // Ist die gewuenschte Klasse vorhanden? + if (class_exists($partClass)) { + // Befehl zusammenbauen + $eval = sprintf("\$partInstance = %s::create%s();", + $partClass, $partClass + ); + + // Debug-Meldung ausgeben + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruierte PHP-Anweisung:
%s

\n", + __CLASS__, + __LINE__, + htmlentities($eval) + )); + + // ... und ausfuehren + eval($eval); + } else { + // Nicht vorhanden, dann Ausnahme werfen! + throw new ClassNotFoundException($partClass, 0); + } + + // Das Einbauen versuchen... + try { + $partInstance->addShipPartToShip($this, $buildInstance); + } catch (MotorShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keinen Motor erhalten! Grund: %s
\n", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + } catch (RoomShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keinen Maschinenraum erhalten! Grund: %s
\n", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + + } catch (StructureShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keine Aufbauten erhalten! Grund: %s
\n", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + } catch (CabinShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keine Kabine erhalten! Grund: %s
\n", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + } catch (DeckShipMismatchException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat kein Deck erhalten! Grund: %s
\n", + __CLASS__, + __LINE__, + $this->getShipName(), + $e->getMessage() + )); + return false; + } catch (ExceptionNotChangedException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Eine Exception wurde nicht geändert. Details: %s
\n", + __CLASS__, + __LINE__, + $e->getMessage() + )); + return false; + } catch (ExceptionNotFoundException $e) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Eine Exception wurde nicht gefunden. Details: %s
\n", + __CLASS__, + __LINE__, + $e->getMessage() + )); + return false; + } + + // Instanz im Aufbauten-Array vermerken + $this->structures->append($partInstance); + + // Debug-Meldung ausgeben + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat das Schiffsteil %s eingebaut bekommen.
\n", + __CLASS__, + __LINE__, + $this->getShipName(), + $partInstance->getPartDescr() + )); + + // Alles klar! + return true; + } + + // Getter-Methode fuer Strukturen-Array + public function getStructuresArray () { + return $this->structures; + } + + // STUB: Getter-Methode Anzahl Betten + public function calcTotalBeds () { + $this->getDebugInstance()->output("[%s:%d] Stub! Anzahl Betten erreicht.
\n"); + return 0; + } + + // Setter-Methode fuer Schiffsnamen + public function setShipName ($shipName) { + // Cast the string + $shipName = (string) $shipName; + + // Debug message + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das neue Schiff vom Typ %s wird auf den Namen %s getauft.
\n", + __CLASS__, + __LINE__, + $this->__toString(), + $shipName + )); + + // Set ship name + $this->shipName = $shipName; + } + + // Getter-Methode fuer Schiffsnamen + public function getShipName () { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das %s ist auf den Namen %s getauft worden.
\n", + __CLASS__, + __LINE__, + $this->__toString(), + $this->shipName + )); + return $this->shipName; + } + + // Setter-Methode fuer Tiefgang + public function setDraught ($draught) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das %s mit dem Namen %s hat einen Tiefgang von %sm.
\n", + __CLASS__, + __LINE__, + $this->__toString(), + $this->shipName, + $draught + )); + $this->draught = (int) $draught; + } + + // Getter-Methode fuer Tiefgang + public function getDraught() { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Tiefgang des Schiffes %s wurde angefordert.
\n", + __CLASS__, + __LINE__, + $this->shipName + )); + return $this->draught; + } + + // Setter-Methode fuer Anzahl Anker + public function setNumAnchor ($numAnchor) { + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das %s mit dem Namen %s hat %s Anker.
\n", + __CLASS__, + __LINE__, + $this->__toString(), + $this->shipName, + $numAnchor + )); + $this->numAnchor = (int) $numAnchor; + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/ships/passenger/.htaccess b/application/ship-simu/main/ships/passenger/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/ships/passenger/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/ships/passenger/class_PassengerShip.php b/application/ship-simu/main/ships/passenger/class_PassengerShip.php new file mode 100644 index 0000000..de78050 --- /dev/null +++ b/application/ship-simu/main/ships/passenger/class_PassengerShip.php @@ -0,0 +1,130 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Passagier-Schiff"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Passagier-Schiff erstellen + public static function createPassengerShip ($shipName) { + // Instanz holen + $passInstance = new PassengerShip(); + + // Debug message + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) { + $passInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Passagier-Schiff wird erstellt.
\n", + __CLASS__, + __LINE__ + )); + } + + // Set ship's name + $passInstance->setShipName($shipName); + + // Instanz zurueckgeben + return $passInstance; + } + + // Anzahl Betten ermitteln + final function calcTotalBeds () { + // Struktur-Array holen + $struct = $this->getStructuresArray(); + + if (is_null($struct)) { + // Empty structures list! + throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY); + } + + // Anzahl Betten auf 0 setzen + $numBeds = 0; + + // Alle Strukturen nach Kabinen durchsuchen + for ($idx = $struct->getIterator(); $idx->valid(); $idx->next()) { + // Element holen + $el = $idx->current(); + + // Ist es eine Kabine? + if ($el->isCabin()) { + // Anzahl Betten ermitteln + $total = $el->calcTotalBedsByCabin(); + $numBeds += $total; + + // Debug-Meldung ausgeben? + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) { + // Instanz holen + $cabType = "Kabine ohne Namen"; + $cab = $el->getPartInstance(); + if (!is_null($cab)) { + // Kabinenbeschreibung holen + $cabType = $cab->getPartDescr(); + } + + // Debug-Meldung ausgeben + $this->getDebugInstance()->output(sprintf("[%s:%d] Es stehen %d Betten vom Kabinen-Typ %s bereit.
\n", + __CLASS__, + __LINE__, + $total, + $cabType + )); + } + } else { + // Keine Kabine! + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %s ist keine Kabine.
\n", + __CLASS__, + __LINE__, + $el->getPartDescr() + )); + } + } + + if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das %s mit dem Namen %s hat %d Betten.
\n", + __CLASS__, + __LINE__, + $this->getPartDescr(), + $this->getShipName(), + $numBeds + )); + + // Anzahl zurueckliefern + return $numBeds; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/.htaccess b/application/ship-simu/main/structures/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/structures/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/structures/class_BaseStructure.php b/application/ship-simu/main/structures/class_BaseStructure.php new file mode 100644 index 0000000..3e8d3f0 --- /dev/null +++ b/application/ship-simu/main/structures/class_BaseStructure.php @@ -0,0 +1,49 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Schiffsstrukturen"); + + // Etwas aufraeumen + $this->removeNumberFormaters(); + } + + // Konstruktor aufrufen + public function constructor ($class) { + $this->__construct($class); + } + + // Setter for price + public function setPrice ($price) { + $this->price = (float) $price; + } + + // Getter for price + public function getPrice () { + return $this->price; + } + + // Remove price + public function removePrice () { + unset($this->price); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/.htaccess b/application/ship-simu/main/structures/extended/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/structures/extended/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/structures/extended/cabines/.htaccess b/application/ship-simu/main/structures/extended/cabines/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/structures/extended/cabines/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php b/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php new file mode 100644 index 0000000..a70be56 --- /dev/null +++ b/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php @@ -0,0 +1,73 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Kabine"); + + // Maybe clean up a little + if ($class == __CLASS__) { + $this->removeSystemArray(); + } + } + + // Konstruktor aufrufen + public function constructor ($class) { + $this->__construct($class); + } + + // Allgemeine Kabine erstellen + public static function createBaseCabin () { + // Instanz holen + $cabinInstance = new BaseCabin(__CLASS__); + + // Debug message + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $cabinInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine allgemeine Kabine wird erstellt.
\n", + __CLASS__, + __LINE__ + )); + + // Unique-ID erzeugen + $cabinInstance->createUniqueID(); + + // Instanz zurueckgeben + return $cabinInstance; + } + + // Is this a cabin? + public function isCabin () { + return ($this->isClass("BaseCabin")); + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/cabines/ship/.htaccess b/application/ship-simu/main/structures/extended/cabines/ship/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/structures/extended/cabines/ship/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php b/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php new file mode 100644 index 0000000..bc1bde2 --- /dev/null +++ b/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php @@ -0,0 +1,97 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Economy-Class-Kabine"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Economy-Kabine erstellen + public static function createEconomyCabin ($numLuxury, $numRooms, $numBeds, $dim) { + // Instanz holen + $ecoInstance = new EconomyCabin(); + + // Debug message + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $ecoInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Economy-Class-Kabine wird konstruiert...
\n", + __CLASS__, + __LINE__ + )); + + // Abmasse extrahieren + $ecoInstance->extractDimensions($dim); + + // Den Rest auch setzen + $ecoInstance->setNumCabin($numLuxury); + $ecoInstance->setNumRooms($numRooms); + $ecoInstance->setNumBeds($numBeds); + + // Nicht noetig! + $ecoInstance->removePartInstance(); + + // Instanz zurueckgeben + return $ecoInstance; + } + + // Loesch-Methode fuer Anzahl Betten + public function removeNumBeds() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numBeds); + parent::removeNumBeds(); + } + + // Loesch-Methode fuer Anzahl Kabinen + public function removeNumCabin() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numCabin); + parent::removeNumCabin(); + } + + // Loesch-Methode fuer Anzahl Raeume + public function removeNumRooms() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numRooms); + parent::removeNumRooms(); + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php b/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php new file mode 100644 index 0000000..4c6d263 --- /dev/null +++ b/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php @@ -0,0 +1,95 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Beschreibung setzen + $this->setPartDescr("2Star-Class-Kabine"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // 2-Sterne-Klasse erstellen + public static function createLowCabin ($numLuxury, $numRooms, $numBeds, $dim) { + // Instanz holen + $lowInstance = new LowCabin(); + + // Debug message + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $lowInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine 2-Sterne-Kabine wird konstruiert...
\n", + __CLASS__, + __LINE__ + )); + + // Abmasse extrahieren + $lowInstance->extractDimensions($dim); + + // Den Rest auch setzen + $lowInstance->setNumCabin($numLuxury); + $lowInstance->setNumRooms($numRooms); + $lowInstance->setNumBeds($numBeds); + + // Nicht noetig! + $lowInstance->removePartInstance(); + + // Instanz zurueckgeben + return $lowInstance; + } + + // Loesch-Methode fuer Anzahl Betten + public function removeNumBeds() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numBeds); + parent::removeNumBeds(); + } + + // Loesch-Methode fuer Anzahl Kabinen + public function removeNumCabin() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numCabin); + parent::removeNumCabin(); + } + + // Loesch-Methode fuer Anzahl Raeume + public function removeNumRooms() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numRooms); + parent::removeNumRooms(); + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php b/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php new file mode 100644 index 0000000..bc36d6e --- /dev/null +++ b/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php @@ -0,0 +1,95 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Beschreibung setzen + $this->setPartDescr("Luxuskabine"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Eine Luxuskabine erstellen + public static function createLuxuryCabin ($numLuxury, $numRooms, $numBeds, $dim) { + // Instanz holen + $luxuryInstance = new LuxuryCabin(); + + // Debug message + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $luxuryInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Luxuskabine wird konstruiert...
\n", + __CLASS__, + __LINE__ + )); + + // Abmasse extrahieren + $luxuryInstance->extractDimensions($dim); + + // Den Rest auch setzen + $luxuryInstance->setNumCabin($numLuxury); + $luxuryInstance->setNumRooms($numRooms); + $luxuryInstance->setNumBeds($numBeds); + + // Nicht noetig! + $luxuryInstance->removePartInstance(); + + // Instanz zurueckgeben + return $luxuryInstance; + } + + // Loesch-Methode fuer Anzahl Betten + public function removeNumBeds() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numBeds); + parent::removeNumBeds(); + } + + // Loesch-Methode fuer Anzahl Kabinen + public function removeNumCabin() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numCabin); + parent::removeNumCabin(); + } + + // Loesch-Methode fuer Anzahl Raeume + public function removeNumRooms() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numRooms); + parent::removeNumRooms(); + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php b/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php new file mode 100644 index 0000000..99b41b2 --- /dev/null +++ b/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php @@ -0,0 +1,92 @@ +getDebugInstance()->output(sprintf("[PremierCabin:] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Beschreibung setzen + $this->setPartDescr("Premier-Class-Kabine"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Premier-Kabine erstellen + public static function createPremierCabin ($numLuxury, $numRooms, $numBeds, $dim) { + // Instanz holen + $premierInstance = new PremierCabin(); + + // Debug message + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $premierInstance->getDebugInstance()->output("[PremierCabin:] Eine Premier-Kabine wird konstruiert...
\n"); + + // Abmasse extrahieren + $premierInstance->extractDimensions($dim); + + // Den Rest auch setzen + $premierInstance->setNumCabin($numLuxury); + $premierInstance->setNumRooms($numRooms); + $premierInstance->setNumBeds($numBeds); + + // Nicht noetig! + $premierInstance->removePartInstance(); + + // Instanz zurueckgeben + return $premierInstance; + } + + // Loesch-Methode fuer Anzahl Betten + public function removeNumBeds() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numBeds); + parent::removeNumBeds(); + } + + // Loesch-Methode fuer Anzahl Kabinen + public function removeNumCabin() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numCabin); + parent::removeNumCabin(); + } + + // Loesch-Methode fuer Anzahl Raeume + public function removeNumRooms() { + if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numRooms); + parent::removeNumRooms(); + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/class_ b/application/ship-simu/main/structures/extended/class_ new file mode 100644 index 0000000..9644fd5 --- /dev/null +++ b/application/ship-simu/main/structures/extended/class_ @@ -0,0 +1,7 @@ + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + die("limitObject() reached! Stub!"); + } diff --git a/application/ship-simu/main/structures/extended/class_BaseCabinStructure.php b/application/ship-simu/main/structures/extended/class_BaseCabinStructure.php new file mode 100644 index 0000000..7d7d7fb --- /dev/null +++ b/application/ship-simu/main/structures/extended/class_BaseCabinStructure.php @@ -0,0 +1,186 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Kabinenstruktur"); + } + + // Konstruktor aufrufen + public function constructor ($class) { + $this->__construct($class); + } + + // Kabine hinzufuegen + public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $cabinInstance) { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Kabine %s wird für das Schiff %s konstruiert.
\n", + __CLASS__, + __LINE__, + $cabinInstance->getPartDescr(), + $shipInstance->getShipName() + )); + + // Eltern-Methode aufrufen + parent::addShipPartToShip ($shipInstance, $cabinInstance); + + // Restlichen Daten ebenfalls + $this->setNumCabin($cabinInstance->numCabin); + $this->setNumRooms($cabinInstance->numRooms); + $this->setNumBeds($cabinInstance->numBeds); + + // Unnoetige Attribute entfernen + $cabinInstance->removeNumCabin(); + $cabinInstance->removeNumRooms(); + $cabinInstance->removeNumBeds(); + + // Instanz setzen + $this->setDeckInstance($cabinInstance); + + // Einbaut-Meldung ausgeben + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Kabine %s wurde in das Schiff eingebaut.
\n", + __CLASS__, + __LINE__, + $cabinInstance->getPartDescr(), + $shipInstance->getShipName() + )); + } + + // Wrapper fuer setDeckInstance->setPartInstance + public function setDeckInstance ($deck) { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Wrapper setDeckInstance->setPartInstance erreicht.
\n", + __CLASS__, + __LINE__ + )); + parent::setPartInstance($deck); + } + + // Getter-Methode fuer Anzahl Betten + public function getNumBeds () { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Betten angefordert.
\n", + __CLASS__, + __LINE__, + $this->numBeds + )); + return $this->numBeds; + } + + // Getter-Methode fuer Anzahl Kabinen + public function getNumCabin () { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Kabine(n) angefordert.
\n", + __CLASS__, + __LINE__, + $this->numCabin + )); + return $this->numCabin; + } + + // Setter-Methode fuer Anzahl Betten + public function setNumBeds ($numBeds) { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Betten gesetzt.
\n", + __CLASS__, + __LINE__, + $numBeds + )); + $this->numBeds = $numBeds; + } + + // Setter-Methode fuer Anzahl Raeume + public function setNumRooms ($numRooms) { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Raum/Räume gesetzt.
\n", + __CLASS__, + __LINE__, + $numRooms + )); + $this->numRooms = $numRooms; + } + + // Setter-Methode fuer Anzahl Kabinen + public function setNumCabin ($numCabin) { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Kabine(n) gesetzt.
\n", + __CLASS__, + __LINE__, + $numCabin + )); + $this->numCabin = $numCabin; + } + + // Loesch-Methode fuer Anzahl Betten + public function removeNumBeds() { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numBeds); + } + + // Loesch-Methode fuer Anzahl Kabinen + public function removeNumCabin() { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numCabin); + } + + // Loesch-Methode fuer Anzahl Raeume + public function removeNumRooms() { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numRooms); + } + + // Bettenanzahl pro Kabine berechnen + public function calcTotalBedsByCabin () { + // Dann Bettenanzahl holen und aufaddieren + $beds = $this->getNumBeds(); + $num = $this->getNumCabin(); + $cabinBeds = $beds * $num; + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) { + // Instanz holen + $cabType = "Kabine ohne Namen"; + $cab = $this->getPartInstance(); + if (!is_null($cab)) { + // Kabinenbeschreibung holen + $cabType = $cab->__toString(); + } + + // Debug-Meldung ausgeben + $this->getDebugInstance()->output(sprintf("[%s:%d] Es exisitieren %d Kabinen vom Typ %s zu je %d Betten. Das sind %d Betten.
\n", + __CLASS__, + __LINE__, + $num, + $cabType, + $beds, + $cabinBeds + )); + } + return $cabinBeds; + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php b/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php new file mode 100644 index 0000000..1b225ca --- /dev/null +++ b/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php @@ -0,0 +1,74 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Deckstruktur"); + } + + // Konstruktor aufrufen + public function constructor ($class) { + $this->__construct($class); + } + + // Deckstruktur dem Schiff hinzufuegen + public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $deckInstance) { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Deck %s wird für das Schiff %s konstruiert.
\n", + __CLASS__, + __LINE__, + $deckInstance->getPartDescr(), + $shipInstance->getShipName() + )); + + // Eltern-Methode aufrufen + parent::addShipPartToShip($shipInstance, $deckInstance); + + // Andere Daten uebertragen und von der Quelle loeschen + $this->setNumDecks($deckInstance->getNumDecks()); + $deckInstance->removeNumDecks(); + + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Deck %s wurde in das Schiff %s eingebaut.
\n", + __CLASS__, + __LINE__, + $deckInstance->getPartDescr(), + $shipInstance->getShipName() + )); + } + + // Deckanzahl entfernen + public function removeNumDecks() { + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gelöscht.
\n", + __CLASS__, + __LINE__ + )); + unset($this->numDecks); + } + + // Setter-Methode fuer Anzahl Decks + public function setNumDecks($numDecks) { + $this->numDecks = (int) $numDecks; + } + + // Getter-Methode fuer Anzahl Decks + public function getNumDecks() { + return $this->numDecks; + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php b/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php new file mode 100644 index 0000000..06bdf30 --- /dev/null +++ b/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php @@ -0,0 +1,76 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + } + + // Beschreibung setzen + $this->setPartDescr("Aufbauten"); + + // Shall we clean up? + if ($class == __CLASS__) { + $this->removeSystemArray(); + } + } + + /** + * Call new constructor + */ + function constructor ($class) { + $this->__construct($class); + } + + /** + * Creates an upper(=super) structure + */ + public static function createBaseUpperStructure () { + // Instanz holen + $upperInstance = new BaseUpperStructure (__CLASS__); + + // Debug message + if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) { + $upperInstance->getDebugInstance()->output(sprintf("[%s:%d] Aufbauten wird konstruiert.
\n", + __CLASS__, + __LINE__ + )); + } + + // Unique-ID setzen + $upperInstance->createUniqueID(); + + // Return instance + return $upperInstance; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/decks/.htaccess b/application/ship-simu/main/structures/extended/decks/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/structures/extended/decks/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/structures/extended/decks/cargo/.htaccess b/application/ship-simu/main/structures/extended/decks/cargo/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/structures/extended/decks/cargo/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php b/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php new file mode 100644 index 0000000..b95faf6 --- /dev/null +++ b/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php @@ -0,0 +1,82 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Beschreibung setzen + $this->setPartDescr("Autodeck"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Autodeck erstellen + public static function createCarDeck ($numDecks, $dim) { + // Instanz holen + $carInstance = new CarDeck(); + + // Debug message + if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $carInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Autodeck wird konstruiert...
\n", + __CLASS__, + __LINE__ + )); + + // Abmasse extrahieren + $carInstance->extractDimensions($dim); + + // Andere Daten uebetragen + $carInstance->setNumDecks($numDecks); + + // Nicht noetige Instanz + $carInstance->removePartInstance(); + + // Instanz zurueckgeben + return $carInstance; + } + + // Deckanzahl entfernen + public function removeNumDecks() { + if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gelöscht.
\n", + __CLASS__, + __LINE__ + )); + parent::removeNumDecks(); + } + + // Setter-Methode fuer Anzahl Decks + public function setNumDecks($numDecks) { + parent::setNumDecks($numDecks); + } + + // Getter-Methode fuer Anzahl Decks + public function getNumDecks() { + return parent::getNumDecks(); + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php b/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php new file mode 100644 index 0000000..840c1aa --- /dev/null +++ b/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php @@ -0,0 +1,82 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Beschreibung setzen + $this->setPartDescr("Zug-Deck"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // LKW-Deck erstellen + public static function createTrainDeck ($numDecks, $dim) { + // Instanz holen + $trainInstance = new TrainDeck(); + + // Debug message + if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $trainInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein LKW-Deck wird konstruiert...
\n", + __CLASS__, + __LINE__ + )); + + // Abmasse extrahieren + $trainInstance->extractDimensions($dim); + + // Andere Daten uebetragen + $trainInstance->setNumDecks($numDecks); + + // Nicht noetige Instanz + $trainInstance->removePartInstance(); + + // Instanz zurueckliefern + return $trainInstance; + } + + // Deckanzahl entfernen + public function removeNumDecks() { + if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gelöscht.
\n", + __CLASS__, + __LINE__ + )); + parent::removeNumDecks(); + } + + // Setter-Methode fuer Anzahl Decks + public function setNumDecks ($numDecks) { + parent::setNumDecks($numDecks); + } + + // Getter-Methode fuer Anzahl Decks + public function getNumDecks() { + return parent::getNumDecks(); + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php b/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php new file mode 100644 index 0000000..ecccce2 --- /dev/null +++ b/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php @@ -0,0 +1,82 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Beschreibung setzen + $this->setPartDescr("LKW-Deck"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // LKW-Deck erstellen + public static function createTruckDeck ($numDecks, $dim) { + // Instanz holen + $truckInstance = new TruckDeck(); + + // Debug message + if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $truckInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein LKW-Deck wird konstruiert...
\n", + __CLASS__, + __LINE__ + )); + + // Abmasse extrahieren + $truckInstance->extractDimensions($dim); + + // Andere Daten uebetragen + $truckInstance->setNumDecks($numDecks); + + // Nicht noetige Instanz + $truckInstance->removePartInstance(); + + // Instanz zurueckliefern + return $truckInstance; + } + + // Deckanzahl entfernen + public function removeNumDecks() { + if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gelöscht.
\n", + __CLASS__, + __LINE__ + )); + parent::removeNumDecks(); + } + + // Setter-Methode fuer Anzahl Decks + public function setNumDecks ($numDecks) { + parent::setNumDecks($numDecks); + } + + // Getter-Methode fuer Anzahl Decks + public function getNumDecks() { + return parent::getNumDecks(); + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php b/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php new file mode 100644 index 0000000..ba1a32f --- /dev/null +++ b/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php @@ -0,0 +1,61 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Beschreibung setzen + $this->setPartDescr("Deck"); + + // Maybe clean up? + if ($class == __CLASS__) { + $this->removeSystemArray(); + } + } + + // Ruft nur den privaten Konstruktor auf + public function constructor ($class) { + $this->__construct($class); + } + + // Ein allgemeines Deck erstellen + public static function createBaseDeck () { + // Instanz holen + $deckInstance = new BaseDeck(__CLASS__); + + // Debug message + if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $deckInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein allgemeines Deck wird konstruiert.
\n", + __CLASS__, + __LINE__ + )); + + // Unique-ID setzen + $deckInstance->createUniqueID(); + + // Instanz zurueckgeben + return $deckInstance; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/structures/extended/lower/.htaccess b/application/ship-simu/main/structures/extended/lower/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/structures/extended/lower/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/structures/extended/upper/.htaccess b/application/ship-simu/main/structures/extended/upper/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/main/structures/extended/upper/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/main/structures/extended/upper/class_Bridge.php b/application/ship-simu/main/structures/extended/upper/class_Bridge.php new file mode 100644 index 0000000..08ea8e7 --- /dev/null +++ b/application/ship-simu/main/structures/extended/upper/class_Bridge.php @@ -0,0 +1,70 @@ +getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", + __CLASS__, + __LINE__ + )); + + // Beschreibung setzen + $this->setPartDescr("Brücke"); + + // Unique-ID erzeugen + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + $this->removePartInstance(); + } + + // Eine Kommandobruecke erstellen + public static function createBridge ($width, $height, $length) { + // Instanz holen + $bridgeInstance = new Bridge(); + + // Debug message + if ((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) $bridgeInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Brücke wird konstruiert...
\n", + __CLASS__, + __LINE__ + )); + + // Abmasse setzen + $bridgeInstance->setWidth($width); + $bridgeInstance->setHeight($height); + $bridgeInstance->setLength($length); + + // Instanz zurueckgeben + return $bridgeInstance; + } + + // Overwritten method for tradeable items + public function isTradeable () { + return true; + } + + /** + * Stub! + */ + public function saveObjectToDatabase () { + $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", + $this->__toString(), + __FUNCTION__ + )); + } + + /** + * Limits this object with an ObjectLimits instance + */ + public function limitObject (ObjectLimits $limitInstance) { + ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + } +} + +// [EOF] +?> diff --git a/application/ship-simu/starter.php b/application/ship-simu/starter.php new file mode 100644 index 0000000..1e6e523 --- /dev/null +++ b/application/ship-simu/starter.php @@ -0,0 +1,42 @@ +%s kann nicht gestartet werden, da die Hilfsklasse %s nicht geladen ist!", + $application, + FrameworkConfiguration::getInstance()->readConfig("app_helper_class") + )); +} elseif (!is_object($app)) { + // No object! + ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die 'app' kein Objekt ist!", + $application + )); +} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) { + // Method not found! + ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die Methode %s fehlt!", + $application, + FrameworkConfiguration::getInstance()->readConfig("entry_method") + )); +} + +// Call the entry point method +try { + $eval = sprintf("%s::getInstance()->%s();", + FrameworkConfiguration::getInstance()->readConfig("app_helper_class"), + FrameworkConfiguration::getInstance()->readConfig("entry_method") + ); + eval($eval); +} catch (FrameworkException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden. Grund: %s", + $application, + $e->getMessage() + )); +} + + +// [EOF] +?> diff --git a/application/ship-simu/templates/.htaccess b/application/ship-simu/templates/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/templates/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/templates/de/.htaccess b/application/ship-simu/templates/de/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/templates/de/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/templates/de/html/.htaccess b/application/ship-simu/templates/de/html/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/ship-simu/templates/de/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/ship-simu/templates/de/html/selector_ship-simu.tpl b/application/ship-simu/templates/de/html/selector_ship-simu.tpl new file mode 100644 index 0000000..d56a95f --- /dev/null +++ b/application/ship-simu/templates/de/html/selector_ship-simu.tpl @@ -0,0 +1,17 @@ +
+
+ Gründen Sie eine virtuelle Reederei an den bedeutestens + Welthäfen! Oder treten Sie einer Reederei als Angestellter bei und + arbeiten Sie sich bis in die Chef-Etagge hoch! +
+ +
+ Oder fangen Sie als Matrose auf einem Passagierschiff (virtuell) an zu + arbeiten und werden Sie nach wenigen Kreuzfahrten bald Kapitän! +
+ +
+ Oder buchen Sie eine virtuelle Kreuzfahrt durch die bekannten Meeren in + {!POINTS!} in einer Luxus-Suite! +
+
diff --git a/db/.htaccess b/db/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/db/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/devel/.htaccess b/devel/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/devel/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/devel/class_Debug.php b/devel/class_Debug.php new file mode 100644 index 0000000..1adbe5a --- /dev/null +++ b/devel/class_Debug.php @@ -0,0 +1,58 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 Debug { + // Constructor + public function __construct () { + // Konstruktoren debuggen (nur im Zusammenhang mit den folgenden Schaltern effektiv) + // VIELE DEBUG-MELDUNGEN!!! + //define('DEBUG_CONSTRUCT', true); + // eval()-Befehle debuggen + //define('DEBUG_EVAL', true); + // Systeme debuggen + //define('DEBUG_SYSTEM', true); + // SimulatorBase debuggen (VORSICHT! SEHR VIELE DEBUG-MELDUNGEN!!!) + //define('DEBUG_CORE', true); + //////// Objekte debuggen (ausgeben) //////// + // Datenbank-Objekt debuggen + //define('DEBUG_DATABASE_OBJ', true); + //////// Alles unteren debuggen //////// + //define('DEBUG_ALL', true); + // Kompressor debuggen + //define('DEBUG_COMPRESSOR', true); + // Datenbankschichten debuggen + //define('DEBUG_DATABASE', true); + // Template-System debuggen + //define('DEBUG_TEMPLATE', true); + // Konfiguration debuggen + //define('DEBUG_CONFIG', true); + } +} + +/** + * Initialize the dummy debug class + */ +$dummy = new Debug(); +unset($dummy); + +// +?> diff --git a/docs/THANKS b/docs/THANKS new file mode 100644 index 0000000..bd56a2c --- /dev/null +++ b/docs/THANKS @@ -0,0 +1,6 @@ +Special Thanks goes to: + - Daff + - toms + - And all the others I have not listed here. + +If you think your name is missing here please ICQ me: 8809296 diff --git a/inc/.htaccess b/inc/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes.php b/inc/classes.php new file mode 100644 index 0000000..fb00ebf --- /dev/null +++ b/inc/classes.php @@ -0,0 +1,66 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ + +// Lower framework classes +$lowerClasses = array( + 0 => "exceptions", // Exceptions + 1 => "interfaces", // Interfaces + 2 => "main", // General main classes + 3 => "middleware" // The middleware +); + +// Load all classes +foreach ($lowerClasses as $class) { + // Try to load the framework classes + try { + ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $class)); + } catch (PathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + $class + )); + } catch (PathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + $class + )); + } catch (PathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + $class + )); + } catch (DirPointerNotOpenedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + $class + )); + } +} + +// Include all classes +ClassLoader::getInstance()->includeAllClasses(); + +// Clean up the global namespace +unset($lowerClasses[3]); // Applications shall not have any middleware +unset($class); + +////// Until here the framework classes are loaded ////// + +// [EOF] +?> diff --git a/inc/classes/.htaccess b/inc/classes/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/.htaccess b/inc/classes/exceptions/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/class_FrameworkException.php b/inc/classes/exceptions/class_FrameworkException.php new file mode 100644 index 0000000..46a0342 --- /dev/null +++ b/inc/classes/exceptions/class_FrameworkException.php @@ -0,0 +1,95 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ +abstract class FrameworkException extends ReflectionException { + /** + * Array for the backtrace + */ + private $backTrace = array(); + + /** + * The super constructor for all exceptions + * + * @param $message The non-optional message for the exception + * @param $code An optional code for better debugging + * @return void + */ + public function __construct($message, $code = 0) { + // Extract backtrace + $this->saveBackTrace(); + + // Cast all data + $message = (string) $message; + $code = (int) $code; + + // make sure everything is assigned properly + parent::__construct($message, $code); + } + + /** + * Save the current backtrace + * + * @return void + */ + private final function saveBackTrace () { + $this->backTrace = debug_backtrace(); + } + + /** + * Get saved backtrace + * + * @return $backTrace The full backtrace in an array + */ + public final function getBackTrace () { + return $this->backTrace; + } + + /** + * Returns the name of the thrown exception + * + * @return $toString The name of the thrown exception + */ + public function __toString() { + return get_class($this); + } + + /** + * Getter for hex-decimal code + * + * @return $hexCode The exception code in hex-decimal format + */ + public final function getHexCode () { + // Get the decimal code + $code = $this->getCode(); + + // Format it to hex-decimal, 0x as prefix and 3 chars + $hexCode = sprintf("0x%03s", dechex($code)); + + // Return it + return $hexCode; + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/compressor/.htaccess b/inc/classes/exceptions/compressor/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/compressor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php b/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php new file mode 100644 index 0000000..f619601 --- /dev/null +++ b/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php @@ -0,0 +1,53 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 MismatchingCompressorsException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Kompressor %s zu den geladenen Daten aus %s und der aktuell verwendete Kompressor %s stimmen nicht überein!", + $array[0]->__toString(), + $this->getLine(), + strtoupper($array[1]), + sprintf("%s:%s", + basename(dirname($array[2])), + basename($array[2]) + ), + strtoupper($array[3]) + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/container/.htaccess b/inc/classes/exceptions/container/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/container/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php b/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php new file mode 100644 index 0000000..ae3dfad --- /dev/null +++ b/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ContainerItemIsNoArrayException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Ein Container-Item ist kein Array.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/container/class_ContainerItemIsNullException.php b/inc/classes/exceptions/container/class_ContainerItemIsNullException.php new file mode 100644 index 0000000..3d70144 --- /dev/null +++ b/inc/classes/exceptions/container/class_ContainerItemIsNullException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ContainerItemIsNullException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Ein Container-Item ist auf null gesetzt.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php b/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php new file mode 100644 index 0000000..f5e77ac --- /dev/null +++ b/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ContainerMaybeDamagedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Ein Container ist möglicherweise beschädigt.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/database/.htaccess b/inc/classes/exceptions/database/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/database/local_file/.htaccess b/inc/classes/exceptions/database/local_file/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php b/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php new file mode 100644 index 0000000..938edc5 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 SavePathIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Speicherpfad ist leer.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php b/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php new file mode 100644 index 0000000..fa59a43 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 SavePathIsNoDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der angegebene Speicherpfad %s ist ungütig (kein Pfad).", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php b/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php new file mode 100644 index 0000000..8647da1 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 SavePathReadProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der Pfad %s ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php b/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php new file mode 100644 index 0000000..7236f56 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 SavePathWriteProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der angegebene Speicherpfad %s ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/.htaccess b/inc/classes/exceptions/io/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/io/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php b/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php new file mode 100644 index 0000000..a8a616f --- /dev/null +++ b/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DirPointerNotOpenedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Für den Pfad %s konnte kein Pointer initialisiert werden.", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php b/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php new file mode 100644 index 0000000..da5e8fe --- /dev/null +++ b/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FilePointerNotOpenedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Für die Datei %s konnte kein Pointer initialisiert werden. Möglicherweise ist die Datei nicht lesbar oder fehlt!", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_InvalidDataLengthException.php b/inc/classes/exceptions/io/class_InvalidDataLengthException.php new file mode 100644 index 0000000..7952be8 --- /dev/null +++ b/inc/classes/exceptions/io/class_InvalidDataLengthException.php @@ -0,0 +1,49 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 InvalidDataLengthException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Eine unerwartete Datenlänge von %s Byte ist aufgetreten. %s wurden erwartet!", + $array[0]->__toString(), + $this->getLine(), + $array[1], + $array[2] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php b/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php new file mode 100644 index 0000000..caabc32 --- /dev/null +++ b/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 InvalidDirectoryResourceException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + if (is_null($class)) { + $message = "[???:] Ungütige Verzeichnis-Resource."; + } elseif (is_object($class)) { + $message = sprintf("[%s:%d] Ungütige Verzeichnis-Resource.", + $class->__toString(), + $this->getLine() + ); + } + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php b/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php new file mode 100644 index 0000000..349e713 --- /dev/null +++ b/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php @@ -0,0 +1,49 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 InvalidMD5ChecksumException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Die MD5-Prüfsummen %s und %s stimmen nicht überein!", + $array[0]->__toString(), + $this->getLine(), + $array[1], + $array[2] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_PathIsEmptyException.php b/inc/classes/exceptions/io/class_PathIsEmptyException.php new file mode 100644 index 0000000..cd6010c --- /dev/null +++ b/inc/classes/exceptions/io/class_PathIsEmptyException.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 PathIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + if (is_null($class)) { + $message = "[???:] Der Verzeichnisname ist leer."; + } elseif (is_object($class)) { + $message = sprintf("[%s:%d] Der Verzeichnisname ist leer.", + $class->__toString(), + $this->getLine() + ); + } + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php b/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php new file mode 100644 index 0000000..b458387 --- /dev/null +++ b/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 PathIsNoDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der angegebene Pfad %s ist ungütig (kein Pfad).", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_PathReadProtectedException.php b/inc/classes/exceptions/io/class_PathReadProtectedException.php new file mode 100644 index 0000000..d630daf --- /dev/null +++ b/inc/classes/exceptions/io/class_PathReadProtectedException.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 PathReadProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der Pfad %s ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/language/.htaccess b/inc/classes/exceptions/language/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/language/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php b/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php new file mode 100644 index 0000000..f9656d8 --- /dev/null +++ b/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 InvalidLanguagePathStringException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] %s ist keine Zeichenkette!", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php b/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php new file mode 100644 index 0000000..01068d8 --- /dev/null +++ b/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 LanguagePathIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Sprachen-Basispfad ist leer.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php b/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php new file mode 100644 index 0000000..1761298 --- /dev/null +++ b/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 LanguagePathIsNoDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Sprach-Basispfad %s existiert nicht oder ist eine Datei!", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php b/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php new file mode 100644 index 0000000..f803c42 --- /dev/null +++ b/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 LanguagePathReadProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Sprach-Basispfad %s ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/.htaccess b/inc/classes/exceptions/main/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/main/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/main/class_ClassMismatchException.php b/inc/classes/exceptions/main/class_ClassMismatchException.php new file mode 100644 index 0000000..5f73e05 --- /dev/null +++ b/inc/classes/exceptions/main/class_ClassMismatchException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ClassMismatchException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($classArray, $code) { + // Add a message around the missing class + $message = sprintf("Die Klasse %s ist ungleich %s.", + $classArray[0], + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ClassNotFoundException.php b/inc/classes/exceptions/main/class_ClassNotFoundException.php new file mode 100644 index 0000000..0d3918c --- /dev/null +++ b/inc/classes/exceptions/main/class_ClassNotFoundException.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ClassNotFoundException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("Die interne Script-Klasse %s konnte nicht gefunden werden!", $class); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php b/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php new file mode 100644 index 0000000..497438e --- /dev/null +++ b/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ConfigEntryIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Leeren Konfigurationseintrag angegeben!", + $class, + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php b/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php new file mode 100644 index 0000000..14244c8 --- /dev/null +++ b/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ConfigEntryNotFoundException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct (array $classArray, $code) { + // Cast the array + $classArray = (array) $classArray; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Konfigurationseintrag %s nicht gefunden.", + $classArray[0], + $this->getLine(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php b/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php new file mode 100644 index 0000000..7407c50 --- /dev/null +++ b/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php @@ -0,0 +1,49 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DimNotFoundInArrayException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + if (is_object($class)) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Abmasse konnten nicht extrahiert werden!", + $class->__toString(), + $this->getLine() + ); + } else { + // No class given + $message = sprintf("Please provide a class for %s", __CLASS__); + } + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ExceptionNotChangedException.php b/inc/classes/exceptions/main/class_ExceptionNotChangedException.php new file mode 100644 index 0000000..d6d0635 --- /dev/null +++ b/inc/classes/exceptions/main/class_ExceptionNotChangedException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @deprecated + * + * 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 ExceptionNotChangedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Exception(s) wurde(n) nicht geändert.", + $class, + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ExceptionNotFoundException.php b/inc/classes/exceptions/main/class_ExceptionNotFoundException.php new file mode 100644 index 0000000..04b2685 --- /dev/null +++ b/inc/classes/exceptions/main/class_ExceptionNotFoundException.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ExceptionNotFoundException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct (array $classArray, $code) { + // Cast the array + $classArray = (array) $classArray; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Exception %s nicht gefunden.", + $classArray[0], + $this->getLine(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_GetterNotFoundException.php b/inc/classes/exceptions/main/class_GetterNotFoundException.php new file mode 100644 index 0000000..95ecc95 --- /dev/null +++ b/inc/classes/exceptions/main/class_GetterNotFoundException.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 GetterNotFoundException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($dataArray, $code) { + // Cast the array + $dataArray = (array) $dataArray; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Getter-Methode für Attribut %s nicht gefunden.", + $dataArray[0]->__toString(), + $this->getLine(), + $dataArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_InvalidArrayCountException.php b/inc/classes/exceptions/main/class_InvalidArrayCountException.php new file mode 100644 index 0000000..3c1a7e6 --- /dev/null +++ b/inc/classes/exceptions/main/class_InvalidArrayCountException.php @@ -0,0 +1,50 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 InvalidArrayCountException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] %s hat %d Elemente, soll aber %d enthalten!", + $array[0]->__toString(), + $this->getLine(), + $array[1], + $array[2], + $array[3] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_InvalidObjectException.php b/inc/classes/exceptions/main/class_InvalidObjectException.php new file mode 100644 index 0000000..c847c22 --- /dev/null +++ b/inc/classes/exceptions/main/class_InvalidObjectException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 InvalidObjectException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: %s)", + $class->__toString(), + $this->getLine(), + $class->getPartDescr() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_MissingArrayElementsException.php b/inc/classes/exceptions/main/class_MissingArrayElementsException.php new file mode 100644 index 0000000..aee6090 --- /dev/null +++ b/inc/classes/exceptions/main/class_MissingArrayElementsException.php @@ -0,0 +1,59 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 MissingArrayElementsException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($classArray, $code) { + // Cast the array + $classArray = (array) $classArray; + + // Extract all elements + $elements = ""; + if ((isset($classArray[2])) && (is_array($classArray[2]))) { + // Convert into strings + $elements = implode(", ", $classArray[2]); + } else { + // Invalid data + $elements = "invalid_data"; + } + + // Add a message around the missing class + $message = sprintf("[%s:%d] Das Array %s() keine Elemente %s auf!", + $classArray[0]->__toString(), + $this->getLine(), + $classArray[1], + $elements + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php b/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php new file mode 100644 index 0000000..392474d --- /dev/null +++ b/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @deprecated + * + * 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 MissingDecimalsThousandsSeperatorException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($instance, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Die Dezimal- und Tausendertrenner fehlen!", + $instance->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_MissingMethodException.php b/inc/classes/exceptions/main/class_MissingMethodException.php new file mode 100644 index 0000000..f8c5a68 --- /dev/null +++ b/inc/classes/exceptions/main/class_MissingMethodException.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 MissingMethodException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($classArray, $code) { + // Cast the array + $classArray = (array) $classArray; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Weisst keine Methode %s() auf!", + $classArray[0]->__toString(), + $this->getLine(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NoArrayCreatedException.php b/inc/classes/exceptions/main/class_NoArrayCreatedException.php new file mode 100644 index 0000000..69e4ad2 --- /dev/null +++ b/inc/classes/exceptions/main/class_NoArrayCreatedException.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 NoArrayCreatedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] %s ist kein erstelltes Objekt.", + $array[0]->__toString(), + $this->getLine(), + $array[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NoArrayException.php b/inc/classes/exceptions/main/class_NoArrayException.php new file mode 100644 index 0000000..490a6c0 --- /dev/null +++ b/inc/classes/exceptions/main/class_NoArrayException.php @@ -0,0 +1,43 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 NoArrayException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($string, $code) { + // Add a message around the missing class + $message = sprintf("%s ist kein Array!", + $string + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NoObjectException.php b/inc/classes/exceptions/main/class_NoObjectException.php new file mode 100644 index 0000000..7c7b519 --- /dev/null +++ b/inc/classes/exceptions/main/class_NoObjectException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @deprecated + * @see InvalidObjectException + * + * 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 NoObjectException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($string, $code) { + // Add a message around the missing class + $message = sprintf("%s ist kein Objekt!", + $string + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NullPointerException.php b/inc/classes/exceptions/main/class_NullPointerException.php new file mode 100644 index 0000000..c43f466 --- /dev/null +++ b/inc/classes/exceptions/main/class_NullPointerException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 NullPointerException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Eine Instanz/Pointer ist auf null gesetzt.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_VariableIsNotSetException.php b/inc/classes/exceptions/main/class_VariableIsNotSetException.php new file mode 100644 index 0000000..821dfb4 --- /dev/null +++ b/inc/classes/exceptions/main/class_VariableIsNotSetException.php @@ -0,0 +1,49 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 VariableIsNotSetException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Bei der Initialisierung der Applikation %s wurde keine Variable %s erzeugt.", + $array[0]->__toString(), + $this->getLine(), + $array[1], + $array[2] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/.htaccess b/inc/classes/exceptions/template/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/exceptions/template/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/template/class_BasePathIsEmptyException.php b/inc/classes/exceptions/template/class_BasePathIsEmptyException.php new file mode 100644 index 0000000..4c6cbc5 --- /dev/null +++ b/inc/classes/exceptions/template/class_BasePathIsEmptyException.php @@ -0,0 +1,44 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 BasePathIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Template-Basispfad ist leer.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php b/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php new file mode 100644 index 0000000..4c6de81 --- /dev/null +++ b/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 BasePathIsNoDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Template-Basispfad %s existiert nicht oder ist eine Datei!", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_BasePathReadProtectedException.php b/inc/classes/exceptions/template/class_BasePathReadProtectedException.php new file mode 100644 index 0000000..ea35cfe --- /dev/null +++ b/inc/classes/exceptions/template/class_BasePathReadProtectedException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 BasePathReadProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Template-Basispfad %s ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_InvalidBasePathStringException.php b/inc/classes/exceptions/template/class_InvalidBasePathStringException.php new file mode 100644 index 0000000..36f2002 --- /dev/null +++ b/inc/classes/exceptions/template/class_InvalidBasePathStringException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 InvalidBasePathStringException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] %s ist keine Zeichenkette!", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php new file mode 100644 index 0000000..7683d2c --- /dev/null +++ b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php @@ -0,0 +1,47 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 InvalidTemplateVariableNameException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Die im Template %s gefundene Variable %s ist nicht gültig! Gültige Variablennamen sind nur %s.", + $class[0]->__toString(), + $this->getLine(), + basename($class[1]), + $class[2], + $class[3]->readConfig("tpl_valid_var") + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php b/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php new file mode 100644 index 0000000..5cbe2be --- /dev/null +++ b/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 UnexpectedTemplateTypeException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Template-Typ %s entspricht nicht dem erwartetem Template-Typ %s.", + $class[0]->__toString(), + $this->getLine(), + $class[1], + $class[2] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/.htaccess b/inc/classes/interfaces/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/application/.htaccess b/inc/classes/interfaces/application/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/application/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/application/class_ManageableApplication.php b/inc/classes/interfaces/application/class_ManageableApplication.php new file mode 100644 index 0000000..60584f8 --- /dev/null +++ b/inc/classes/interfaces/application/class_ManageableApplication.php @@ -0,0 +1,82 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ManageableApplication extends FrameworkInterface { + /** + * Getter for application's version number + * + * @return $appVersion The application's version number + */ + function getAppVersion (); + /** + * Setter for application's version number + * + * @param $appVersion The application's version number + * @return void + */ + function setAppVersion ($appVersion); + + /** + * Getter for application's human-readable name + * + * @return $appName The application's name readable for humans + */ + function getAppName (); + + /** + * Setter for application's human-readable name + * + * @param $appName The application's name readable for humans + * @return void + */ + function setAppName ($appName); + + /** + * Getter for application's short uni*-like name + * + * @return $shortName The application's name readable for humans + */ + function getAppShortName (); + + /** + * Setter for application's short uni*-like name + * + * @param $shortName The application's name readable for humans + * @return void + */ + function setAppShortName ($shortName); + + /** + * Launches the application + * + * @return void + */ + function entryPoint (); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/class_FrameworkInterface.php b/inc/classes/interfaces/class_FrameworkInterface.php new file mode 100644 index 0000000..3c9d5ff --- /dev/null +++ b/inc/classes/interfaces/class_FrameworkInterface.php @@ -0,0 +1,28 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FrameworkInterface { +} + +// +?> diff --git a/inc/classes/interfaces/compressor/.htaccess b/inc/classes/interfaces/compressor/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/compressor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/compressor/class_Compressor.php b/inc/classes/interfaces/compressor/class_Compressor.php new file mode 100644 index 0000000..5f42ec3 --- /dev/null +++ b/inc/classes/interfaces/compressor/class_Compressor.php @@ -0,0 +1,51 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 Compressor extends FrameworkInterface { + /** + * A compression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data + * @throws InvalidObjectException If the stream is an object + */ + function compressStream ($streamData); + + /** + * A decompression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data + * @throws InvalidObjectException If the stream is an object + */ + function decompressStream ($streamData); + + /** + * Getter for the file extension of this compressor + * + * @return $string The compressor's file extension + */ + function getCompressorExtension (); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/database/.htaccess b/inc/classes/interfaces/database/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php b/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php new file mode 100644 index 0000000..0b06298 --- /dev/null +++ b/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php @@ -0,0 +1,69 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FrameworkDatabaseInterface extends FrameworkInterface { + /** + * Saves a whole object by serializing it entirely or some specifyable + * parts. Specifying parts must be done before this method is called. If + * it is not done this method will serialize the whole object. + * + * @param $object An instance to the object we want to save + * @return void + * @see limitObject(ObjectLimits) limitObject + */ + function saveObject ($object); + + /** + * Analyses if a unique ID has already been used or not. This method does + * only pass the given ID through to the "real" database layer. + * + * @param $uniqueID A unique ID number which shall be checked + * before it will be used + * @param $inConstructor If called from a constructor 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 NullPointerException If $dbInstance is null + * @throws NoObjectException If $dbInstance is not an object + * @throws MissingMethodException If the required method + * isUniqueIdUsed() was not found + */ + function isUniqueIdUsed ($uniqueID, $inConstructor = false); + + /** + * Gets cached data from the database layer and if not found fetch it from + * the database again. This method does not return the header stuff because + * The underlaying database class will return only the requested content. + * + * @param $idNumber The ID number which we need for looking up + * the requested data + * @return $cachedArray The maybe cached data from the database + * @throws NullPointerException If $dbInstance is null + * @throws NoObjectException If $dbInstance is not an object + * @throws MissingMethodException If the required method + * isUniqueIdUsed() was not found + */ + function getObjectFromCachedData ($idNumber); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/database/frontend/.htaccess b/inc/classes/interfaces/database/frontend/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/database/frontend/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php b/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php new file mode 100644 index 0000000..839ba63 --- /dev/null +++ b/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DatabaseFrontendInterface extends FrameworkDatabaseInterface { + /** + * Loads data saved with saveObject from the database and re-creates a + * full object from it. + * If limitObject() was called before a new object ObjectContainer with + * all requested attributes will be returned instead. + * + * @return Object The fully re-created object or instance to + * ObjectContainer + */ + function loadObject (); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/database/middleware/.htaccess b/inc/classes/interfaces/database/middleware/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/database/middleware/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php b/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php new file mode 100644 index 0000000..0182ef8 --- /dev/null +++ b/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php @@ -0,0 +1,27 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DatabaseConnector extends FrameworkDatabaseInterface { +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/debug/.htaccess b/inc/classes/interfaces/debug/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/debug/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/debug/class_Debugger.php b/inc/classes/interfaces/debug/class_Debugger.php new file mode 100644 index 0000000..46cdeb4 --- /dev/null +++ b/inc/classes/interfaces/debug/class_Debugger.php @@ -0,0 +1,34 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 Debugger extends FrameworkInterface { + /** + * Outputs the given data + * + * @param $output Debug text for output + * @return void + */ + function outputStream ($output); +} + +// +?> diff --git a/inc/classes/interfaces/extended/.htaccess b/inc/classes/interfaces/extended/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/extended/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/extended/class_LimitableObject.php b/inc/classes/interfaces/extended/class_LimitableObject.php new file mode 100644 index 0000000..8ed5eb9 --- /dev/null +++ b/inc/classes/interfaces/extended/class_LimitableObject.php @@ -0,0 +1,39 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 LimitableObject extends FrameworkInterface { + /** + * Reduces the volume of a processed object. + * + * @param $limitInstance An instance to ObjectLimits which holds + * attribute names that we want to include + * in the processing phase. Other attributes + * except $uniqueID and $realClass will be + * ignored and keept out. + * @return void + */ + function limitObject (ObjectLimits $limitInstance); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/io/.htaccess b/inc/classes/interfaces/io/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/io/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/io/class_Streamable.php b/inc/classes/interfaces/io/class_Streamable.php new file mode 100644 index 0000000..1392564 --- /dev/null +++ b/inc/classes/interfaces/io/class_Streamable.php @@ -0,0 +1,27 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 Streamable extends FrameworkInterface { +} + +// +?> diff --git a/inc/classes/interfaces/io/file/.htaccess b/inc/classes/interfaces/io/file/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/io/file/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/io/file/class_FileInputStreamer.php b/inc/classes/interfaces/io/file/class_FileInputStreamer.php new file mode 100644 index 0000000..6204e34 --- /dev/null +++ b/inc/classes/interfaces/io/file/class_FileInputStreamer.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FileInputStreamer extends Streamable { + /** + * Reads from a local or remote file + * + * @param $fqfn The file's FQFN we shall load + * @return $array An array containing all read lines + * @throws NullPointerException If an instance is null + * @throws NoObjectException If the instance is not an object + * instance + * @throws MissingMethodException If a required method is missing. + * @throws InvalidArrayCountException If an array has not the + * expected size + * @throws InvalidMD5ChecksumException If two MD5 hashes did not match + */ + function loadFileContents ($fqfn); +} + +// +?> diff --git a/inc/classes/interfaces/io/file/class_FileOutputStreamer.php b/inc/classes/interfaces/io/file/class_FileOutputStreamer.php new file mode 100644 index 0000000..55bc37e --- /dev/null +++ b/inc/classes/interfaces/io/file/class_FileOutputStreamer.php @@ -0,0 +1,41 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FileOutputStreamer extends Streamable { + /** + * Saves streamed (that are mostly serialized objects) data to files or + * external servers. + * + * @param $fileName The local file's name including full path + * @param $dataArray Array containing the compressor's extension + * and streamed data + * @return void + * @throws NullPointerException If an instance is null + * @throws NoObjectException If the instance is not an object + * instance + * @throws MissingMethodException If a required method is missing. + */ + function saveFile ($fileName, $dataArray); +} + +// +?> diff --git a/inc/classes/interfaces/io/output/.htaccess b/inc/classes/interfaces/io/output/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/io/output/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/io/output/class_OutputStreamer.php b/inc/classes/interfaces/io/output/class_OutputStreamer.php new file mode 100644 index 0000000..6e4431f --- /dev/null +++ b/inc/classes/interfaces/io/output/class_OutputStreamer.php @@ -0,0 +1,42 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 OutputStreamer extends Streamable { + /** + * Assigns a variable for output + * + * @param $var The variable we shall assign + * @param $value The value to store in the variable + * @return void + */ + function assignVariable($var, $value); + + /** + * Output the code + * + * @return void + */ + function output($outStream=false); +} + +// +?> diff --git a/inc/classes/interfaces/language/.htaccess b/inc/classes/interfaces/language/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/language/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/language/class_ManageableLanguage.php b/inc/classes/interfaces/language/class_ManageableLanguage.php new file mode 100644 index 0000000..77f3fbc --- /dev/null +++ b/inc/classes/interfaces/language/class_ManageableLanguage.php @@ -0,0 +1,33 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ManageableLanguage extends FrameworkInterface { + /** + * Initialize the array-object for all later language strings + * + * @return void + */ + function initLanguageStrings(); +} // END - class + +// [EOF] +?> diff --git a/inc/classes/interfaces/template/.htaccess b/inc/classes/interfaces/template/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/interfaces/template/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/template/class_CompileableTemplate.php b/inc/classes/interfaces/template/class_CompileableTemplate.php new file mode 100644 index 0000000..1477f74 --- /dev/null +++ b/inc/classes/interfaces/template/class_CompileableTemplate.php @@ -0,0 +1,97 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 CompileableTemplate extends FrameworkInterface { + /** + * Assign variables for templates + * + * @param $var The "variable" we want to assign + * @param $value The value we want to store in the variable + * @return void + */ + function assignVariable ($var, $value); + + /** + * Assign a configuration variables for templates + * + * @param $var The configuration "variable" we want to assign + * @param $value The value we want to store in the variable + * @return void + */ + function assignConfigVariable ($var, $value); + + /** + * Load a specified web template into the engine + * + * @param $template The web template we shall load which is + * located in "html" by default + * @return void + */ + function loadWebTemplate ($template); + + /** + * Load a specified code template into the engine for later compilation + * with other code/web/email templates. + * + * @param $template The code template we shall load which is + * located in "html" by default + * @return void + */ + function loadCodeTemplate ($template); + + /** + * Load a specified email template into the engine + * + * @param $template The email template we shall load which is + * located in "emails" by default + * @return void + */ + function loadEmailTemplate ($template); + + /** + * Compile all variables by inserting their respective values + * + * @return void + */ + function compileVariables (); + + + /** + * Compile all required code/web/email-templates into the current one + * + * @return void + */ + function compileTemplate (); + + /** + * Output the compiled template to the outside world. In case of web + * templates this would be vaild (X)HTML code. And in case of email + * templates this would store a prepared email body inside the template + * engine. + * + * @return void + */ + function output (); +} // END - class + +// [EOF] +?> diff --git a/inc/classes/main/.htaccess b/inc/classes/main/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php new file mode 100644 index 0000000..3721f63 --- /dev/null +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -0,0 +1,765 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 BaseFrameworkSystem extends stdClass implements FrameworkInterface { + /** + * The instance to the debug output handler (should be DebugConsoleOutput or DebugWebOutput) + * + * @see DebugConsoleOutput + * @see DebugWebOutput + */ + private static $debug = null; + + /** + * The instance to the web output handler (should be WebOutput) + * + * @see WebOutput + */ + private static $webOutput = null; + + /** + * The instance to the compression layer which should be CompressorChannel + */ + private static $compressor = null; + + /** + * The configuration instance which shall be FrameworkConfiguration + */ + private static $cfgInstance = null; + + /** + * The instance to the database layer which should be DatabaseConnection + */ + private $dbInstance = null; + + /** + * The real class name + */ + private $realClass = "FrameworkSystem"; + + /** + * A human-readable description for this simulator part + */ + private $partDescr = "Namenlose Framework-Einheit"; + + /** + * The unique ID string for identifying all type of classes + */ + private $uniqueID = ""; + + /** + * Thousands seperator + */ + private $thousands = "."; // German + + /** + * Decimal seperator + */ + private $decimals = ","; // German + + /*********************** + * Exception codes.... * + ***********************/ + + const EXCEPTION_IS_NULL_POINTER = 0x001; + const EXCEPTION_IS_NO_OBJECT = 0x002; + const EXCEPTION_IS_NO_ARRAY = 0x003; + const EXCEPTION_MISSING_METHOD = 0x004; + const EXCEPTION_CLASSES_NOT_MATCHING = 0x005; + const EXCEPTION_INDEX_OUT_OF_BOUNDS = 0x006; + const EXCEPTION_DIMENSION_ARRAY_INVALID = 0x007; + const EXCEPTION_ITEM_NOT_TRADEABLE = 0x008; + const EXCEPTION_ITEM_NOT_IN_PRICE_LIST = 0x009; + const EXCEPTION_GENDER_IS_WRONG = 0x00a; + const EXCEPTION_BIRTH_DATE_IS_INVALID = 0x00b; + const EXCEPTION_EMPTY_STRUCTURES_ARRAY = 0x00c; + const EXCEPTION_HAS_ALREADY_PERSONELL_LIST = 0x00d; + const EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES = 0x00e; + const EXCEPTION_TOTAL_PRICE_NOT_CALCULATED = 0x00f; + const EXCEPTION_HARBOR_HAS_NO_SHIPYARDS = 0x010; + const EXCEPTION_CONTRACT_PARTNER_INVALID = 0x011; + const EXCEPTION_CONTRACT_PARTNER_MISMATCH = 0x012; + const EXCEPTION_CONTRACT_ALREADY_SIGNED = 0x013; + const EXCEPTION_UNEXPECTED_EMPTY_STRING = 0x014; + const EXCEPTION_PATH_NOT_FOUND = 0x015; + const EXCEPTION_INVALID_PATH_NAME = 0x016; + const EXCEPTION_READ_PROTECED_PATH = 0x017; + const EXCEPTION_WRITE_PROTECED_PATH = 0x018; + const EXCEPTION_DIR_POINTER_INVALID = 0x019; + const EXCEPTION_FILE_POINTER_INVALID = 0x01a; + const EXCEPTION_INVALID_DIRECTORY_POINTER = 0x01b; + const EXCEPTION_UNEXPECTED_OBJECT = 0x01c; + const EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED = 0x01d; + const EXCEPTION_GETTER_IS_MISSING = 0x01e; + const EXCEPTION_ARRAY_EXPECTED = 0x01f; + const EXCEPTION_ARRAY_HAS_INVALID_COUNT = 0x020; + const EXCEPTION_ID_IS_INVALID_FORMAT = 0x021; + const EXCEPTION_MD5_CHECKSUMS_MISMATCH = 0x022; + const EXCEPTION_UNEXPECTED_STRING_SIZE = 0x023; + const EXCEPTION_SIMULATOR_ID_INVALID = 0x024; + const EXCEPTION_MISMATCHING_COMPRESSORS = 0x025; + const EXCEPTION_CONTAINER_ITEM_IS_NULL = 0x026; + const EXCEPTION_ITEM_IS_NO_ARRAY = 0x027; + const EXCEPTION_CONTAINER_MAYBE_DAMAGED = 0x028; + const EXCEPTION_INVALID_STRING = 0x029; + const EXCEPTION_VARIABLE_NOT_SET = 0x02a; + const EXCEPTION_ATTRIBUTES_ARE_MISSING = 0x02b; + const EXCEPTION_ARRAY_ELEMENTS_MISSING = 0x02c; + + /** + * In the super constructor these system classes shall be ignored or else + * we would get an endless calling loop. + * + *--------------------------------------------------------------------* + * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL SHOOT YOUR SERVER!!! * + *--------------------------------------------------------------------* + */ + private $systemClasses = array( + "DebugMiddleware", // Debug middleware output sub-system + "DebugWebOutput", // Debug web output sub-system + "DebugConsoleOutput", // Debug console output sub-system + "DebugErrorLogOutput", // Debug error_log() output sub-system + "CompressorChannel", // Compressor sub-system + "FrameworkDirectoryPointer", // Directory handler sub-system + "NullCompressor", // Null compressor + "Bzip2Compressor", // BZIP2 compressor + "GzipCompressor", // GZIP compressor + "WebOutput", // Web output sub-system + ); + + /** + * Private super constructor + * + * @return void + */ + private function __construct ($class) { + // Set real class + $this->setRealClass($class); + } + + /** + * Destructor reached... + * + * @return void + */ + public function __destruct() { + // Is this object already destroyed? + if ($this->__toString() != "DestructedObject") { + // Debug message + if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { + $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wird zerstört.
\n", + __CLASS__, $this->__toString() + )); + } + + // Destroy all informations about this class but keep some text about it alive + $this->setPartDescr(sprintf("Entferntes Objekt %s", $this->__toString())); + $this->setRealClass("DestructedObject"); + $this->resetUniqueID(); + } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { + // Already destructed object + $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wurde bereits zerstört.
\n", + __CLASS__, $this->__toString() + )); + } + } + + /** + * The call method where all non-implemented methods end up + * + * @return void + */ + public final function __call ($methodName, $args) { + // Implode all given arguments + $argsString = implode("|", $args); + if (empty($argsString)) $argsString = "NULL"; + + $this->getDebugInstance()->output(sprintf("[%s::%s] Stub! Args: %s", + $this->__toString(), + $methodName, + $argsString + )); + + // Return nothing + return null; + } + + /** + * Public constructor (for initializing things, etc.) + * + * @return void + */ + public function constructor ($class) { + // Call constructor + $this->__construct($class); + + // Get the current (singleton) configuration instance + $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration()); + + // Is the class weather debug nor compressor channel? + if (!in_array($class, $this->systemClasses)) { + // Initialize debug instance + if (is_null($this->getDebugInstance())) { + // Set the debug output system if it is not debug class ;) + $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig("debug_engine"))); + } + + // Initialize web instance + if (is_null($this->getWebOutputInstance())) { + // Generate the eval() command + $eval = sprintf("\$this->setWebOutputInstance(%s::create%s(\"%s\"));", + $this->getConfigInstance()->readConfig("web_engine"), + $this->getConfigInstance()->readConfig("web_engine"), + $this->getConfigInstance()->readConfig("web_content_type") + ); + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + $this->__toString(), + htmlentities($eval) + )); + + // Run the command + eval($eval); + } + + // Initialize compressor channel + if (is_null($this->getCompressorChannel())) { + // Set the compressor channel + $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s", + PATH, + $this->getConfigInstance()->readConfig("compressor_base_path") + ))); + } + + // Initialize database middleware + if (is_null($this->getDatabaseInstance())) { + // Get the middleware instance + $db = DatabaseConnection::getInstance(); + if (is_object($db)) { + // Set the database middleware + $this->setDatabaseInstance($db); + } + } + + // Debug output + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Alle Sub-Systeme sind initialisiert.
\n", + $this->__toString() + )); + } + } + + /** + * Setter for language instance + * + * @param $configInstance The configuration instance which shall + * be FrameworkConfiguration + * @return void + */ + public final function setConfigInstance (FrameworkConfiguration $configInstance) { + $this->cfgInstance = $configInstance; + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler auf %s gesetzt.
\n", + $this->__toString(), + $configInstance->__toString() + )); + } + + /** + * Getter for configuration instance + * + * @return $cfhInstance - Configuration instance + */ + public final function getConfigInstance () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler %s angefordert.
\n", + $this->__toString(), + $this->cfgInstance->__toString() + )); + return $this->cfgInstance; + } + + /** + * Setter for debug instance + * + * @param $debugInstance The instance for debug output class + * @return void + */ + public final function setDebugInstance (DebugMiddleware $debugInstance) { + self::$debug = $debugInstance; + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Debug-Handler auf %s gesetzt.
\n", + $this->__toString(), + $this->getDebugInstance()->__toString() + )); + } + + /** + * Getter for debug instance + * + * @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput + */ + public final function getDebugInstance () { + return self::$debug; + } + + /** + * Setter for web output instance + * + * @param $webInstance The instance for web output class + * @return void + */ + public final function setWebOutputInstance (OutputStreamer $webInstance) { + self::$webOutput = $webInstance; + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Web-Handler auf %s gesetzt.
\n", + $this->__toString(), + $this->getWebOutputInstance()->__toString() + )); + } + + /** + * Getter for web output instance + * + * @return $webOutput - Instance to class WebOutput + */ + public final function getWebOutputInstance () { + return self::$webOutput; + } + + /** + * Static setter for database instance + * + * @param $dbInstance The instance for the database connection + * (forced DatabaseConnection) + * @return void + */ + public final function setDatabaseInstance (DatabaseConnection $dbInstance) { + if ((defined('DEBUG_SYSTEM')) && (is_object($dbInstance->getDebugInstance()))) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Datenbankschicht gesetzt.
\n", + $dbInstance->__toString() + )); + $this->dbInstance = $dbInstance; + } + + /** + * Getter for $realClass + * + * @return $realClass The name of the real class (not BaseFrameworkSystem) + */ + public final function __toString () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] __toString() erreicht.
\n", + $this->realClass + )); + return $this->realClass; + } + + /** + * Setter for the real class name + * + * @param $realClass Class name (string) + * @return void + */ + public final function setRealClass ($realClass) { + // Cast to string + $realClass = (string) $realClass; + + // Set real class + $this->realClass = $realClass; + } + + /** + * Generate unique ID from a lot entropy + * + * @return void + */ + public final function createUniqueID () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID aufgerufen.
\n", + $this->__toString() + )); + + // Existiert noch keine? + if (empty($this->uniqueID)) { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID erzeugt neue Unique-ID.
\n", + $this->__toString() + )); + + // Correct missing class name + $corrected = false; + if ($this->__toString() == "") { + $this->setRealClass(__CLASS__); + $corrected = true; + } + + // Neue ID erstellen + $tempID = false; + while (true) { + // Generate a unique ID number + $tempID = $this->generateIdNumber(); + $isUsed = false; + + // Try to figure out if the ID number is not yet used + try { + if (is_object($this->getDatabaseInstance())) { + $isUsed = $this->getDatabaseInstance()->isUniqueIdUsed($tempID, true); + } + } catch (FrameworkException $e) { + // Catches all and ignores all ;-) + } + + if ( + ( + $tempID !== false + ) && ( + ( + $this->getDatabaseInstance() === null + ) || ( + ( + is_object($this->getDatabaseInstance()) + ) && ( + !$isUsed + ) + ) + ) + ) { + // Abort the loop + break; + } + } + + // Debug message + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] uniqueID ist auf %s gesetzt.
\n", + $this->__toString(), + $tempID + )); + + // Apply the new ID + $this->setUniqueID($tempID); + + // Revert maybe corrected class name + if ($corrected) { + $this->setRealClass(""); + } + + // Remove system classes if we are in a system class + if ((isset($this->systemClasses)) && (in_array($this->__toString(), $this->systemClasses))) { + // This may save some RAM... + $this->removeSystemArray(); + } + } + } + + /** + * Generates a new ID number for classes based from the class' real name, + * the description and some random data + * + * @return $tempID The new (temporary) ID number + */ + private final function generateIdNumber () { + return sprintf("%s@%s", + $this->__toString(), + md5(sprintf("%s:%s:%s:%s:%s:%s", + $this->__toString(), + $this->getPartDescr(), + time(), + getenv('REMOTE_ADDR'), + getenv('SERVER_ADDR'), + mt_rand() + )) + ); + } + + /** + * Setter for unique ID + * + * @param $uniqueID The newly generated unique ID number + * @return void + */ + private final function setUniqueID ($uniqueID) { + // Cast to string + $uniqueID = (string) $uniqueID; + + // Debug message + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID gesetzt auf %s.
\n", + $this->__toString(), + $uniqueID + )); + + // Set the ID number + $this->uniqueID = $uniqueID; + } + + /** + * Getter for unique ID + * + * @return $uniqueID The unique ID of this class + */ + public final function getUniqueID () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID angefordert.
\n", + $this->__toString() + )); + return $this->uniqueID; + } + + /** + * Resets or recreates the unique ID number + * + * @return void + */ + public final function resetUniqueID() { + // Sweet and simple... ;-) + $newUniqueID = $this->generateIdNumber(); + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID zurückgesetzt auf %s.
\n", + $this->__toString(), + $newUniqueID + )); + $this->setUniqueID($newUniqueID); + } + + /** + * Getter for simulator description + * + * @return $partDescr The description of this simulation part + */ + public final function getPartDescr () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] getPartDescr erreicht.
\n", + $this->__toString() + )); + if (isset($this->partDescr)) { + return $this->partDescr; + } else { + return null; + } + } + + /** + * Setter for simulation part description + * + * @param $partDescr The description as string for this simulation part + * @return void + */ + public final function setPartDescr ($partDescr) { + $this->partDescr = (String) $partDescr; + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Teilbeschreibung wird auf %s gesetzt.
\n", + $this->__toString(), + $this->partDescr + )); + } + + /** + * Validate if given object is the same as current + * + * @param $object An object instance for comparison with this class + * @return boolean The result of comparing both's unique ID + */ + public final function equals ($object) { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Ist %s=%s?
\n", + $this->__toString(), + $this->__toString(), + $object->__toString() + )); + return ($this->getUniqueID() == $object->getUniqueID()); + } + + /** + * Compare if both simulation part description and class name matches + * (shall be enougth) + * + * @param $itemInstance An object instance to an other class + * @return boolean The result of comparing class name simulation part description + */ + public function itemMatches ($itemInstance) { + return ( + ($this->__toString() == $itemInstance->__toString()) + && ($this->getPartDescr() == $itemInstance->getPartDescr()) + ); + } + + /** + * Compare class name of this and given class name + * + * @param $class The class name as string from the other class + * @return boolean The result of comparing both class names + */ + public final function isClass ($class) { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] %s=%s?
\n", + $this->__toString(), + $this->__toString(), + $class + )); + return ($this->__toString() == $class); + } + + /** + * Stub method (only real cabins shall override it) + * + * @return boolean false = is no cabin, true = is a cabin + */ + public function isCabin () { + return false; + } + + /** + * Stub method for tradeable objects + * + * @return boolean false = is not tradeable by the Merchant class, + * true = is a tradeable object + */ + public function isTradeable () { + return false; + } + + /** + * Formats computer generated price values into human-understandable formats + * with thousand and decimal seperators. + * + * @param $value The in computer format value for a price + * @param $currency The currency symbol (use HTML-valid characters!) + * @param $decNum Number of decimals after commata + * @return $price The for the current language formated price string + * @throws MissingDecimalsThousandsSeperatorException If decimals or + * thousands seperator + * is missing + */ + public function formatCurrency ($value, $currency = "€", $decNum = 2) { + // Are all required attriutes set? + if ((!isset($this->decimals)) || (!isset($this->thousands))) { + // Throw an exception + throw new MissingDecimalsThousandsSeperatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING); + } + + // Cast the number + $value = (float) $value; + if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] %d wird umformatiert.
\n", + $this->__toString(), + $value + )); + + // Reformat the US number + $price = sprintf("%s %s", + number_format($value, $decNum, $this->decimals, $this->thousands), + $currency + ); + + // Return as string... + return $price; + } + + /** + * Removes number formating characters + * + * @return void + */ + public final function removeNumberFormaters () { + if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Zahlenumformatierungszeichen werden entfernt.
\n", + $this->__toString() + )); + unset($this->thousands); + unset($this->decimals); + } + + /** + * Getter for database layer + * + * @return $dbInstance The database layer instance + */ + public final function getDatabaseInstance () { + if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Datenbank-Instanz %s angefordert.
\n", + $this->__toString(), + $this->dbInstance + )); + return $this->dbInstance; + } + + /** + * Setter for compressor channel + * + * @param $compressorChannel An instance of CompressorChannel + * @return void + */ + public final function setCompressorChannel (CompressorChannel $compressorChannel) { + self::$compressor = $compressorChannel; + } + + /** + * Getter for compressor channel + * + * @return $compressor The compressor channel + */ + public final function getCompressorChannel () { + return self::$compressor; + } + + /** + * Remove the $systemClasses array from memory + * + * @return void + */ + public final function removeSystemArray () { + unset($this->systemClasses); + } + + /** + * Create a file name and path name from the object's unique ID number. + * The left part of the ID shall always be a valid class name and the + * right part an ID number. + * + * @return $pfn The file name with a prepended path name + * @throws NoArrayCreatedException If explode() fails to create an array + * @throws InvalidArrayCountException If the array contains less or + * more than two elements + */ + public function getPathFileNameFromObject () { + // Get the main object's unique ID. We use this as a path/filename combination + $pathFile = $this->getUniqueID(); + + // Split it up in path and file name + $pathFile = explode("@", $pathFile); + + // 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); + } + + // Auto-append missing trailing slash + $pathFile[0] = $this->addMissingTrailingSlash($pathFile[0]); + + // Create the file name and return it + $pfn = ($pathFile[0] . $pathFile[1]); + return $pfn; + } + + /** + * Appends a trailing slash to a string + * + * @param $str A string (maybe) without trailing slash + * @return $str A string with an auto-appended trailing slash + */ + public final function addMissingTrailingSlash ($str) { + // Is there a trailing slash? + if (substr($str, -1, 1) != "/") $str .= "/"; + return $str; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/class_FrameworkArrayObject.php b/inc/classes/main/class_FrameworkArrayObject.php new file mode 100644 index 0000000..e73f8a8 --- /dev/null +++ b/inc/classes/main/class_FrameworkArrayObject.php @@ -0,0 +1,47 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FrameworkArrayObject extends ArrayObject { + /** + * Constructor for smooth coding style ;-) + * + * @param $class The class's real name + * @return void + */ + public function constructor ($class) { + // $class will be ignored for backward compatiblity + } + + /** + * Get real class' name back + * + * @return $realClass The class' real name + */ + public function __toString () { + return get_class($this); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/compressor/.htaccess b/inc/classes/main/compressor/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/compressor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/compressor/class_Bzip2Compressor.php b/inc/classes/main/compressor/class_Bzip2Compressor.php new file mode 100644 index 0000000..56e704c --- /dev/null +++ b/inc/classes/main/compressor/class_Bzip2Compressor.php @@ -0,0 +1,122 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 Bzip2Compressor extends BaseFrameworkSystem implements Compressor { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor! + parent::constructor(__CLASS__); + + // Debug message + if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Set description + $this->setPartDescr("BZIP2-Kompressor"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Create a new compressor channel based a given compression handler + * + * @return $cInstance An instance of this class + */ + public final static function createBzip2Compressor () { + // Get new instance + if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) { + // Compressor can maybe be used + $cInstance = new Bzip2Compressor(); + + // Debug message + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompression wird verwendet.
\n", + $cInstance->__toString() + )); + } else { + // Routines not found! + $cInstance = null; + + // Debug message + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompressionsroutinen nicht gefunden.
\n", + $cInstance->__toString() + )); + } + + // Return the compressor instance + return $cInstance; + } + + /** + * BZIP2 compression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function compressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the compressed stream + return bzcompress($streamData, 1); + } + + /** + * BZIP2 decompression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function decompressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the decompressed stream + return bzdecompress($streamData); + } + + /** + * Getter for the file extension of this compressor + * + * @return $string Returns always "bz2" + */ + public final function getCompressorExtension () { + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", + $this->__toString() + )); + return "bz2"; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/compressor/class_GzipCompressor.php b/inc/classes/main/compressor/class_GzipCompressor.php new file mode 100644 index 0000000..f00b2d0 --- /dev/null +++ b/inc/classes/main/compressor/class_GzipCompressor.php @@ -0,0 +1,122 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 GzipCompressor extends BaseFrameworkSystem implements Compressor { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor! + parent::constructor(__CLASS__); + + // Debug message + if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Set description + $this->setPartDescr("GZIP-Kompressor"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Create a new compressor channel based a given compression handler + * + * @return $cInstance An instance of this class + */ + public final static function createGzipCompressor () { + // Get new instance + if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) { + // Compressor can maybe be used + $cInstance = new GzipCompressor(); + + // Debug message + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompression wird verwendet.
\n", + $cInstance->__toString() + )); + } else { + // Routines not found! + $cInstance = null; + + // Debug message + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompressionsroutinen nicht gefunden.
\n", + $cInstance->__toString() + )); + } + + // Return the compressor instance + return $cInstance; + } + + /** + * GZIP compression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function compressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the compressed stream + return gzcompress($streamData, 1); + } + + /** + * GZIP decompression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function decompressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the decompressed stream + return gzuncompress($streamData); + } + + /** + * Getter for the file extension of this compressor + * + * @return $string Returns always "gz" + */ + public final function getCompressorExtension () { + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", + $this->__toString() + )); + return "gz"; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/compressor/class_NullCompressor.php b/inc/classes/main/compressor/class_NullCompressor.php new file mode 100644 index 0000000..b4a1236 --- /dev/null +++ b/inc/classes/main/compressor/class_NullCompressor.php @@ -0,0 +1,106 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 NullCompressor extends BaseFrameworkSystem implements Compressor { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor! + parent::constructor(__CLASS__); + + // Debug message + if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Set description + $this->setPartDescr("Null-Kompressor"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Create a new compressor channel based a given compression handler + * + * @return $cInstance An instance of this class + */ + public final static function createNullCompressor () { + // Get new instance + $cInstance = new NullCompressor(); + + // Return the compressor instance + return $cInstance; + } + + /** + * Null compression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function compressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the compressed stream + return $streamData; + } + + /** + * Null decompression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function decompressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the decompressed stream + return $streamData; + } + + /** + * Getter for the file extension of this compressor + * + * @return $string Returns always "bz2" + */ + public final function getCompressorExtension () { + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", + $this->__toString() + )); + return "null"; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/console/.htaccess b/inc/classes/main/console/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/console/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/console/class_ConsoleTools.php b/inc/classes/main/console/class_ConsoleTools.php new file mode 100644 index 0000000..97f1bc2 --- /dev/null +++ b/inc/classes/main/console/class_ConsoleTools.php @@ -0,0 +1,88 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ConsoleTools extends BaseFrameworkSystem { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Console-Tools"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Aquires the IP address of this host by reading the /etc/hostname file and solving it + * + * @return $ip The resolved IP address + */ + public static function aquireSelfIPAddress () { + // Local IP by default + $ip = "127.0.0.1"; + + // Get a new instance + $helper = new ConsoleTools(); + + try { + // Get a file pointer + $io = FrameworkFileInputPointer::createFrameworkFileInputPointer("/etc/hostname"); + + // Read the file + $hostname = trim($io->readFromFile()); + $helper->getDebugInstance()->output(sprintf("[%s:] Our host name is: %s
\n", + $helper->__toString(), + $hostname + )); + + // Close the file + $io->closeFile(); + + // Resolve it + $ipResolved = gethostbyname($hostname); + if (($ipResolved !== false) && ($ipResolved != $hostname)) { + // Okay, this works! + $ip = $ipResolved; + + // Debug message + $helper->getDebugInstance()->output(sprintf("[%s:] Resolved IP address is: %s
\n", + $helper->__toString(), + $ip + )); + } + } catch (FrameworkException $e) { + // Do nothing here + } + + // Return the IP address + return $ip; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/database/.htaccess b/inc/classes/main/database/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/database/class_BaseDatabaseFrontend.php b/inc/classes/main/database/class_BaseDatabaseFrontend.php new file mode 100644 index 0000000..7d6f8a0 --- /dev/null +++ b/inc/classes/main/database/class_BaseDatabaseFrontend.php @@ -0,0 +1,105 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ +abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject { + /** + * The limiter instance + */ + private $limitInstance = null; + + /** + * Private constructor + * + * @return void + */ + private function __construct($class) { + // Call parent constructor + parent::constructor($class); + + // Debug message + if (((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Clean up a little + $this->removeNumberFormaters(); + } + + /** + * The public constructor + * + * @return void + */ + public function constructor ($class) { + // Calls just the private one + $this->__construct($class); + } + + /** + * Getter for limitation instance + * + * @return $limitInstance The instance to the object ObjectLimits + */ + public final function getLimitInstance () { + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s angefordert.
\n", + $this->__toString(), + $this->limitInstance->__toString() + )); + return $this->limitInstance; + } + + /** + * Setup limitation for the saving process + * + * @param $limitInstance An instance of ObjectLimits which contains + * elements we shall exclusivly include in + * saving process + * @return void + */ + public final function limitObject (ObjectLimits $limitInstance) { + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s soll verwendet werden.
\n", + $this->__toString(), + $limitInstance->__toString() + )); + + // Get limitArray for validation + $array = $limitInstance->getLimitArray(); + + // Sanity-check if some limitations are in the object + if ($array->count() > 0) { + // Okay, there is enougth + $this->limitInstance = $limitInstance; + + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s wird verwendet und beinhaltet %s Einträge.
\n", + $this->__toString(), + $limitInstance->__toString(), + $array->count() + )); + } + } +} + +// [EOF] +?> diff --git a/inc/classes/main/database/classes/.htaccess b/inc/classes/main/database/classes/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/database/classes/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/database/classes/class_LocalFileDatabase.php b/inc/classes/main/database/classes/class_LocalFileDatabase.php new file mode 100644 index 0000000..ff5f1dd --- /dev/null +++ b/inc/classes/main/database/classes/class_LocalFileDatabase.php @@ -0,0 +1,515 @@ + + * @version 0.1 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 IO handler for file handling which should be FileIOHandler. + */ + private $ioInstance = null; + + /** + * 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 + */ + private function __construct() { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Dateidatenbankschicht"); + + // 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); + } + + // Debug output + if (defined('DEBUG_DATABASE')) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Es werden lokale Dateien zum Speichern von Objekten verwendet.
\n", + $dbInstance->__toString() + )); + + // Set save path and IO instance + $dbInstance->setSavePath($savePath); + $dbInstance->setIOInstance($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; + + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Lokaler Speicherpfad %s wird verwendet.
\n", + $this->__toString(), + $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; + } + + /** + * Getter for file extension + * + * @return $fileExtension The file extension for all file names + */ + public final function getFileExtension () { + return $this->fileExtension; + } + + /** + * 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); + } + + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s soll in eine lokale Datei gespeichert werden.
\n", + $this->__toString(), + $object->__toString() + )); + + // 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); + + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s ist nach der Serialisierung %s Byte gross.
\n", + $this->__toString(), + $object->__toString(), + strlen($serialized) + )); + + // 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->getIOInstance()->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->getIOInstance(); + + // 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; + } + + /** + * Getter for the file IO instance + * + *�@return $ioInstance An instance for IO operations + * @see FileIOHandler The concrete handler for IO operations + */ + public final function getIOInstance () { + return $this->ioInstance; + } + + /** + * Setter for the file IO instance + * + * @param $ioInstance An instance for IO operations (should be + * FileIOHandler) + * @return void + */ + public final function setIOInstance (FileIOHandler $ioInstance) { + $this->ioInstance = $ioInstance; + } + + /** + * Setter for the last read file + * + * @param $fqfn The FQFN of the last read file + * @return void + */ + private 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 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; + } + + /** + * 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 function getObjectFromCachedData ($uniqueID) { + // Get instance for file handler + $inputHandler = $this->getIOInstance(); + + // 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/debug/.htaccess b/inc/classes/main/debug/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/debug/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/debug/class_DebugConsoleOutput.php b/inc/classes/main/debug/class_DebugConsoleOutput.php new file mode 100644 index 0000000..d92648e --- /dev/null +++ b/inc/classes/main/debug/class_DebugConsoleOutput.php @@ -0,0 +1,89 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DebugConsoleOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Debug-Ausgabe auf Konsole"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Creates an instance of this class + * + * @return $debugInstance The prepared debug instance + */ + public final static function createDebugConsoleOutput () { + // Get a new instance + $debugInstance = new DebugConsoleOutput(); + + // Return it + return $debugInstance; + } + + /** + * Outputs the given data without HTML tags + * + * @param $output The HTML'ed output + * @return void + */ + public final function outputStream ($output) { + print html_entity_decode(strip_tags($output)); + } + + /** + * Outputs the given data without HTML tags + * + * @param $output The HTML'ed output + * @return void + */ + public final function output ($outStream=false) { + // false will be silently ignored + if ($outStream !== false) { + $this->outputStream($outStream); + } + } + + /** + * Assigns a variable for output + * + * @param $var The variable we shall assign + * @param $value The value to store in the variable + * @return void + */ + public final function assignVariable ($var, $value) { + trigger_error(__METHOD__.": Stub!"); + } +} + +// +?> diff --git a/inc/classes/main/debug/class_DebugErrorLogOutput.php b/inc/classes/main/debug/class_DebugErrorLogOutput.php new file mode 100644 index 0000000..8916b05 --- /dev/null +++ b/inc/classes/main/debug/class_DebugErrorLogOutput.php @@ -0,0 +1,97 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Debug-Ausgabe in error_log()"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Creates an instance of this class + * + * @return $debugInstance The prepared debug instance + */ + public final static function createDebugErrorLogOutput () { + // Get a new instance + $debugInstance = new DebugErrorLogOutput(); + + // Return it + return $debugInstance; + } + + /** + * Outputs the given data without HTML tags + * + * @param $output The HTML'ed output + * @return void + */ + public final function outputStream ($output) { + // Split multiple lines into and array to put them out line-by-line + $errorLines = explode("\n", $output); + foreach ($errorLines as $err) { + $err = trim($err); + // Log only none-empty lines + if (!empty($err)) { + // Log this line + error_log(html_entity_decode(strip_tags($err)), 0); + } + } + } + + /** + * Assigns a variable for output + * + * @param $var The variable we shall assign + * @param $value The value to store in the variable + * @return void + */ + public final function assignVariable ($var, $value) { + trigger_error(__METHOD__.": Stub!"); + } + + /** + * Output the code + * + * @return void + */ + public final function output ($outStream=false) { + // false will be silently ignored + if ($outStream !== false) { + $this->outputStream($outStream); + } + } +} + +// +?> diff --git a/inc/classes/main/debug/class_DebugWebOutput.php b/inc/classes/main/debug/class_DebugWebOutput.php new file mode 100644 index 0000000..062b2cc --- /dev/null +++ b/inc/classes/main/debug/class_DebugWebOutput.php @@ -0,0 +1,65 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DebugWebOutput extends BaseFrameworkSystem implements Debugger { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Debug-Ausgabe auf Konsole"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Creates an instance of this class + * + * @return $debugInstance The prepared debug instance + */ + public final static function createDebugWebOutput () { + // Get a new instance + $debugInstance = new DebugWebOutput(); + + // Return it + return $debugInstance; + } + + /** + * Outputs the given data directly + * + * @param $output The HTML output + * @return void + */ + public final function outputStream ($output) { + trigger_error($output); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/extended/.htaccess b/inc/classes/main/extended/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/extended/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/extended/class_ObjectLimits.php b/inc/classes/main/extended/class_ObjectLimits.php new file mode 100644 index 0000000..8cfb0ec --- /dev/null +++ b/inc/classes/main/extended/class_ObjectLimits.php @@ -0,0 +1,130 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ObjectLimits extends BaseFrameworkSystem { + /** + * Limitation array for storing all attribute names we will use later + * only. + */ + private $limitArray = null; + + /** + * Private constructor + * + * @return void + */ + private final function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set part description + $this->setPartDescr("Limitierungsobjekt"); + + // Create unique ID number + $this->createUniqueID(); + + // Clean up a little + $this->removeNumberFormaters(); + } + + /** + * Create a new ObjectLimits object and (maybe prepare it a little) + * + * @param $limitationArray The limitation array we "walk" through + * @return $limitInstance The instance to an ObjectLimits object + */ + public final static function createObjectLimits (array $limitationArray) { + // Is there a limitation array given? + if (count($limitationArray) > 0) { + // Get instance + $limitInstance = new ObjectLimits(); + + // Get all limitations and do them + foreach ($limitationArray as $limit) { + // What shall we limitate? + if ($limit instanceof FrameworkInterface) { + // Add an object + $limitInstance->addObject($limit); + } elseif (is_string($limit)) { + // Add a string + $limitInstance->addString($limit); + } else { + // Others are not supported (yet) + throw new UnsupportedLimitationPartException($limit, self::EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED); + } + } + + // Return instance + return $limitInstance; + } else { + // No limitation given so we send "null" back + return null; + } + } + + /** + * Add an object's name to the limitation list + * + * @param $object The object's name we shall add to the list + * @return void + */ + private final function addObject (FrameworkInterface $object) { + // Auto-initialization + if (is_null($this->limitArray)) { + // Initialize this array + $this->limitArray = new FrameworkArrayObject(); + } + + // Add the object's name to it + $this->limitArray->append($object->__toString()); + } + + /** + * Add a string directly to the limitation list + * + * @param $str The string we want to add directly + * @return void + */ + private final function addString ($str) { + // Auto-initialization + if (is_null($this->limitArray)) { + // Initialize this array + $this->limitArray = new FrameworkArrayObject(); + } + + // Add the direct string to ArrayObject + $this->limitArray->append($str); + } + + /** + * Getter for limitArray + * + * @return $limitArray The object ArrayObject which holds limitations + */ + public final function getLimitArray () { + return $this->limitArray; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/extended/class_SerializationContainer.php b/inc/classes/main/extended/class_SerializationContainer.php new file mode 100644 index 0000000..b8790ea --- /dev/null +++ b/inc/classes/main/extended/class_SerializationContainer.php @@ -0,0 +1,91 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 SerializationContainer extends FrameworkArrayObject { + /** + * Public constructor, if you like to have an object of this class... + * + * @return void + */ + public function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Debug message + if ((defined('DEBUG_CONTAINER')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[SerializationContainer:] Konstruktor erreicht.
\n"); + } + + /** + * Create a SerializationContainer object by applying the limitations + * in $limitInstance on $object. The resulting data container will only + * hold the attributed and their values which we have specified in + * the limitation object. + * + * @param $limitInstance The instance to the object ObjectLimits + * @param $object The origin object. We don't touch it here. + * @return $containerInstance An instance of SerializationContainer + * @throws GetterNotFoundException If a getter was not found + */ + public final static function createSerializationContainer (ObjectLimits $limitInstance, $object) { + // Get an instance + $containerInstance = new SerializationContainer(); + + // Iterate through the whole limitation array + for ($idx = $limitInstance->getLimitArray()->getIterator(); $idx->valid(); $idx->next()) { + // Get current item from list + $curr = ucfirst($idx->current()); + + // Is the required method available? + if (method_exists($object, sprintf("get%s", $curr))) { + // Generate a command for getting it + $eval = sprintf("\$value = \$object->get%s();", + $curr + ); + + // Debug eval command + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $limitInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + $this->__toString(), + htmlentities($eval) + )); + + // Run it + @eval($eval); + + // Add this item to the container list + $containerInstance->append(array( + 'name' => $curr, + 'value' => $value + )); + } else { + // Throw an exception + throw new GetterNotFoundException(array($object, $curr), self::EXCEPTION_GETTER_IS_MISSING); + } + } // END - for + + // Return container instance + return $containerInstance; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/io/.htaccess b/inc/classes/main/io/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/io/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/io/class_FileIOStream.php b/inc/classes/main/io/class_FileIOStream.php new file mode 100644 index 0000000..0872f91 --- /dev/null +++ b/inc/classes/main/io/class_FileIOStream.php @@ -0,0 +1,231 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FileIOStream extends BaseFrameworkSystem implements FileInputStreamer, FileOutputStreamer { + /** + * Private constructor + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set part description + $this->setPartDescr("Universal Datei-Ein-/Ausgabesystem"); + + // Create unique ID + $this->createUniqueID(); + + // Clean-up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Create a file IO stream. This is a class for performing all actions + * on files like creating, deleting and loading them. + * + * @return $ioInstance An instance of FileIOStream + */ + public final static function createFileIOStream () { + // Create new instance + $ioInstance = new FileIOStream(); + + // Return the instance + return $ioInstance; + } + + /** + * Saves data to a given local file + * + * @param $fileName The file name for the to be saved file + * @param $dataArray The data we shall store to the file + * @return void + * @see FileOutputStreamer + */ + public final function saveFile ($fileName, $dataArray) { + // Try it five times + $dirName = ""; $fileInstance = null; + for ($idx = 0; $idx < 5; $idx++) { + // Get a file output pointer + try { + $fileInstance = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fileName, 'w'); + } catch (FilePointerNotOpenedException $e) { + // Create missing directory + $dirName = dirname($fileName); + for ($idx2 = 0; $idx2 < (2 - $idx); $idx2++) { + $dirName = dirname($dirName); + } + // Try to create it + @mkdir($dirName); + } + } + + // Write a header information for validation purposes + $fileInstance->writeToFile(sprintf("@head^%s:%s:%s:%s\n", + $dataArray[0], + time(), + strlen($dataArray[1]), + md5($dataArray[1]) + )); + + // Encode the (maybe) binary stream with Base64 + $b64Stream = base64_encode($dataArray[1]); + + // write the data line by line + $line = str_repeat(" ", 50); $idx = 0; + while (strlen($line) == 50) { + // Get 50 chars or less + $line = substr($b64Stream, $idx, 50); + + // Save it to the stream + $fileInstance->writeToFile(sprintf("@data^%s:%s\n", + $line, + md5($line) + )); + + // Advance to the next 50-chars block + $idx += 50; + } + + // Close the file + $fileInstance->closeFile(); + } + + /** + * Reads from a local file + * + * @param $fqfn The full-qualified file-name which we shall load + * @return $array An array with the element 'header' and 'data' + * @see FileInputStreamer + */ + public final function loadFileContents ($fqfn) { + // Initialize some variables and arrays + $inputBuffer = ""; + $lastBuffer = ""; + $header = array(); + $data = array(); + $readData = ""; // This will contain our read data + + // Get a file input handler + $fileInstance = FrameworkFileInputPointer::createFrameworkFileInputPointer($fqfn); + + // Read all it's contents (we very and transparently decompress it below) + while ($readRawLine = $fileInstance->readFromFile()) { + // Add the read line to the buffer + $inputBuffer .= $readRawLine; + + // Break infinite loop maybe caused by the input handler + if ($lastBuffer == $inputBuffer) break; + + // Remember last read line for avoiding possible infinite loops + $lastBuffer = $inputBuffer; + } + + // Close directory handle + $fileInstance->closeFile(); + + // Convert it into an array + $inputBuffer = explode("\n", $inputBuffer); + + // Now process the read lines and verify it's content + foreach ($inputBuffer as $rawLine) { + // Trim it a little but not the leading spaces/tab-stops + $rawLine = rtrim($rawLine); + + // Analyze this line + if (substr($rawLine, 0, 5) == "@head") { + // Header found, so let's extract it + $header = explode("^", $rawLine); + $header = trim($header[1]); + + // Now we must convert it again into an array + $header = explode(":", $header); + + // Is the header (maybe) valid? + if (count($header) != 4) { + // Throw an exception + throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + } + } elseif (substr($rawLine, 0, 5) == "@data") { + // Is a data line! + $data = explode("^", $rawLine); + $data = $data[1]; + + // First element is the data, second the MD5 checksum + $data = explode(":", $data); + + // Validate the read line + if (count($data) == 2) { + if (md5($data[0]) != $data[1]) { + // MD5 hash did not match! + throw new InvalidMD5ChecksumException(array($this, md5($data[0]), $data[1]), self::EXCEPTION_MD5_CHECKSUMS_MISMATCH); + } + } else { + // Invalid count! + throw new InvalidArrayCountException(array($this, "data", count($data), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + } + + // Add this to the readData string + $readData .= $data[0]; + } else { + // Other raw lines than header/data tagged lines and re-add the new-line char + $readData .= $rawLine."\n"; + } + } + + // Was raw lines read and no header/data? + if ((!empty($readData)) && (count($header) == 0) && (count($data) == 0)) { + // Return raw lines back + return $readData; + } + + // Was a header found? + if (count($header) != 4) { + // Throw an exception + throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + } + + // Decode all from Base64 + $readData = @base64_decode($readData); + + // Does the size match? + if (strlen($readData) != $header[2]) { + // Size did not match + throw new InvalidDataLengthException(array($this, strlen($readData), $header[2]), self::EXCEPTION_UNEXPECTED_STRING_SIZE); + } + + // Validate the decoded data with the final MD5 hash + if (md5($readData) != $header[3]) { + // MD5 hash did not match! + throw new InvalidMD5ChecksumException(array($this, md5($readData), $header[3]), self::EXCEPTION_MD5_CHECKSUMS_MISMATCH); + } + + // Return all in an array + return array( + 'header' => $header, + 'data' => $readData + ); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/io/class_FrameworkDirectoryPointer.php b/inc/classes/main/io/class_FrameworkDirectoryPointer.php new file mode 100644 index 0000000..796c970 --- /dev/null +++ b/inc/classes/main/io/class_FrameworkDirectoryPointer.php @@ -0,0 +1,267 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FrameworkDirectoryPointer extends BaseFrameworkSystem { + /** + * The current path we are working in + */ + private $pathName = ""; + + /** + * The directory pointer + */ + private $dirPointer = null; + + /** + * Private constructor + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set part description + $this->setPartDescr("Verzeichnis-Handler"); + + // Create unique ID + $this->createUniqueID(); + + // Clean-up a little + $this->removeNumberFormaters(); + } + + /** + * Destructor for cleaning purposes, etc + */ + public function __destruct() { + // Is there a resource pointer? Then we have to close the directory here! + if (is_resource($this->getPointer())) { + // Try to close a directory + $this->closeDirectory(); + } + + // Call the parent destructor + parent::__destruct(); + } + + /** + * Create a directory pointer based on the given path. The path will also + * be verified here. + * + * @param $pathName The path name we shall pass + * to opendir() + * @param $inConstructor If we are in de/con-structor + * or from somewhere else + * @throws PathIsEmptyException If the provided path name + * is empty + * @throws InvalidPathStringException If the provided path name is + * not a string + * @throws PathIsNoDirectoryException If the provided path name is + * not valid + * @throws PathReadProtectedException If the provided path name is + * read-protected + * @throws DirPointerNotOpened If opendir() returns not a + * directory resource + * @return $pointerInstance A prepared instance of + * FrameworkDirectoryPointer + */ + public final static function createFrameworkDirectoryPointer ($pathName, $inConstructor = false) { + // Some pre-sanity checks... + if (is_null($pathName)) { + // No pathname given + if ($inConstructor) { + return null; + } else { + throw new PathIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } + } elseif (!is_string($pathName)) { + // Is not a string + if ($inConstructor) { + return null; + } else { + throw new InvalidPathStringException(null, self::EXCEPTION_INVALID_STRING); + } + } elseif (!is_dir($pathName)) { + // Not a directory + if ($inConstructor) { + return null; + } else { + throw new PathIsNoDirectoryException($pathName, self::EXCEPTION_INVALID_PATH_NAME); + } + } elseif (!is_readable($pathName)) { + // Not readable + if ($inConstructor) { + return null; + } else { + throw new PathReadProtectedException($pathName, self::EXCEPTION_READ_PROTECED_PATH); + } + } + + // Try to open a handler + $dirPointer = @opendir($pathName); + if (!is_resource($dirPointer)) { + // Something bad happend + if ($inConstructor) { + return null; + } else { + throw new DirPointerNotOpenedException($pathName, self::EXCEPTION_DIR_POINTER_INVALID); + } + } + + // Create new instance + $pointerInstance = new FrameworkDirectoryPointer(); + + // Set directory pointer and path name + $pointerInstance->setPointer($dirPointer); + $pointerInstance->setPathName($pathName); + + // Return the instance + return $pointerInstance; + } + + /** + * Read raw lines of data from a directory pointer and return the data + * + * @return string Directory and/or file names read from the current + * directory pointer + * @throws NullPointerException If the directory pointer instance + * is not set by setPointer() + * @throws InvalidDirectoryResourceException If there is being set + * an invalid directory resource + */ + public function readRawDirectory () { + if (is_null($this->getPointer())) { + // Pointer not initialized + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_resource($this->getPointer())) { + // Pointer is not a valid resource! + throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + + // Read data from the directory pointer and return it + return readdir($this->getPointer()); + } + + /** + * Read lines from the current directory pointer except some parts + * + * @param $except Some parts of a directory we want to ignore. + * Valid: dirs + * Other values will be silently ignored + * @return string Directory and/or file names read from the current + * directory pointer + */ + public function readDirectoryExcept ($except = "") { + if ((empty($except)) || (!is_array($except)) || (count($except) == 0)) { + // No exception given, so read all data + return $this->readRawDirectory(); + } + + // Read a raw line... + $rawLine = $this->readRawDirectory(); + + // Shall we exclude directories? + if ((!is_null($rawLine)) && ($rawLine !== false) && (in_array($rawLine, $except))) { + // Exclude this part + return $this->readDirectoryExcept($except); + } elseif ((!is_null($rawLine)) && ($rawLine !== false)) { + // Return read data + return $rawLine; + } + + // End pointer reached + return null; + } + + /** + * Close a directory source and set it's instance to null and the path name + * to empty + * + * @return void + * @throws NullPointerException If the directory pointer instance + * is not set by setPointer() + * @throws InvalidDirectoryResourceException If there is being set + */ + public function closeDirectory () { + if (is_null($this->getPointer())) { + // Pointer not initialized + return; + } elseif (!is_resource($this->getPointer())) { + // Pointer is not a valid resource! + throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + + // Close the directory pointer and reset the instance variable + @closedir($this->getPointer()); + $this->setPointer(null); + $this->setPathName(""); + } + + /** + * Setter for the directory pointer + * + * @param $dirPointer The directory resource + * @return void + */ + public final function setPointer ($dirPointer) { + // Sanity-check if the pointer is a valid directory resource + if (is_resource($dirPointer) || is_null($dirPointer)) { + // Is a valid resource + $this->dirPointer = $dirPointer; + } else { + // Throw exception + throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + } + + /** + * Getter for the directory pointer + * + * @return $dirPointer The directory pointer which shall be a valid + * directory resource + */ + public final function getPointer () { + return $this->dirPointer; + } + + /** + * Setter for path name + * + * @param $pathName The new path name + * @return void + */ + public final function setPathName ($pathName) { + $pathName = (string) $pathName; + $this->pathName = $pathName; + } + + /** + * Getter for path name + * + * @return $pathName The current path name + */ + public final function getPathName () { + return $this->pathName; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/io/class_FrameworkFileInputPointer.php b/inc/classes/main/io/class_FrameworkFileInputPointer.php new file mode 100644 index 0000000..954dffe --- /dev/null +++ b/inc/classes/main/io/class_FrameworkFileInputPointer.php @@ -0,0 +1,218 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FrameworkFileInputPointer extends BaseFrameworkSystem { + /** + * The current file we are working in + */ + private $fileName = ""; + + /** + * The file pointer + */ + private $filePointer = null; + + /** + * Private constructor + */ + private final function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set part description + $this->setPartDescr("Dateiausgabe-Handler"); + + // Create unique ID + $this->createUniqueID(); + + // Clean-up a little + $this->removeNumberFormaters(); + } + + /** + * Destructor for cleaning purposes, etc + */ + public final function __destruct() { + // Is there a resource pointer? Then we have to close the file here! + if (is_resource($this->getPointer())) { + // Try to close a file + $this->closeFile(); + } + + // Call the parent destructor + parent::__destruct(); + } + + /** + * Create a file pointer based on the given file. The file will also + * be verified here. + * + * @param $fileName The file name we shall pass + * to fopen() + * @throws FileIsEmptyException If the provided file name is empty. + * @throws FilePointerNotOpenedException If fopen() returns not a + * file resource + * @return void + */ + public final static function createFrameworkFileInputPointer ($fileName) { + // Some pre-sanity checks... + if (is_null($fileName)) { + // No filename given + throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } + + // Try to open a handler + $filePointer = @fopen($fileName, 'rb'); + if (($filePointer === null) || ($filePointer === false)) { + // Something bad happend + throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); + } + + // Create new instance + $pointerInstance = new FrameworkFileInputPointer(); + + // Set file pointer and file name + $pointerInstance->setPointer($filePointer); + $pointerInstance->setFileName($fileName); + + // Return the instance + return $pointerInstance; + } + + /** + * Read data a file pointer + * + * @return mixed The result of fread() + * @throws NullPointerException If the file pointer instance + * is not set by setPointer() + * @throws InvalidFileResourceException If there is being set + * an invalid file resource + */ + public function readFromFile () { + if (is_null($this->getPointer())) { + // Pointer not initialized + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_resource($this->getPointer())) { + // Pointer is not a valid resource! + throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + + // Read data from the file pointer and return it + return fread($this->getPointer(), 1024); + } + + /** + * Read lines from a file pointer + * + * @return mixed The result of fread() + * @throws NullPointerException If the file pointer instance + * is not set by setPointer() + * @throws InvalidFileResourceException If there is being set + * an invalid file resource + */ + public function readLinesFromFile () { + if (is_null($this->getPointer())) { + // Pointer not initialized + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_resource($this->getPointer())) { + // Pointer is not a valid resource! + throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + + // Read data from the file pointer and return it + return fgets($this->getPointer(), 1024); + } + + /** + * Close a file source and set it's instance to null and the file name + * to empty + * + * @return void + * @throws NullPointerException If the file pointer instance + * is not set by setPointer() + * @throws InvalidFileResourceException If there is being set + */ + public function closeFile () { + if (is_null($this->getPointer())) { + // Pointer not initialized + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_resource($this->getPointer())) { + // Pointer is not a valid resource! + throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + + // Close the file pointer and reset the instance variable + @fclose($this->getPointer()); + $this->setPointer(null); + $this->setFileName(""); + } + + /** + * Setter for the file pointer + * + * @param $filePointer File resource + * @return void + */ + public final function setPointer ($filePointer) { + // Sanity-check if the pointer is a valid file resource + if (is_resource($filePointer) || is_null($filePointer)) { + // Is a valid resource + $this->filePointer = $filePointer; + } else { + // Throw exception + throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + } + + /** + * Getter for the file pointer + * + * @return $filePointer The file pointer which shall be a valid + * file resource + */ + public final function getPointer () { + return $this->filePointer; + } + + /** + * Setter for file name + * + * @param $fileName The new file name + * @return void + */ + public final function setFileName ($fileName) { + $fileName = (string) $fileName; + $this->fileName = $fileName; + } + + /** + * Getter for file name + * + * @return $fileName The current file name + */ + public final function getFileName () { + return $this->fileName; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/io/class_FrameworkFileOutputPointer.php b/inc/classes/main/io/class_FrameworkFileOutputPointer.php new file mode 100644 index 0000000..fba4602 --- /dev/null +++ b/inc/classes/main/io/class_FrameworkFileOutputPointer.php @@ -0,0 +1,198 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FrameworkFileOutputPointer extends BaseFrameworkSystem { + /** + * The current file we are working in + */ + private $fileName = ""; + + /** + * The file pointer + */ + private $filePointer = null; + + /** + * Private constructor + */ + private final function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set part description + $this->setPartDescr("Dateiausgabe-Handler"); + + // Create unique ID + $this->createUniqueID(); + + // Clean-up a little + $this->removeNumberFormaters(); + } + + /** + * Destructor for cleaning purposes, etc + */ + public final function __destruct() { + // Is there a resource pointer? Then we have to close the file here! + if (is_resource($this->getPointer())) { + // Try to close a file + $this->closeFile(); + } + + // Call the parent destructor + parent::__destruct(); + } + + /** + * Create a file pointer based on the given file. The file will also + * be verified here. + * + * @param $fileName The file name we shall pass + * to fopen() + * @param $mode The output mode ('w', 'a' are valid) + * @throws FileIsEmptyException If the provided file name is empty. + * @throws FilePointerNotOpened If fopen() returns not a file + * resource + * @return void + */ + public final static function createFrameworkFileOutputPointer ($fileName, $mode) { + // Some pre-sanity checks... + if (is_null($fileName)) { + // No filename given + throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } + + // Try to open a handler + $filePointer = @fopen($fileName, $mode); + if (($filePointer === null) || ($filePointer === false)) { + // Something bad happend + throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); + } + + // Create new instance + $pointerInstance = new FrameworkFileOutputPointer(); + + // Set file pointer and file name + $pointerInstance->setPointer($filePointer); + $pointerInstance->setFileName($fileName); + + // Return the instance + return $pointerInstance; + } + + /** + * Write data to a file pointer + * + * @param $dataStream The data stream we shall write to the file + * @return mixed The result of fwrite() + * @throws NullPointerException If the file pointer instance + * is not set by setPointer() + * @throws InvalidFileResourceException If there is being set + * an invalid file resource + */ + public function writeToFile ($dataStream) { + if (is_null($this->getPointer())) { + // Pointer not initialized + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_resource($this->getPointer())) { + // Pointer is not a valid resource! + throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + + // Read data from the file pointer and return it + return fwrite($this->getPointer(), $dataStream); + } + + /** + * Close a file source and set it's instance to null and the file name + * to empty + * + * @return void + * @throws NullPointerException If the file pointer instance + * is not set by setPointer() + * @throws InvalidFileResourceException If there is being set + */ + public function closeFile () { + if (is_null($this->getPointer())) { + // Pointer not initialized + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_resource($this->getPointer())) { + // Pointer is not a valid resource! + throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + + // Close the file pointer and reset the instance variable + @fclose($this->getPointer()); + $this->setPointer(null); + $this->setFileName(""); + } + + /** + * Setter for the file pointer + * + * @param $filePointer File resource + * @return void + */ + public final function setPointer ($filePointer) { + // Sanity-check if the pointer is a valid file resource + if (is_resource($filePointer) || is_null($filePointer)) { + // Is a valid resource + $this->filePointer = $filePointer; + } else { + // Throw exception + throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); + } + } + + /** + * Getter for the file pointer + * + * @return $filePointer The file pointer which shall be a valid + * file resource + */ + public final function getPointer () { + return $this->filePointer; + } + + /** + * Setter for file name + * + * @param $fileName The new file name + * @return void + */ + public final function setFileName ($fileName) { + $fileName = (string) $fileName; + $this->fileName = $fileName; + } + + /** + * Getter for file name + * + * @return $fileName The current file name + */ + public final function getFileName () { + return $this->fileName; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/language/.htaccess b/inc/classes/main/language/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/language/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/language/class_LanguageSystem.php b/inc/classes/main/language/class_LanguageSystem.php new file mode 100644 index 0000000..c9bf64d --- /dev/null +++ b/inc/classes/main/language/class_LanguageSystem.php @@ -0,0 +1,169 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage { + /** + * The full-qualified base path for the language include files + */ + private $basePath = ""; + + /** + * The 2-char language code + */ + private $langCode = "xx"; // This will later be overwritten! + + /** + * The array-object for all language strings + */ + private $langStrings = null; + + /** + * An instance of this class + */ + private static $thisInstance = null; + + /** + * Private constructor + * + * @return void + */ + private final function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set part description + $this->setPartDescr("Sprachsystem"); + + // Create unique ID number + $this->createUniqueID(); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Creates an instance of the class LanguageSystem and prepares it for usage + * + * @param $basePath The local base path for all language strings + * @return $langInstance An instance of LanguageSystem + * @throws LanguagePathIsEmptyException If the provided $basePath is empty + * @throws InvalidLanguagePathStringException If $basePath is no string + * @throws LanguagePathIsNoDirectoryException If $basePath is no + * directory or not found + * @throws LanguagePathReadProtectedException If $basePath is + * read-protected + */ + public final static function createLanguageSystem ($basePath) { + // Get a new instance + $langInstance = new LanguageSystem(); + + // Is the base path valid? + if (empty($basePath)) { + // Language path is empty + throw new LanguagePathIsEmptyException($langInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } elseif (!is_string($basePath)) { + // Is not a string + throw new InvalidLanguagePathStringException(array($langInstance, $basePath), self::EXCEPTION_INVALID_STRING); + } elseif (!is_dir($basePath)) { + // Is not a path + throw new LanguagePathIsNoDirectoryException(array($langInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME); + } elseif (!is_readable($basePath)) { + // Is not readable + throw new LanguagePathReadProtectedException(array($langInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH); + } + + // Set the base path + $langInstance->setBasePath($basePath); + + // Initialize the variable stack + $langInstance->initLanguageStrings(); + + // Set language code from default config + $langInstance->setLanguageCode($langInstance->getConfigInstance()->readConfig("default_lang")); + + // Remember this instance + self::$thisInstance = $langInstance; + + // Return the prepared instance + return $langInstance; + } + + /** + * Singleton getter for this instance + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance () { + return self::$thisInstance; + } + + /** + * Initialize the array-object for all later language strings + * + * @return void + */ + public function initLanguageStrings () { + $this->langStrings = new FrameworkArrayObject(); + } + + /** + * Setter for base path + * + * @param $basePath The local base path for all templates + * @return void + */ + public final function setBasePath ($basePath) { + // Cast it + $basePath = (string) $basePath; + + // And set it + $this->basePath = $basePath; + } + + /** + * Getter for language code + * + * @return $langCode The language code for the current application + */ + public final function getLanguageCode () { + return $this->langCode; + } + + /** + * Setter for language code + * + * @param $langCode The language code for the current application + * @return void + */ + public final function setLanguageCode ($langCode) { + // Cast it + $langCode = (string) $langCode; + + // And set it (only 2 chars) + $this->langCode = substr($langCode, 0, 2); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/output/.htaccess b/inc/classes/main/output/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/output/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/output/class_ConsoleOutput.php b/inc/classes/main/output/class_ConsoleOutput.php new file mode 100644 index 0000000..26dca78 --- /dev/null +++ b/inc/classes/main/output/class_ConsoleOutput.php @@ -0,0 +1,120 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer { + /** + * The instance for the singleton design pattern + */ + private static $consoleInstance = null; + + /** + * Assigned variables + */ + private $vars = array(); + + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Console-Ausgabe-Handler"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Create a new web output system and set the content type + * + * @param $contentType A valid content-type + * @return $debugInstance An instance of this middleware class + */ + public final static function createConsoleOutput ($contentType) { + // Cast the content-type to string + $contentType = (string) $contentType; + $contentType = trim($contentType); + + // Get instance + self::$consoleInstance = new ConsoleOutput(); + + // Set the content type + if (!empty($contentType)) { + @header(sprintf("Content-type: %s", + $contentType + )); + } + + // Return instance + return self::$consoleInstance; + } + + /** + * Getter for an instance of this class + * + * @return $consoleInstance An instance of this class + */ + public final static function getInstance() { + if (is_null(self::$consoleInstance)) { + $contentType = FrameworkConfiguration::getInstance()->readConfig("web_content_type"); + self::$consoleInstance = ConsoleOutput::createConsoleOutput($contentType); + } + return self::$consoleInstance; + } + + /** + * Output the code + * + * @param $outStream Something we shall sent to the console + * @return void + */ + public final function output ($outStream=false) { + if ($outStream === false) { + // Output something here... + foreach ($this->vars as $var=>$value) { + $this->output("var=".$var.", value=".$value.""); + } + } else { + // Output it to the console + printf("%s\n", trim(html_entity_decode(strip_tags($outStream)))); + } + } + + /** + * Assigns a variable for output + * + * @param $var The variable we shall assign + * @param $value The value to store in the variable + * @return void + */ + public function assignVariable ($var, $value) { + $this->vars[$var] = $value; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/output/class_WebOutput.php b/inc/classes/main/output/class_WebOutput.php new file mode 100644 index 0000000..8ed1c4f --- /dev/null +++ b/inc/classes/main/output/class_WebOutput.php @@ -0,0 +1,97 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 WebOutput extends BaseFrameworkSystem implements OutputStreamer { + /** + * The instance for the singleton design pattern + */ + private static $webInstance = null; + + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Web-Ausgabe-Handler"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Create a new web output system and set the content type + * + * @param $contentType A valid content-type + * @return $debugInstance An instance of this middleware class + */ + public final static function createWebOutput ($contentType) { + // Is there no instance? + if (is_null(self::$webInstance)) { + // Cast the content-type to string and trim it + $contentType = (string) $contentType; + $contentType = trim($contentType); + + // Set the content type + if (!empty($contentType)) { + @header(sprintf("Content-type: %s", + $contentType + )); + } + + // Get a new instance and set it + self::$webInstance = new WebOutput(); + } + + // Return instance + return self::$webInstance; + } + + /** + * Assigns a variable for output + * + * @param $var The variable we shall assign + * @param $value The value to store in the variable + * @return void + */ + public function assignVariable($var, $value) { + // Stub message because we don't have it here + trigger_error(__METHOD__.": Stub!"); + } + + /** + * Output the code + * + * @return void + */ + public final function output ($outStream=false) { + print $outStream; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/template/.htaccess b/inc/classes/main/template/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/main/template/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/template/class_TemplateEngine.php b/inc/classes/main/template/class_TemplateEngine.php new file mode 100644 index 0000000..62d78cb --- /dev/null +++ b/inc/classes/main/template/class_TemplateEngine.php @@ -0,0 +1,1039 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate { + /** + * The local path name where all templates and sub folders for special + * templates are stored. We will internally determine the language plus + * "html" for web templates or "emails" for email templates + */ + private $basePath = ""; + + /** + * The extension for web and email templates (not compiled templates) + */ + private $templateExtension = ".tpl"; + + /** + * The extension for code templates (not compiled templates) + */ + private $codeExtension = ".ctp"; + + /** + * Path relative to $basePath and language code for compiled code-templates + */ + private $compileOutputPath = "templates/_compiled"; + + /** + * The raw (maybe uncompiled) template + */ + private $rawTemplateData = ""; + + /** + * Template data with compiled-in variables + */ + private $compiledData = ""; + + /** + * The last loaded template's FQFN for debugging the engine + */ + private $lastTemplate = ""; + + /** + * The variable stack for the templates. This must be initialized and + * shall become an instance of FrameworkArrayObject. + */ + private $varStack = null; + + /** + * Configuration variables in a simple array + */ + private $configVariables = array(); + + /** + * The language instance which should link to an object of LanguageSystem + */ + private $langInstance = null; + + /** + * Loaded templates for recursive protection and detection + */ + private $loadedTemplates = array(); + + /** + * Compiled templates for recursive protection and detection + */ + private $compiledTemplates = array(); + + /** + * Loaded raw template data + */ + private $loadedRawData = null; + + /** + * Raw templates which are linked in code templates + */ + private $rawTemplates = null; + + /** + * A regular expression for variable=value pairs + */ + private $regExpVarValue = '/([\w_]+)(="([^"]*)"|=([\w_]+))?/'; + + /** + * A regular expression for filtering out code tags + * + * E.g.: {?template:variable=value;var2=value2;[...]?} + */ + private $regExpCodeTags = '/\{\?([a-z_]+)(:("[^"]+"|[^?}]+)+)?\?\}/'; + + // Exception codes for the template engine + const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0xa00; + const TEMPLATE_CONTAINS_INVALID_VAR_EXCEPTION = 0xa01; + + /** + * Private constructor + * + * @return void + */ + private final function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set part description + $this->setPartDescr("Template-Engine"); + + // Create unique ID number + $this->createUniqueID(); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + } + + /** + * Creates an instance of the class TemplateEngine and prepares it for usage + * + * @param $basePath The local base path for all templates + * @param $langInstance An instance of LanguageSystem (default) + * @param $ioInstance An instance of FileIOHandler (default, middleware!) + * @return $tplInstance An instance of TemplateEngine + * @throws BasePathIsEmptyException If the provided $basePath is empty + * @throws InvalidBasePathStringException If $basePath is no string + * @throws BasePathIsNoDirectoryException If $basePath is no + * directory or not found + * @throws BasePathReadProtectedException If $basePath is + * read-protected + */ + public final static function createTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIOHandler $fileIOInstance) { + // Get a new instance + $tplInstance = new TemplateEngine(); + + // Is the base path valid? + if (empty($basePath)) { + // Base path is empty + throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } elseif (!is_string($basePath)) { + // Is not a string + throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING); + } elseif (!is_dir($basePath)) { + // Is not a path + throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME); + } elseif (!is_readable($basePath)) { + // Is not readable + throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH); + } + + // Get configuration instance + $cfgInstance = $tplInstance->getConfigInstance(); + + // Set the base path + $tplInstance->setBasePath($basePath); + + // Initialize the variable stack + $tplInstance->initVariableStack(); + + // Set the language and IO instances + $tplInstance->setLanguageInstance($langInstance); + $tplInstance->setIOInstance($fileIOInstance); + + // Set template extensions + $tplInstance->setRawTemplateExtension($cfgInstance->readConfig("raw_template_extension")); + $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig("code_template_extension")); + + // Absolute output path for compiled templates + $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig("compile_output_path")); + + // Return the prepared instance + return $tplInstance; + } + + /** + * Search for a variable in the stack + * + * @param $var The variable we are looking for + * @return $idx FALSE means not found, > 0 means found on a specific index + */ + private function isVariableAlreadySet ($var) { + // First everything is not found + $found = false; + + // Now search for it + for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { + // Get current item + $currEntry = $idx->current(); + + // Is the entry found? + if ($currEntry['name'] == $var) { + // Found! + $found = $idx->key(); + break; + } + } + + // Return the current position + return $found; + } + + /** + * Add a variable to the stack + * + * @param $var The variable we are looking for + * @param $value The value we want to store in the variable + * @return void + */ + private function addVariable ($var, $value) { + // Add it to the stack + $this->varStack->append(array( + 'name' => $var, + 'value' => $value + )); + } + + /** + * Modify an entry on the stack + * + * @param $var The variable we are looking for + * @param $value The value we want to store in the variable + * @return void + */ + private function modifyVariable ($var, $value) { + // It should be there so let's look again... + for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { + // Get current entry + $currEntry = $idx->current(); + + // Is this the requested variable? + if ($currEntry['name'] == $var) { + // Change it to the other value + $this->varStack->offsetSet($idx->key(), array( + 'name' => $var, + 'value' => $value + )); + } + } + } + + /** + * Initialize the variable stack. This holds all variables for later + * compilation. + * + * @return void + */ + public final function initVariableStack () { + $this->varStack = new FrameworkArrayObject(); + } + + /** + * Setter for language instance which should be LanguageSystem + * + * @param $langInstance The language instance + * @return void + */ + public final function setLanguageInstance (ManageableLanguage $langInstance) { + $this->langInstance = $langInstance; + } + + /** + * Setter for file I/O instance which should be FileIOHandler + * + * @param $ioInstance The file I/O instance + * @return void + */ + public final function setIOInstance (FileIOHandler $ioInstance) { + $this->ioInstance = $ioInstance; + } + + /** + * Getter for file I/O instance which should be FileIOHandler + * + * @return $ioInstance The file I/O instance + */ + public final function getIOInstance () { + return $this->ioInstance; + } + + /** + * Setter for base path + * + * @param $basePath The local base path for all templates + * @return void + */ + public final function setBasePath ($basePath) { + // Cast it + $basePath = (string) $basePath; + + // And set it + $this->basePath = $basePath; + } + + /** + * Getter for base path + * + * @return $basePath The local base path for all templates + */ + public final function getBasePath () { + // And set it + return $this->basePath; + } + + /** + * Setter for template extension + * + * @param $templateExtension The file extension for all uncompiled + * templates + * @return void + */ + public final function setRawTemplateExtension ($templateExtension) { + // Cast it + $templateExtension = (string) $templateExtension; + + // And set it + $this->templateExtension = $templateExtension; + } + + /** + * Setter for code template extension + * + * @param $codeExtension The file extension for all uncompiled + * templates + * @return void + */ + public final function setCodeTemplateExtension ($codeExtension) { + // Cast it + $codeExtension = (string) $codeExtension; + + // And set it + $this->codeExtension = $codeExtension; + } + + /** + * Getter for template extension + * + * @return $templateExtension The file extension for all uncompiled + * templates + */ + public final function getRawTemplateExtension () { + // And set it + return $this->templateExtension; + } + + /** + * Getter for code-template extension + * + * @return $codeExtension The file extension for all code- + * templates + */ + public final function getCodeTemplateExtension () { + // And set it + return $this->codeExtension; + } + + /** + * Setter for path of compiled templates + * + * @param $compileOutputPath The local base path for all + * compiled templates + * @return void + */ + public final function setCompileOutputPath ($compileOutputPath) { + // Cast it + $compileOutputPath = (string) $compileOutputPath; + + // And set it + $this->compileOutputPath = $compileOutputPath; + } + + /** + * Setter for template type. Only "html", "emails" and "compiled" should + * be sent here + * + * @param $templateType The current template's type + * @return void + */ + private final function setTemplateType ($templateType) { + // Cast it + $templateType = (string) $templateType; + + // And set it (only 2 letters) + $this->templateType = $templateType; + } + + /** + * Getter for template type + * + * @return $templateType The current template's type + */ + public final function getTemplateType () { + return $this->templateType; + } + + /** + * Setter for the last loaded template's FQFN + * + * @param $template The last loaded template + * @return void + */ + private final function setLastTemplate ($template) { + // Cast it to string + $template = (string) $template; + $this->lastTemplate = $template; + } + + /** + * Getter for the last loaded template's FQFN + * + * @return $template The last loaded template + */ + private final function getLastTemplate () { + return $this->lastTemplate; + } + + /** + * Assign (add) a given variable with a value + * + * @param $var The variable we are looking for + * @param $value The value we want to store in the variable + * @return void + */ + public final function assignVariable ($var, $value) { + // First search for the variable if it was already added + $idx = $this->isVariableAlreadySet($var); + + // Was it found? + if ($idx === false) { + // Add it to the stack + $this->addVariable($var, $value); + } elseif (!empty($value)) { + // Modify the stack entry + $this->modifyVariable($var, $value); + } + } + + /** + * Assign a given congfiguration variable with a value + * + * @param $var The configuration variable we are looking for + * @param $value The value we want to store in the variable + * @return void + */ + public final function assignConfigVariable ($var, $value) { + // Sweet and simple... + $this->configVariables[$var] = $value; + } + + /** + * Removes a given variable + * + * @param $var The variable we are looking for + * @return void + */ + public final function removeVariable ($var) { + // First search for the variable if it was already added + $idx = $this->isVariableAlreadySet($var); + + // Was it found? + if ($idx !== false) { + // Remove this variable + $this->varStack->offsetUnset($idx); + } + } + + /** + * Private setter for raw template data + * + * @param $rawTemplateData The raw data from the template + * @return void + */ + private final function setRawTemplateData ($rawTemplateData) { + // Cast it to string + $rawTemplateData = (string) $rawTemplateData; + + // And store it in this class + $this->rawTemplateData = $rawTemplateData; + } + + /** + * Private setter for compiled templates + */ + private final function setCompiledData ($compiledData) { + // Cast it to string + $compiledData = (string) $compiledData; + + // And store it in this class + $this->compiledData = $compiledData; + } + + /** + * Private loader for all template types + * + * @param $template The template we shall load + * @return void + */ + private final function loadTemplate ($template) { + // Cast it to string + $template = (string) $template; + + // Get extension for the template + $ext = $this->getRawTemplateExtension(); + + // If we shall load a code-template we need to switch the file extension + if ($this->getTemplateType() == $this->getConfigInstance()->readConfig("code_template_type")) { + // Switch over to the code-template extension + $ext = $this->getCodeTemplateExtension(); + } + + // Construct the FQFN for the template by honoring the current language + $fqfn = sprintf("%s%s/%s/%s%s", + $this->getBasePath(), + $this->langInstance->getLanguageCode(), + $this->getTemplateType(), + $template, + $ext + ); + + // Load the raw template data + $this->loadRawTemplateData($fqfn); + } + + /** + * A private loader for raw template names + * + * @param $fqfn The full-qualified file name for a template + * @return void + * @throws NullPointerException If $inputInstance is null + * @throws NoObjectException If $inputInstance is not an object + * @throws MissingMethodException If $inputInstance is missing a + * required method + */ + private function loadRawTemplateData ($fqfn) { + // Debug message + if ((defined('DEBUG_TEMPLATE')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Template %s vom Typ %s wird geladen.
\n", + $this->__toString(), + $template, + $this->getTemplateType() + )); + + // Get a input/output instance from the middleware + $ioInstance = $this->getIOInstance(); + + // Validate the instance + if (is_null($ioInstance)) { + // Throw exception + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($ioInstance)) { + // Throw another exception + throw new NoObjectException($ioInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($ioInstance, 'loadFileContents')) { + // Throw yet another exception + throw new MissingMethodException(array($ioInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD); + } + + // Load the raw template + $rawTemplateData = $ioInstance->loadFileContents($fqfn); + + // Debug message + if ((defined('DEBUG_TEMPLATE')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] %s Byte Rohdaten geladen.
\n", + $this->__toString(), + strlen($rawTemplateData) + )); + + // Store the template's contents into this class + $this->setRawTemplateData($rawTemplateData); + + // Remember the template's FQFN + $this->setLastTemplate($fqfn); + } + + /** + * Try to assign an extracted template variable as a "content" or "config" + * variable. + * + * @param $varName The variable's name (shall be content or + * config) by default + * @param $var The variable we want to assign + */ + private function assignTemplateVariable ($varName, $var) { + // Is it not a config variable? + if ($varName != "config") { + // Regular template variables + $this->assignVariable($var, ""); + } else { + // Configuration variables + $this->assignConfigVariable($var, $this->getConfigInstance()->readConfig($var)); + } + } + + /** + * Extract variables from a given raw data stream + * + * @param $rawData The raw template data we shall analyze + * @return void + * @throws InvalidTemplateVariableNameException If a variable name + * in a template is + * invalid + */ + private function extractVariablesFromRawData ($rawData) { + // Cast to string + $rawData = (string) $rawData; + + // Search for variables + @preg_match_all('/\$(\w+)(\[(\w+)\])?/', $rawData, $variableMatches); + + // Did we find some variables? + if ((is_array($variableMatches)) && (count($variableMatches) == 4) && (count($variableMatches[0]) > 0)) { + // Initialize all missing variables + foreach ($variableMatches[3] as $key=>$var) { + // Is the variable name valid? + if (($variableMatches[1][$key] != $this->getConfigInstance()->readConfig("tpl_valid_var")) && ($variableMatches[1][$key] != "config")) { + // Invalid variable name + throw new InvalidTemplateVariableNameException(array($this, $this->getLastTemplate(), $variableMatches[1][$key], $this->getConfigInstance()), self::TEMPLATE_CONTAINS_INVALID_VAR_EXCEPTION); + } + + // Try to assign it, empty strings are being ignored + $this->assignTemplateVariable($variableMatches[1][$key], $var); + } + } + } + + /** + * Main analysis of the loaded template + * + * @param $templateMatches Found template place-holders, see below + * @return void + * + *--------------------------------- + * Structure of $templateMatches: + *--------------------------------- + * [0] => Array - An array with all full matches + * [1] => Array - An array with left part (before the ":") of a match + * [2] => Array - An array with right part of a match including ":" + * [3] => Array - An array with right part of a match excluding ":" + */ + private function analyzeTemplate ($templateMatches) { + // Backup raw template data + $backup = $this->getRawTemplateData(); + + // Initialize some arrays + if (is_null($this->loadedRawData)) { $this->loadedRawData = array(); $this->rawTemplates = array(); } + + // Load all requested templates + foreach ($templateMatches[1] as $template) { + + // Load and compile only templates which we have not yet loaded + // RECURSIVE PROTECTION! BE CAREFUL HERE! + if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) { + + // Then try to search for code-templates first + try { + // Load the code template and remember it's contents + $this->loadCodeTemplate($template); + $this->loadedRawData[$template] = $this->getRawTemplateData(); + + // Remember this template for recursion detection + // RECURSIVE PROTECTION! + $this->loadedTemplates[] = $template; + } catch (FilePointerNotOpenedException $e) { + // Template not found! + $this->rawTemplates[] = $template; + } + + } // if ((!isset( ... + + } // for ($templateMatches ... + + // Restore the raw template data + $this->setRawTemplateData($backup); + } + + /** + * Compile a given raw template code and remember it for later usage + * + * @param $code The raw template code + * @param $template The template's name + * @return void + */ + private function compileCode ($code, $template) { + // Is this template already compiled? + if (in_array($template, $this->compiledTemplates)) { + // Abort here... + return; + } + + // Remember this template being compiled + $this->compiledTemplates[] = $template; + + // Compile the loaded code in five steps: + // + // 1. Backup current template data + $backup = $this->getRawTemplateData(); + + // 2. Set the current template's raw data as the new content + $this->setRawTemplateData($code); + + // 3. Compile the template data + $this->compileTemplate(); + + // 4. Remember it's contents + $this->loadedRawData[$template] = $this->getRawTemplateData(); + + // 5. Restore the previous raw content from backup variable + $this->setRawTemplateData($backup); + } + + /** + * Insert all given and loaded templates by running through all loaded + * codes and searching for their place-holder in the main template + * + * @param $templateMatches See method analyzeTemplate() + * @return void + */ + private function insertAllTemplates ($templateMatches) { + // Run through all loaded codes + foreach ($this->loadedRawData as $template => $code) { + + // Search for the template + $foundIndex = array_search($template, $templateMatches[1]); + + // Lookup the matching template replacement + if (isset($templateMatches[0][$foundIndex])) { + + // Get the current raw template + $rawData = $this->getRawTemplateData(); + + // Replace the space holder with the template code + $rawData = str_replace($templateMatches[0][$foundIndex], $code, $rawData); + + // Set the new raw data + $this->setRawTemplateData($rawData); + } + } + } + + /** + * Load all extra raw templates + * + * @return void + */ + private function loadExtraRawTemplates () { + // Are there some raw templates we need to load? + if (count($this->rawTemplates) > 0) { + // Try to load all raw templates + foreach ($this->rawTemplates as $key => $template) { + try { + // Load the template + $this->loadWebTemplate($template); + + // Remember it's contents + $this->rawTemplates[$template] = $this->getRawTemplateData(); + + // Remove it from the loader list + unset($this->rawTemplates[$key]); + + // Remember this template for recursion detection + // RECURSIVE PROTECTION! + $this->loadedTemplates[] = $template; + } catch (FilePointerNotOpenedException $e) { + // This template was never found. We silently ignore it + unset($this->rawTemplates[$key]); + } + } + } + } + + /** + * Assign all found template variables + * + * @param $varMatches An array full of variable/value pairs. + * @return void + */ + private function assignAllVariables ($varMatches) { + // Search for all variables + foreach ($varMatches[1] as $key=>$var) { + + // Detect leading equals + if (substr($varMatches[2][$key], 0, 1) == "=") { + // Remove and cast it + $varMatches[2][$key] = (string) substr($varMatches[2][$key], 1); + } + + // Do we have some quotes left and right side? Then it is free text + if ((substr($varMatches[2][$key], 0, 1) == "\"") && (substr($varMatches[2][$key], -1, 1) == "\"")) { + // Free string detected! Which we can assign directly + $this->assignVariable($var, $varMatches[3][$key]); + } else { + // Non-string found so we need some deeper analysis... + die("Deeper analysis not yet implemented!"); + } + + } // for ($varMatches ... + } + /** + * Compiles all loaded raw templates + * + * @param $templateMatches See method analyzeTemplate() for details + * @return void + */ + private function compileRawTemplateData ($templateMatches) { + // Are some code-templates found which we need to compile? + if (count($this->loadedRawData) > 0) { + + // Then compile all! + foreach ($this->loadedRawData as $template => $code) { + + // Search for the template + $foundIndex = array_search($template, $templateMatches[1]); + + // Lookup the matching variable data + if (isset($templateMatches[3][$foundIndex])) { + + // Split it up with another reg. exp. into variable=value pairs + @preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches); + + // Assign all variables + $this->assignAllVariables($varMatches); + + } // END - if (isset($templateMatches ... + + // Compile the loaded template + $this->compileCode($code, $template); + + } // END - foreach ($this->loadedRawData ... + + // Insert all templates + $this->insertAllTemplates($templateMatches); + + } // END - if (count($this->loadedRawData) ... + } + + /** + * Getter for raw template data + * + * @return $rawTemplateData The raw data from the template + */ + public final function getRawTemplateData () { + return $this->rawTemplateData; + } + + /** + * Getter for compiled templates + */ + public final function getCompiledData () { + return $this->compiledData; + } + + /** + * Load a specified web template into the engine + * + * @param $template The web template we shall load which is + * located in "html" by default + * @return void + */ + public final function loadWebTemplate ($template) { + // Set template type + $this->setTemplateType($this->getConfigInstance()->readConfig("web_template_type")); + + // Load the special template + $this->loadTemplate($template); + } + + /** + * Load a specified email template into the engine + * + * @param $template The email template we shall load which is + * located in "emails" by default + * @return void + */ + public final function loadEmailTemplate ($template) { + // Set template type + $this->setTemplateType($this->getConfigInstance()->readConfig("email_template_type")); + + // Load the special template + $this->loadTemplate($template); + } + + /** + * Load a specified code template into the engine + * + * @param $template The code template we shall load which is + * located in "code" by default + * @return void + */ + public final function loadCodeTemplate ($template) { + // Set template type + $this->setTemplateType($this->getConfigInstance()->readConfig("code_template_type")); + + // Load the special template + $this->loadTemplate($template); + } + + /** + * Compile all variables by inserting their respective values + * + * @return void + */ + public final function compileVariables () { + // Initialize the $content array + $validVar = $this->getConfigInstance()->readConfig("tpl_valid_var"); + $dummy = array(); + + // Iterate through all variables + for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { + // Get current variable from the stack + $currVariable = $idx->current(); + + // Transfer it's name/value combination to the $content array + $dummy[$currVariable['name']] = $currVariable['value']; + } + $$validVar = $dummy; + + // Prepare all configuration variables + $config = $this->configVariables; + + // Remove some variables + unset($idx); + unset($currVariable); + + // Prepare the eval() command for comiling the template + $eval = sprintf("\$this->setCompiledData(\"%s\");", + addslashes($this->getRawTemplateData()) + ); + + // Debug message + if (((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + $this->__toString(), + htmlentities($eval) + )); + + // Run the constructed command. This will "compile" all variables in + eval($eval); + } + + /** + * Compile all required templates into the current loaded one + * + * @return void + * @throws UnexpectedTemplateTypeException If the template type is + * not "code" + * @throws InvalidArrayCountException If an unexpected array + * count has been found + */ + public final function compileTemplate () { + // We will only work with template type "code" from configuration + if ($this->getTemplateType() != $this->getConfigInstance()->readConfig("code_template_type")) { + // Abort here + throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->readConfig("code_template_type")), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED); + } + + // Get the raw data. Thanks to Flobee(R) for given me a hint using the + // modifier "m" in regular expressions. I had implemented a regex here + // like this: (\n|\r) + $rawData = $this->getRawTemplateData(); + + // Remove double spaces and trim leading/trailing spaces + $rawData = trim(str_replace(" ", " ", $rawData)); + + // Search for raw variables + $this->extractVariablesFromRawData($rawData); + + // Search for code-tags which are {? ?} + @preg_match_all($this->regExpCodeTags, $rawData, $templateMatches); + + // Analyze the matches array + if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) { + // Entries are found: + // + // The main analysis + $this->analyzeTemplate($templateMatches); + + // Compile raw template data + $this->compileRawTemplateData($templateMatches); + + // Are there some raw templates left for loading? + $this->loadExtraRawTemplates(); + + // Are some raw templates found and loaded? + if (count($this->rawTemplates) > 0) { + die("NOT YET IMPLEMENTED"); + } + } // END - if($templateMatches ... + } + + /** + * Output the compiled page to the outside world. In case of web templates + * this would be vaild (X)HTML code. And in case of email templates this + * would store a prepared email body inside the template engine. + * + * @return void + */ + public final function output () { + // Check which type of template we have + switch ($this->getTemplateType()) { + case "html": // Raw HTML templates can be send to the output buffer + // Quick-N-Dirty: + $this->getWebOutputInstance()->output($this->getCompiledData()); + break; + + default: // Unknown type found + if ((is_object($this->getDebugInstance())) && (method_exists($this->getDebugInstance(), 'output'))) { + // Use debug output handler + $this->getDebugInstance()->output(sprintf("[%s:] Unbekannter Template-Typ %s erkannt.", + $this->__toString(), + $this->getTemplateType() + )); + die(); + } else { + // Put directly out + // DO NOT REWRITE THIS TO app_die() !!! + die(sprintf("[%s:] Unbekannter Template-Typ %s erkannt.", + $this->__toString(), + $this->getTemplateType() + )); + } + break; + } + } +} + +// [EOF] +?> diff --git a/inc/classes/middleware/.htaccess b/inc/classes/middleware/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/middleware/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/middleware/class_BaseMiddleware.php b/inc/classes/middleware/class_BaseMiddleware.php new file mode 100644 index 0000000..e0a8b6b --- /dev/null +++ b/inc/classes/middleware/class_BaseMiddleware.php @@ -0,0 +1,49 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 BaseMiddleware extends BaseFrameworkSystem { + /** + * Private constructor + * + * @return void + */ + private function __construct ($class) { + // Call parent constructor + parent::constructor($class); + + // Clean up a little + $this->removeNumberFormaters(); + } + + /** + * Public constructor + * + * @return void + */ + public function constructor ($class) { + // Just call the private constructor + $this->__construct($class); + } +} + +// [EOF] +?> diff --git a/inc/classes/middleware/compressor/.htaccess b/inc/classes/middleware/compressor/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/middleware/compressor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php new file mode 100644 index 0000000..05fbad0 --- /dev/null +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -0,0 +1,138 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 CompressorChannel extends BaseMiddleware { + // Output handler instance + private $compressor = null; + + // Public constructor + private function __construct () { + // Call parent constructor! + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Komprimierungshandler"); + + // Create an unique ID + $this->createUniqueID(); + } + + // Create a new compressor channel based a given compression handler + public final static function createCompressorChannel ($baseDir) { + // Get new instance + $cInstance = new CompressorChannel(); + + // Is the compressor handler set? + if ( + (is_null($cInstance->getCompressor())) + || (!is_object($cInstance->getCompressor())) + || (!method_exists($cInstance->getCompressor(), 'compressStream')) + || (!method_exists($cInstance->getCompressor(), 'decompressStream')) + ) { + // Get a directory pointer + $dirPointer = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($baseDir); + + // Read all directories but no sub directories + while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess"))) { + // Is this a class file? + if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == $cInstance->getConfigInstance()->readConfig("php_extension"))) { + // Get the compressor's name. That's why you must name + // your files like your classes and also that's why you + // must keep on class in one file. + $class = substr($dir, 6, -4); + + // Create eval command + $eval = sprintf("\$tempInstance = %s::create%s();", + $class, + $class + ); + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + $cInstance->__toString(), + htmlentities($eval) + )); + + // Run it. This will create an instance to the current class + eval($eval); + + // Is the instance valid? We have the stream handler here + if ((!is_null($tempInstance)) && (method_exists($tempInstance, 'compressStream')) && (method_exists($tempInstance, 'decompressStream'))) { + // Okay, this handler is valid + $cInstance->setCompressor($tempInstance); + + // No more searches required because we have found a valid compressor stream + break; + } + } + } + + // Close the directory + $dirPointer->closeDirectory(); + } + + // Check again if there is a compressor + if ( + (is_null($cInstance->getCompressor())) + || (!is_object($cInstance->getCompressor())) + || (!method_exists($cInstance->getCompressor(), 'compressStream')) + || (!method_exists($cInstance->getCompressor(), 'decompressStream')) + ) { + // Set the null compressor handler + $cInstance->setCompressor(NullCompressor::createNullCompressor()); + } + + // Return the compressor instance + return $cInstance; + } + + /** + * Getter for compressor instance + * + * @return $compressor The compressor instance + */ + public final function getCompressor () { + return $this->compressor; + } + + /** + * Setter for compressor + * + * @param $compressorInstance The compressor instance we shall use + * @return void + */ + public final function setCompressor (Compressor $compressorInstance) { + $this->compressor = $compressorInstance; + } + + /** + * Getter for the file extension of the current compressor + */ + public final function getCompressorExtension () { + // Get compressor extension from current compressor + return $this->getCompressor()->getCompressorExtension(); + } +} + +// [EOF] +?> diff --git a/inc/classes/middleware/database/.htaccess b/inc/classes/middleware/database/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/middleware/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/middleware/database/class_DatabaseConnection.php b/inc/classes/middleware/database/class_DatabaseConnection.php new file mode 100644 index 0000000..8499c0f --- /dev/null +++ b/inc/classes/middleware/database/class_DatabaseConnection.php @@ -0,0 +1,213 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DatabaseConnection extends BaseMiddleware implements DatabaseConnector, LimitableObject { + // Array for connection data + private $connectData = array(); + + // The real database layer + private $dbLayer = null; + + // An instance of this class + private static $thisInstance = null; + + // Private constructor + private final function __construct() { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Datenbank-Mittelschicht"); + + // Create an unique ID + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Create new database connection layer + public final static function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseFrontendInterface $dbLayer) { + // Get instance + $dbInstance = new DatabaseConnection(); + + // Set debug output handler + $dbInstance->setDebugInstance($debugInstance); + + // Set database layer + $dbInstance->setDatabaseLayer($dbLayer); + + // Set db instance + self::$thisInstance = $dbInstance; + + // Return instance + return $dbInstance; + } + + // Get an instance of this class + public final static function getInstance () { + return self::$thisInstance; + } + + // Public setter for database connection + public final function setConnectionData ($login, $pass, $dbase, $host) { + // Transfer connection data + $this->connectData['login'] = (string) $login; + $this->connectData['pass'] = (string) $pass; + $this->connectData['dbase'] = (string) $dbase; + $this->connectData['host'] = (string) $host; + } + + /** + * Save a whole object or parts of it to the database or local file + * + * @param $object The object we shall save + * @return void + * @throws NullPointerException If $limitInstance is null + * @throws NoObjectException If $limitInstance is not an object + * @throws MissingMethodException If the required method + * saveObject() was not found + */ + public final function saveObject ($object) { + // Some sanity checks + if (is_null($this->dbLayer)) { + // Is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->dbLayer)) { + // Is not an object + throw new NoObjectException($this->dbLayer, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->dbLayer, 'saveObject')) { + // Does not have the required instance + throw new MissingMethodException(array($this->dbLayer, 'saveObject'), self::EXCEPTION_MISSING_METHOD); + } + + // For now just pipe it through to the database layer + $this->dbLayer->saveObject($object); + } + + /** + * Set a limitation for the saving process. This shall be done before + * saveObject() is called else saveObject() shall save the whole object. + * + * @param $limitInstance An instance of ObjectLimits which contains + * elements we shall exclusivly include in + * saving process + * @return void + * @throws NullPointerException If $limitInstance is null + * @throws NoObjectException If $limitInstance is not an object + * @throws MissingMethodException If the required method + * limitObject() was not found + */ + public final function limitObject (ObjectLimits $limitInstance) { + // Get real database connection + $this->dbLayer = $this->getDatabaseInstance(); + + // Some sanity checks + if (is_null($this->dbLayer)) { + // Is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->dbLayer)) { + // Is not an object + throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->dbLayer, 'limitObject')) { + // Does not have the required instance + throw new MissingMethodException(array($this->dbLayer, 'limitObject'), self::EXCEPTION_MISSING_METHOD); + } + + // For now we pipe this through to the real database instance + $this->dbLayer->limitObject($limitInstance); + } + + /** + * Analyses if a unique ID has already been used or not. This method does + * only pass the given ID through to the "real" database layer. + * + * @param $uniqueID A unique ID number which shall be checked + * before it will be used + * @param $inConstructor If called from a constructor 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 NullPointerException If $this->dbLayer is null + * @throws NoObjectException If $this->dbLayer is not an object + * @throws MissingMethodException If the required method + * isUniqueIdUsed() was not found + */ + public final function isUniqueIdUsed ($uniqueID, $inConstructor = false) { + // Some sanity checks + if (is_null($this->dbLayer)) { + // Is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->dbLayer)) { + // Is not an object + throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->dbLayer, 'isUniqueIdUsed')) { + // Does not have the required instance + throw new MissingMethodException(array($this->dbLayer, 'isUniqueIdUsed'), self::EXCEPTION_MISSING_METHOD); + } + + // Pass the returning result through + return $this->dbLayer->isUniqueIdUsed($uniqueID, $inConstructor); + } + + /** + * Gets cached data from the database layer and if not found fetch it from + * the database again. This method does not return the header stuff because + * The underlaying database class will return only the requested content. + * + * @param $idNumber The ID number which we need for looking up + * the requested data + * @return $cachedArray The maybe cached data from the database + * @throws NullPointerException If $this->dbLayer is null + * @throws NoObjectException If $this->dbLayer is not an object + * @throws MissingMethodException If the required method + * isUniqueIdUsed() was not found + */ + public final function getObjectFromCachedData ($idNumber) { + // Some sanity checks + if (is_null($this->dbLayer)) { + // Is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->dbLayer)) { + // Is not an object + throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->dbLayer, 'getObjectFromCachedData')) { + // Does not have the required instance + throw new MissingMethodException(array($this->dbLayer, 'getObjectFromCachedData'), self::EXCEPTION_MISSING_METHOD); + } + + // Pass the returning result through + return $this->dbLayer->getObjectFromCachedData($idNumber); + } + + /** + * Setter for the real database layer + * @param $dbLayer An instance of the real database layer + * @return void + */ + public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) { + $this->dbLayer = $dbLayer; + } +} + +// [EOF] +?> diff --git a/inc/classes/middleware/debug/.htaccess b/inc/classes/middleware/debug/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/middleware/debug/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/middleware/debug/class_DebugMiddleware.php b/inc/classes/middleware/debug/class_DebugMiddleware.php new file mode 100644 index 0000000..e43ce8b --- /dev/null +++ b/inc/classes/middleware/debug/class_DebugMiddleware.php @@ -0,0 +1,146 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 DebugMiddleware extends BaseMiddleware { + /** + * The concrete output instance + */ + private $outputHandler = null; + + /** + * An instance of this class + */ + private static $thisInstance = null; + + /** + * Private constructor + * + * @return void + */ + private final function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Debug-Ausgabe-Handler"); + + // Create an unique ID + $this->createUniqueID(); + + // Set own instance + self::$thisInstance = $this; + } + + /** + * Create a new debug output system. + * If no output is given this class is currently being used for back-fall. + * This fall-back mechanism will become deprecated very soon. + * + * @param $debuggerClass The class name which we shall use for + * registering the *real* debug output + * @return $debugInstance An instance of this middleware class + */ + public final static function createDebugMiddleware ($debuggerClass) { + // Create an instance if this middleware + $debugInstance = new DebugMiddleware(); + + // Is there a valid output handler provided? + if ((!is_null($debuggerClass)) && (is_object($debuggerClass)) && (method_exists($debuggerClass, 'outputStream'))) { + // Use the given output system + $debugInstance->setOutputHandler($debuggerClass); + } elseif ((!is_null($debuggerClass)) && (is_string($debuggerClass)) && (class_exists($debuggerClass))) { + // A name for a debug output class has been provided so we try to get it + $eval = sprintf("\$debuggerClass = %s::create%s();", + $debuggerClass, + $debuggerClass + ); + + // Run the constructed name + @eval($eval); + + // Was this successfull? + if ((is_object($debuggerClass)) && (method_exists($debuggerClass, "outputStream"))) { + // Set this as output class + $debugInstance->setOutputHandler($debuggerClass); + } else { + // No object or method is missing use fall-back + throw new MissingMethodException(array($debuggerClass, 'outputStream'), self::EXCEPTION_MISSING_METHOD); + } + } + + // Return instance + return $debugInstance; + } + + /** + * Getter for an instance of this class + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance() { + return self::$thisInstance; + } + + /** + * Setter for output handler + * + * @return void + */ + public final function setOutputHandler ($outputHandler) { + $this->outputHandler = $outputHandler; + } + + /** + * This method shall send debug output which can be HTML code for the + * browser or debug lines for a log file, etc. to the registered debug + * output handler. + * + * @return void + */ + public final function output ($outStream) { + // Check if the output handler is valid + if (is_null($this->outputHandler)) { + // Debug output handler was not set + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->outputHandler)) { + // The debug output handler is not an object + throw new NoObjectException($this->ouputHandler, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->outputHandler, 'outputStream')) { + // The required method outputStream() is missing + throw new MissingMethodException(array($this->outputHandler, 'outputStream'), self::EXCEPTION_MISSING_METHOD); + } + + // Is the output stream set + if (empty($outStream)) { + // Initialization phase + return; + } + + // Use the output handler + $this->outputHandler->outputStream($outStream); + } +} + +// [EOF] +?> diff --git a/inc/classes/middleware/io/.htaccess b/inc/classes/middleware/io/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/classes/middleware/io/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/middleware/io/class_FileIOHandler.php b/inc/classes/middleware/io/class_FileIOHandler.php new file mode 100644 index 0000000..40b2b35 --- /dev/null +++ b/inc/classes/middleware/io/class_FileIOHandler.php @@ -0,0 +1,180 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FileIOHandler extends BaseMiddleware { + /** + * The *real* file input class we shall use for reading data + */ + private $inputStream = null; + + /** + * The *real* file output class we shall use for reading data + */ + private $outputStream = null; + + /** + * An instance of this class + */ + private static $thisInstance = null; + + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Datei-Ein-/Ausgabe-Handler"); + + // Create an unique ID + $this->createUniqueID(); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + + // Set own instance + self::$thisInstance = $this; + } + + /** + * Creates an instance of this class and prepares the IO system. This is + * being done by setting the default file IO class + * + * @return $ioInstance A prepared instance of FilIOHandler + */ + public final static function createFileIOHandler () { + // Get instance + $ioHandler = new FileIOHandler(); + + // Set the *real* file IO instances (both the same) + $ioHandler->setInputStream(FileIOStream::createFileIOStream()); + $ioHandler->setOutputStream(FileIOStream::createFileIOStream()); + + // Return instance + return $ioHandler; + } + + /** + * Getter for an instance of this class + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance () { + return self::$thisInstance; + } + + /** + * Setter for the *real* file input instance + * + * @param $inputStream The *real* file-input class + */ + public final function setInputStream (FileInputStreamer $inputStream) { + $this->inputStream = $inputStream; + } + + /** + * Getter for the *real* file input instance + * + * @return $inputStream The *real* file-input class + */ + public final function getInputStream () { + return $this->inputStream; + } + + /** + * Setter for the *real* file output instance + * + * @param $outputStream The *real* file-output class + */ + public final function setOutputStream (FileOutputStreamer $outputStream) { + $this->outputStream = $outputStream; + } + + /** + * Getter for the *real* file output instance + * + * @return $outputStream The *real* file-output class + */ + public final function getOutputStream () { + return $this->outputStream; + } + + /** + * Saves a file with data by using the current output stream + * + * @see FileOutputStreamer + */ + public function saveFile ($fileName, $dataArray) { + // Get output stream + $outInstance = $this->getOutputStream(); + + // Is it a valid stream? + if (is_null($outInstance)) { + // No class returned + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($outInstance)) { + // Not an object! ;-( + throw new NoObjectException($outInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($outInstance, 'saveFile')) { + // Nope, so throw exception + throw new MissingMethodException(array($outInstance, 'saveFile'), self::EXCEPTION_MISSING_METHOD); + } + + // Send the fileName and dataArray to the output handler + $outInstance->saveFile($fileName, $dataArray); + } + + /** Loads data from a file over the input handler + * + * @see FileInputStreamer + */ + public function loadFileContents ($fqfn) { + // Initialize the array + $array = array(); + + // Get output stream + $inInstance = $this->getInputStream(); + + // Is it a valid stream? + if (is_null($inInstance)) { + // No class returned + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($inInstance)) { + // Not an object! ;-( + throw new NoObjectException($inInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($inInstance, 'loadFileContents')) { + // Nope, so throw exception + throw new MissingMethodException(array($inInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD); + } + + // Read from the input handler + return $inInstance->loadFileContents($fqfn); + } +} + +// [EOF] +?> diff --git a/inc/config.php b/inc/config.php new file mode 100644 index 0000000..62134c1 --- /dev/null +++ b/inc/config.php @@ -0,0 +1,155 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ + +// Load the class from inc/config direktory +@require_once(dirname(__FILE__) . "/config/class_FrameworkConfiguration.php"); + +// Get a new configuration instance +$cfg = FrameworkConfiguration::createFrameworkConfiguration(); + +// CFG: SERVER-PATH +$cfg->definePath(dirname(dirname(__FILE__)) . "/"); // DON'T MISS THE TRAILING SLASH!!! + +// CFG: DATABASE-TYPE +$cfg->defineDatabaseType("local"); + +// CFG: TIME-ZONE +$cfg->setDefaultTimezone("Europe/Berlin"); + +// CFG: MAGIC-QUOTES-RUNTIME +$cfg->setMagicQuotesRuntime(false); + +// CFG: PHP-SCRIPT-EXTENSION +$cfg->setConfigEntry("php_extension", ".php"); + +// CFG: CLASS-PREFIX +$cfg->setConfigEntry("class_prefix", "class_"); + +// CFG: CLASS-SUFFIX +$cfg->setConfigEntry("class_suffix", ".php"); + +// CFG: RAW-TEMPLATE-EXTENSION +$cfg->setConfigEntry("raw_template_extension", ".tpl"); + +// CFG: CODE-TEMPLATE-EXTENSION +$cfg->setConfigEntry("code_template_extension", ".ctp"); + +// CFG: SELECTOR-GET +$cfg->setConfigEntry("app_selector_get", "app"); + +// CFG: APPLICATION-HELPER +$cfg->setConfigEntry("app_helper_class", "ApplicationHelper"); + +// CFG: SELECTOR-PATH +$cfg->setConfigEntry("selector_path", "selector"); + +// CFG: TEMPLATE-BASE-PATH +$cfg->setConfigEntry("tpl_base_path", "templates/"); // DON'T MISS THE TRAILING SLASH! + +// CFG: LANGUAGE-BASE-PATH +$cfg->setConfigEntry("lang_base_path", "inc/language/"); // DON'T MISS THE TRAILING SLASH! + +// CFG: COMPRESSOR-BASE-PATH +$cfg->setConfigEntry("compressor_base_path", "inc/classes/main/compressor/"); // DON'T MISS THE TRAILING SLASH! + +// CFG: APPLICATION-PATH +$cfg->setConfigEntry("application_path", "application"); + +// CFG: COMPILE-OUTPUT-PATH +$cfg->setConfigEntry("compile_output_path", "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH! + +// CFG: TEMPLATE-ENGINE +$cfg->setConfigEntry("tpl_engine", "TemplateEngine"); + +// CFG: DEBUG-ENGINE +$cfg->setConfigEntry("debug_engine", "DebugWebOutput"); + +// CFG: DEFAULT-LANGUAGE +$cfg->setConfigEntry("default_lang", "de"); // A two-char language string: de for german, en for english and so on + +// CFG: WEB-TEMPLATE-TYPE +$cfg->setConfigEntry("web_template_type", "html"); + +// CFG: EMAIL-TEMPLATE-TYPE +$cfg->setConfigEntry("email_template_type", "emails"); + +// CFG: CODE-TEMPLATE-TYPE +$cfg->setConfigEntry("code_template_type", "code"); + +// CFG: WEB-ENGINE +$cfg->setConfigEntry("web_engine", "WebOutput"); + +// CFG: SELECTOR-TEMPLATE-PREFIX +$cfg->setConfigEntry("tpl_selector_prefix", "selector"); + +// CFG: WEB-CONTENT-TYPE +$cfg->setConfigEntry("web_content_type", "text/html"); + +// CFG: VALID-TEMPLATE-VARIABLE +$cfg->setConfigEntry("tpl_valid_var", "content"); + +// CFG: META-AUTHOR +$cfg->setConfigEntry("meta_author", "Roland Häder"); + +// CFG: META-PUBLISHER +$cfg->setConfigEntry("meta_publisher", "Roland Häder"); + +// CFG: META-KEYWORDS +$cfg->setConfigEntry("meta_keywords", "test,test,test"); + +// CFG: META-DESCRIPTION +$cfg->setConfigEntry("meta_description", "A lame description for an application framework"); + +// CFG: LAUNCH-METHOD +$cfg->setConfigEntry("entry_method", "entryPoint"); + +// CFG: SELECTOR-MAIN-TEMPLATE +$cfg->setConfigEntry("selector_main_tpl", "selector_main"); + +// CFG: SELECTOR-APPS-TEMPLATE +$cfg->setConfigEntry("selector_apps_tpl", "selector_apps"); + +// CFG: SELECTOR-NAME +$cfg->setConfigEntry("selector_name", "selector"); + +// CFG: DEFAULT-APPLICATION +$cfg->setConfigEntry("default_application", "selector"); + +// CFG: VERBOSE-LEVEL +$cfg->setConfigEntry("verbose_level", 0); + +// Shall we include config-local.php where you can configure some things? Then +// We need to do some things: +// +// First generate FQFN +$localConfig = sprintf("%sinc/config-local%s", PATH, $cfg->readConfig("php_extension")); + +// Second is the file there and readable? +if ((file_exists($localConfig)) && (is_readable($localConfig))) { + // The third step to load it + require_once($localConfig); +} + +// [EOF] +?> diff --git a/inc/config/.htaccess b/inc/config/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/config/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/config/class_FrameworkConfiguration.php b/inc/config/class_FrameworkConfiguration.php new file mode 100644 index 0000000..f49c3c2 --- /dev/null +++ b/inc/config/class_FrameworkConfiguration.php @@ -0,0 +1,298 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 FrameworkConfiguration { + /** + * Include files which shall be included before the main loader. + */ + private $moreIncPre = null; + + /** + * Include files which shall be included after the main loader. + */ + private $moreIncPost = null; + + /** + * The framework's main configuration array which will be initialized with + * hard-coded configuration data and might be overwritten/extended by + * config data from the database. + */ + private $config = array(); + + /** + * The configuration instance itself + */ + private static $cfgInstance = null; + + // Some constants for the configuration system + const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0xc00; + const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0xc01; + + /** + * Private constructor + */ + private function __construct () { + // Initialize both include lists + $this->moreIncPre = new ArrayObject(); + $this->moreIncPost = new ArrayObject(); + } + + /** + * "Create" a configuration instance + */ + public final static function createFrameworkConfiguration ($enableDebug = false) { + /** + * For singleton design pattern because we only need a one-time-run + * through the initial configuration. + */ + if (is_null(self::$cfgInstance)) { + // CFG: DEBUG-LEVEL + @error_reporting(E_ALL | E_STRICT); + + /** + * Shall we enable the debug mode? + */ + if ($enableDebug) { + define('DEBUG_MODE', true); + } + + /** + * Crate a config instance + */ + self::$cfgInstance = new FrameworkConfiguration(); + } + + /** + * Return the instance + */ + return self::$cfgInstance; + } + + /** + * Getter for an instance of this class + * + * @return $cfgInstance An instance of this class + */ + public final static function getInstance () { + return self::$cfgInstance; + } + + /** + * Setter for default time zone (must be correct!) + * + * @param $zone The time-zone string (e.g. Europe/Berlin) + * @return void + */ + public final function setDefaultTimezone ($zone) { + // At least 5.1.0 is required for this! + if (version_compare(phpversion(), "5.1.0")) { + @date_default_timezone_set($zone); + } + } + + /** + * Setter for runtime magic quotes + */ + public final function setMagicQuotesRuntime ($enableQuotes) { + // Cast it to boolean + $enableQuotes = (boolean) $enableQuotes; + + // Set it + @set_magic_quotes_runtime($enableQuotes); + } + + /** + * A private include loader + * + * @param $arrayObject The array object with all include files + * @return void + */ + private function loadIncludes (ArrayObject $arrayObject) { + // Load only if there are includes defined + if (!is_null($arrayObject)) { + for ($idx = $arrayObject->getIterator(); $idx->valid(); $idx->next()) { + // Get include file + $inc = $idx->current(); + + // Is the file name really set? + if (!empty($inc)) { + // Base path added? (Uni* / Windows) + if ((substr($inc, 0, 1) != "/") && (substr($inc, 1, 1) != ":")) { + // Generate FQFN + $fqfn = sprintf("%s/inc/extra/%s", PATH, $inc); + } else { + // Base path is already added + $fqfn = $inc; + } + } + + // Include them all here + require($fqfn); + } + } + } + + /** + * Load all includes before main loader and clears the array after usage + * + * @return void + */ + public function loadPreIncludes () { + $this->loadIncludes($this->moreIncPre); + unset($this->moreIncPre); + } + + /** + * Load all includes after main loader and clears the array after usage + * + * @return void + */ + public function loadPostIncludes () { + $this->loadIncludes($this->moreIncPost); + unset($this->moreIncPost); + } + + /** + * Define the database type which must be valid and will not be verified. + * + * @param $type The database type. See path inc/database/. + * @return void + */ + public function defineDatabaseType ($type) { + // Is it defined or not? + if (!defined('_DB_TYPE')) { + // Cast to string + $type = (string) $type; + + // Set the constant + define('_DB_TYPE', $type); + } else { + // Already defined! But we cannot throw an exception here... :( + ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the database type only once in your application!", + __CLASS__ + )); + } + } + + /** + * Define the local file path + * + * @param $path The database type. See path inc/database/. + * @return void + */ + public function definePath ($path) { + // Cast to string + $path = (string) $path; + + // Replace backslashes with slashes + $path = str_replace("\\", "/", $path); + + // Is it defined or not? + if ((!is_dir($path)) || (!is_readable($path))) { + // Is not a valid path + ApplicationEntryPoint::app_die(sprintf("[%s:] Invalid path (not found) specified. Please make sure it is created.", + __CLASS__ + )); + } elseif (!defined('PATH')) { + // Set the constant + define('PATH', $path); + } else { + // Already defined! But we cannot throw an exception here... :( + ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the local file path only once in your application.", + __CLASS__ + )); + } + } + + /** + * Read a configuration element. + * + * @param $cfgEntry The configuration element + * @return $cfgValue The fetched configuration value + * @throws ConfigEntryIsEmptyException If $cfgEntry is empty + * @throws ConfigEntryNotFoundException If a configuration element + * was not found + */ + public function readConfig ($cfgEntry) { + // Cast to string + $cfgEntry = (string) $cfgEntry; + + // Is a valid configuration entry provided? + if (empty($cfgEntry)) { + // Entry is empty + throw new ConfigEntryIsEmptyException(__CLASS__, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY); + } elseif (!isset($this->config[$cfgEntry])) { + // Entry was not found! + throw new ConfigEntryNotFoundException(array(__CLASS__, $cfgEntry), self::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND); + } + + // Debug message + if ((defined('DEBUG_CONFIG')) || (defined('DEBUG_ALL'))) { + echo "[".__METHOD__."] Configuration entry ".$cfgEntry." requested.
\n"; + } + + // Return the requested value + return $this->config[$cfgEntry]; + } + + /** + * Set a configuration entry. + * + * @param $cfgEntry The configuration entry we want to add/change + * @param $cfgValue The configuration value we want to set + * @return void + * @throws ConfigEntryIsEmptyException If $cfgEntry is empty + */ + public final function setConfigEntry ($cfgEntry, $cfgValue) { + // Cast to string + $cfgEntry = (string) $cfgEntry; + $cfgValue = (string) $cfgValue; + + // Is a valid configuration entry provided? + if (empty($cfgEntry)) { + // Entry is empty + throw new ConfigEntryIsEmptyException(__CLASS__, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY); + } + + // Set the configuration value + $this->config[$cfgEntry] = $cfgValue; + + // Resort the array + ksort($this->config); + } + + /** + * Compatiblity method to return this class' name + * + * @return __CLASS__ This class' name + */ + public function __toString () { + return get_class($this); + } +} // END - class + +// [EOF] +?> diff --git a/inc/database.php b/inc/database.php new file mode 100644 index 0000000..b429a39 --- /dev/null +++ b/inc/database.php @@ -0,0 +1,90 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ + +// Initialize the layer +$layer = null; + +// Is the type defined? +if (!defined('_DB_TYPE')) { + // Abort here + ApplicationEntryPoint::app_die("[Main:] Please define a database type first!
+E.g.:
$GLOBALS['cfg']->defineDatabaseType("local");
+This will choose the local-file-based database type (layer)"); +} + +// Generate FQFN for the database layer +$INC = sprintf("%sinc/database/lib-%s%s", PATH, _DB_TYPE, FrameworkConfiguration::getInstance()->readConfig("php_extension")); + +// Load the database layer include +if ((file_exists($INC)) && (is_file($INC)) && (is_readable($INC))) { + // Load the layer + require_once($INC); +} else { + // Layer is missing! + ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer is missing! (%s) -> R.I.P.", + _DB_TYPE + )); +} + +// Clean it up +unset($INC); + +// Prepare database instance +try { + $db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layer); +} catch (NullPointerException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (InvalidDirectoryResourceException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (PathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (PathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (PathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (DirPointerNotOpenedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} + +// Datenbankobjekt debuggen +if (defined('DEBUG_DATABASE_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Die Datenbank-Schicht sieht wie folgt aus:
+
%s
\n", + print_r($db, true) + )); +} + +// [EOF] +?> diff --git a/inc/database/.htaccess b/inc/database/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/database/lib-local.php b/inc/database/lib-local.php new file mode 100644 index 0000000..18d5910 --- /dev/null +++ b/inc/database/lib-local.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ +try { + $layer = LocalFileDatabase::createLocalFileDatabase(PATH . "db/", FileIOHandler::getInstance()); +} catch (SavePathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} catch (SavePathNotFoundException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} catch (SavePathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} catch (SavePathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} catch (SavePathWriteProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} + +// [EOF] +?> diff --git a/inc/file_io.php b/inc/file_io.php new file mode 100644 index 0000000..d63a9a3 --- /dev/null +++ b/inc/file_io.php @@ -0,0 +1,28 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ +$io = FileIOHandler::createFileIOHandler(); + +// [EOF] +?> diff --git a/inc/includes.php b/inc/includes.php new file mode 100644 index 0000000..28a5610 --- /dev/null +++ b/inc/includes.php @@ -0,0 +1,62 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ + +// Load the class loader first +require(sprintf("%sinc/loader/class_ClassLoader%s", + PATH, + FrameworkConfiguration::getInstance()->readConfig("php_extension")) +); + +/** + * Is the devel package included? + */ +if (is_dir(sprintf("%sdevel", PATH))) { + /** + * Load all development includes + */ + ClassLoader::getInstance()->loadClasses("devel"); +} + +/** + * Load additional include files before main load + */ +FrameworkConfiguration::getInstance()->loadPreIncludes(); + +/** + * Load all main include files + * + * +++ MAIN LOADER! +++ + * + */ + +/////////////////////////////////////////////////// +// Maybe we need this place for future releases? // +/////////////////////////////////////////////////// + +/** + * Load additional include files after main load + */ +FrameworkConfiguration::getInstance()->loadPostIncludes(); + +// [EOF] +?> diff --git a/inc/language.php b/inc/language.php new file mode 100644 index 0000000..e9132cf --- /dev/null +++ b/inc/language.php @@ -0,0 +1,49 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ + +// Try it here... +try { + $lang = LanguageSystem::createLanguageSystem(sprintf("%s%s", + PATH, + FrameworkConfiguration::getInstance()->readConfig("lang_base_path") + )); +} catch (LanguagePathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + $e->getMessage() + )); +} catch (InvalidLanguagePathStringException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + $e->getMessage() + )); +} catch (LanguagePathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + $e->getMessage() + )); +} catch (LanguagePathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + $e->getMessage() + )); +} + +// [EOF] +?> diff --git a/inc/language/.htaccess b/inc/language/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/language/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/loader/.htaccess b/inc/loader/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/inc/loader/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php new file mode 100644 index 0000000..38bfcd4 --- /dev/null +++ b/inc/loader/class_ClassLoader.php @@ -0,0 +1,275 @@ + + * @version 1.1 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ClassLoader { + /** + * Configuration array + */ + private $cfg = array(); + + /** + * An ArrayObject for found classes + */ + private $classes = null; + + /** + * Suffix with extension for all class files + */ + private $prefix = "class_"; + + /** + * Suffix with extension for all class files + */ + private $suffix = ".php"; + + /** + * Length of the suffix. Will be overwritten later. + */ + private $sufLen = 0; + + /** + * Length of the prefix. Will be overwritten later. + */ + private $preLen = 0; + + /** + * A list for directory names (no leading/trailing slashes!) which not be scanned by the path scanner + * @see scanLocalPath + */ + private $ignoreList = array(); + + /** + * An ArrayList object for include directories + */ + private $dirList = null; + + /** + * Debug this class loader? (true = yes, false = no) + */ + private $debug = false; + + /** + * Counter for scanned directories (debug output) + */ + private $dirCnt = 0; + + /** + * Counter for loaded classes (debug output) + */ + private $classCnt = 0; + + /** + * Instance of this class + */ + private static $thisInstance = null; + + /** + * The *public* constructor + * + * @param $cfgInstance Configuration class instance + * @return void + */ + public function __construct (FrameworkConfiguration $cfgInstance) { + // Init the array list + $this->dirList = new ArrayObject(); + + // Set suffix and prefix from configuration + $this->suffix = $cfgInstance->readConfig("class_suffix"); + $this->prefix = $cfgInstance->readConfig("class_prefix"); + + // Estimate length of prefix and suffix for substr() function (cache) + $this->sufLen = strlen($this->suffix); + $this->preLen = strlen($this->prefix); + + // Set configuration instance + $this->cfgInstance = $cfgInstance; + + // Initialize the classes list + $this->classes = new ArrayObject(); + + // Set own instance + self::$thisInstance = $this; + } + + /** + * Getter for an instance of this class + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance () { + return self::$thisInstance; + } + + /** + * Scans recursively a local path for class files which must have a prefix and a suffix as given by $this->suffix and $this->prefix + * + * @param $basePath The relative base path to PATH constant for all classes + * @param $ignoreList An optional list (array or string) of directory names which shall be ignored + * @return void + */ + public function loadClasses ($basePath, $ignoreList = array() ) { + // Convert string to array + if (!is_array($ignoreList)) $ignoreList = array($ignoreList); + + // Directories which our class loader ignores by default while + // deep-scanning the directory structure. See scanLocalPath() for + // details. + $ignoreList[] = "."; + $ignoreList[] = ".."; + $ignoreList[] = ".htaccess"; + + // Keep it in class for later usage + $this->ignoreList = $ignoreList; + + // Set base directory which holds all our classes, we should use an + // absolute path here so is_dir(), is_file() and so on will always + // find the correct files and dirs. + $basePath2 = realpath($basePath); + + // If the basePath is false it is invalid + if ($basePath2 === false) { + // TODO: Do not die here. + die("Cannot read {$basePath} !"); + } else { + // Set base path + $basePath = $basePath2; + } + + // Load all super classes (backward, why ever this name... :-? ) + // We don't support sub directories here... + $this->scanLocalPath($basePath); + + // While there are directories in our list scan them for classes + $cnt = 0; + while ($cnt != $this->dirList->count()) { + for ($idx = $this->dirList->getIterator(); $idx->valid(); $idx->next()) { + // Get current path + $currPath = $idx->current(); + + // Remove the current entry or else this will lead into a infinite loop + $this->dirList->offsetSet($idx->key(), ""); + + // Scan the directory + $this->scanLocalPath($currPath); + } + + // Check if we can leave + $cnt = 0; + for ($idx = $this->dirList->getIterator(); $idx->valid(); $idx->next()) { + if ($idx->current() == "") $cnt++; + } + } + } + + /** + * The local path scanner. A found class will be loaded immediately + * @param $localPath The local path which shall be recursively scanned for include files + * @return void + */ + private function scanLocalPath ($localPath) { + // Empty path names will be silently ignored + if (empty($localPath)) return; + + // TODO: No dies here, mayybe this should be rewritten to throw an exception? + $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($localPath); + while ($dirClass = $dirInstance->readDirectoryExcept($this->ignoreList)) { + // We need the relative dir name as an array index some lines below + $dirClass2 = $dirClass; + + // A nice replacement for a simple dot ;) + $dirClass = sprintf("%s/%s", $localPath, $dirClass); + + // Is a readable file with configured prefix and suffix? All other + // files will silently be ignored! + //* DEBUG: */ print "Prefix=".$this->prefix."(".substr($dirClass2, 0 , $this->preLen).")\n"; + //* DEBUG: */ print "Suffix=".$this->suffix."(".substr($dirClass2, -$this->sufLen, $this->sufLen).")\n"; + //* DEBUG: */ print "ENTRY={$dirClass}\n"; + if ( + (is_file($dirClass)) + && (is_readable($dirClass)) + && (substr($dirClass2, 0 , $this->preLen) == $this->prefix) + && (substr($dirClass2, -$this->sufLen, $this->sufLen) == $this->suffix) + ) { + // Class found so load it instantly + //* DEBUG: */ print "CLASS={$dirClass}\n"; + $this->classes->append($dirClass); + $this->classCnt++; + } elseif (is_dir($dirClass) && !in_array($dirClass2, $this->ignoreList)) { + // Directory found and added to list + //* DEBUG: */ print "DIR={$dirClass}\n"; + if ($dirClass2 == "interfaces") { + $this->scanLocalPath($dirClass); + } else { + $this->dirList->append($dirClass); + } + $this->dirCnt++; + } + //* DEBUG: */ print "LOOP!\n"; + } // END - while + + // Close directory handler + $dirInstance->closeDirectory(); + + // Output counter in debug mode + if (defined('DEBUG_MODE')) print(sprintf("[%s:] %d Klassendateien in %d Verzeichnissen gefunden und geladen.
\n", + __CLASS__, + $this->classCnt, + $this->dirCnt + )); + } + + /** + * Includes all found classes + * @return void + */ + public function includeAllClasses () { + if (is_object($this->classes)) { + // Load all classes + for ($idx = $this->classes->getIterator(); $idx->valid(); $idx->next()) { + // Load current class + //* DEBUG: */ print "Class=".$idx->current()."\n"; + require_once($idx->current()); + } + + // Re-initialize the classes list + $this->classes = new ArrayObject(); + } + } +} + +// Initial load of core classes and the FrameworkDirectoryPointer class +require_once(sprintf("%sinc/classes/interfaces/class_FrameworkInterface%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); +require_once(sprintf("%sinc/classes/main/class_BaseFrameworkSystem%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); +require_once(sprintf("%sinc/classes/main/io/class_FrameworkDirectoryPointer%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); + +// Initialize the class loader +$loader = new ClassLoader(FrameworkConfiguration::getInstance()); + +// [EOF] +?> diff --git a/inc/output.php b/inc/output.php new file mode 100644 index 0000000..f2dfcbe --- /dev/null +++ b/inc/output.php @@ -0,0 +1,31 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ + +// Prepare debug outout middleware +$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig("debug_engine")); + +// Leere Strings werden ignoriert und sollten zum Testen der Middleware genommen werden +DebugMiddleware::getInstance()->output(""); + +// [EOF] +?> diff --git a/inc/selector.php b/inc/selector.php new file mode 100644 index 0000000..62f0e68 --- /dev/null +++ b/inc/selector.php @@ -0,0 +1,91 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 . + */ + +// Does the user has an application specified? +if (!empty($_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")])) { + // Set the application from string + $application = (string) $_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")]; +} elseif (!empty($_SERVER['argv'][1])) { + // Set the application from string + $application = (string) $_SERVER['argv'][1]; + $app = explode("=", trim($application)); + if ($app[0] == FrameworkConfiguration::getInstance()->readConfig("app_selector_get")) { + // Application is valid! + $application = trim($app[1]); + } else { + // Invalid entry found, first must be "app"! + $application = FrameworkConfiguration::getInstance()->readConfig("default_application"); + } +} else { + // Set the "application selector" application + $application = FrameworkConfiguration::getInstance()->readConfig("default_application"); +} + +// Secure it, by keeping out tags +$application = htmlentities(strip_tags($application), ENT_QUOTES); + +// Secure it a little more with a reg.exp. +$application = preg_replace('/([^a-z_-])+/i', "", $application); + +// Try to load these includes in the given order +$configAppIncludes = array( + sprintf("class_%s", FrameworkConfiguration::getInstance()->readConfig("app_helper_class")), // The ApplicationHelper class + "config", // The application's own configuration + "init", // The application initializer + "loader", // The application's class loader + "debug", // Some debugging stuff + "exceptions", // The application's own exception handler + "starter", // The application starter (calls entryPoint(), etc.) +); + +// Load them all (try only) +foreach ($configAppIncludes as $inc) { + // Skip starter in test mode + if (($inc == "starter") && (defined('TEST'))) { + // Skip it here + continue; + } + + // Generate a FQFN for the helper class + $fqfn = sprintf("%s%s/%s/%s%s", + PATH, + FrameworkConfiguration::getInstance()->readConfig("application_path"), + $application, + $inc, + FrameworkConfiguration::getInstance()->readConfig("php_extension") + ); + + // Does the include file exists? + if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) { + // Load it + require_once($fqfn); + } elseif (FrameworkConfiguration::getInstance()->readConfig("verbose_level") > 0) { + // File is missing + trigger_error(sprintf("Cannot load application script %s! File is missing or read-protected.", + $inc . FrameworkConfiguration::getInstance()->readConfig("php_extension") + )); + } +} + +// [EOF] +?> diff --git a/index.php b/index.php new file mode 100644 index 0000000..3a96063 --- /dev/null +++ b/index.php @@ -0,0 +1,149 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * 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 ApplicationEntryPoint { + /** + * The instances we want to remove after all is done + * + * @return void + */ + private static $instances = array ( + 'cfg', // The configuration system + 'loader', // The class loader system + 'debug', // Debug output + 'db', // Database layer + 'io', // Base I/O system (local file [or network]) + 'engine', // Template engine ( for ApplicationEntryPoint::app_die() ) + 'lang', // Language sub-system + 'app', // The ApplicationHelper instance + ); + + /** + * The application's emergency exit + * + * @param $message The optional message we shall output on exit + * @return void + */ + public static function app_die ($message = "") { + // Is a message set? + if (empty($message)) { + // No message provided + $message = "No message provided!"; + } + + // Get some instances + $tpl = FrameworkConfiguration::getInstance()->readConfig("tpl_engine"); + $lang = LanguageSystem::getInstance(); + $io = FileIOHandler::getInstance(); + + // Is the template engine loaded? + if ((class_exists($tpl)) && (is_object($lang)) && (is_object($io))) { + // Use the template engine for putting out (nicer look) the message + try { + $eval = sprintf("\$tplEngine = %s::create%s(\"%s%s\", LanguageSystem::getInstance(), FileIOHandler::getInstance());", + FrameworkConfiguration::getInstance()->readConfig("tpl_engine"), + FrameworkConfiguration::getInstance()->readConfig("tpl_engine"), + PATH, + FrameworkConfiguration::getInstance()->readConfig("tpl_base_path") + ); + eval($eval); + } catch (BasePathIsEmptyException $e) { + die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", + $e->getMessage() + )); + } catch (InvalidBasePathStringException $e) { + die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", + $e->getMessage() + )); + } catch (BasePathIsNoDirectoryException $e) { + die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", + $e->getMessage() + )); + } catch (BasePathReadProtectedException $e) { + die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", + $e->getMessage() + )); + } + + // Assign message + $tplEngine->assignVariable("message", $message); + + // Load the template + $tplEngine->loadCodeTemplate("emergency_exit"); + + // Compile the template + $tplEngine->compileTemplate(); + + // Compile all variables + $tplEngine->compileVariables(); + + // Output all + $tplEngine->output(); + + // Good bye... + exit(); + } else { + // Output message and die + die(sprintf("[Main:] Emergency exit reached: %s", + $message + )); + } + } + + /** + * The application's main entry point. This class isolates some local + * variables which shall not become visible to outside because of security + * concerns. We are doing this here to "emulate" the well-known entry + * point in Java(tm). + * + * @return void + */ + public static function main () { + // Some non-global common arrays we need... + global $_SERVER; + + // Load config file + require(dirname(__FILE__) . "/inc/config.php"); + + // Load all include files + require(PATH . "inc/includes.php"); + + // Load all framework classes + require(PATH . "inc/classes.php"); + + // Include the application selector + require(PATH . "inc/selector.php"); + + } // END - main() + +} // END - class + +// Do not remove the following line: +ApplicationEntryPoint::main(); + +// [EOF] +?> diff --git a/rebuild_doc.sh b/rebuild_doc.sh new file mode 100755 index 0000000..697ed08 --- /dev/null +++ b/rebuild_doc.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +echo "$0: Cleaning up..." +find docs/html/ -type f -exec rm -f {} \; +rm -f docs/*.log +echo "$0: Done." + +doxygen Doxyfile diff --git a/ship-simu/Doxyfile b/ship-simu/Doxyfile deleted file mode 100644 index 0312e4b..0000000 --- a/ship-simu/Doxyfile +++ /dev/null @@ -1,1321 +0,0 @@ -# Doxyfile 1.5.4 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file that -# follow. The default is UTF-8 which is also the encoding used for all text before -# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into -# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of -# possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = Ship-Simulator - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 0.1a - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = /var/www/htdocs/ship-simu/docs/ - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, -# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, -# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, -# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class " \ - "The $name widget " \ - "The $name file " \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = YES - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = /var/www/htdocs/ - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = YES - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = YES - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is -# documented as struct with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code where the coding convention is that all structs are -# typedef'ed and only the typedef is referenced never the struct's name. - -TYPEDEF_HIDES_STRUCT = NO - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = YES - -# If this flag is set to YES, the members of anonymous namespaces will be extracted -# and appear in the documentation as a namespace called 'anonymous_namespace{file}', -# where file will be replaced with the base name of the file that contains the anonymous -# namespace. By default anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = YES - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text " - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = /var/www/htdocs/ship-simu/docs/warn.log - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = /var/www/htdocs/ship-simu/ - -# This tag can be used to specify the character encoding of the source files that -# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default -# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. -# See http://www.gnu.org/software/libiconv for the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.php - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = */docs/* \ - */ship-simu.org/* - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the output. -# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, -# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH -# then you must also enable this option. If you don't then doxygen will produce -# a warning and turn it on anyway - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 3 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = YES - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = YES - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to -# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to -# specify the directory where the mscgen tool resides. If left empty the tool is assumed to -# be found in the default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = NO - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = YES - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = YES - -# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. - -CALLER_GRAPH = YES - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the number -# of direct children of the root node in a graph is already larger than -# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = YES diff --git a/ship-simu/application/.htaccess b/ship-simu/application/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/selector/.htaccess b/ship-simu/application/selector/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/selector/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/selector/class_ApplicationHelper.php b/ship-simu/application/selector/class_ApplicationHelper.php deleted file mode 100644 index 19b45b7..0000000 --- a/ship-simu/application/selector/class_ApplicationHelper.php +++ /dev/null @@ -1,169 +0,0 @@ - - * @version 0.1 - */ -class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplication { - /** - * The version number of this application - */ - private $appVersion = ""; - - /** - * The human-readable name for this application - */ - private $appName = ""; - - /** - * The short uni*-like name of this application - */ - private $shortName = ""; - - /** - * An instance of this class - */ - private static $thisInstance = null; - - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Application-Helper"); - - // Create an unique ID - $this->createUniqueID(); - - // Tidy up a little - $this->removeSystemArray(); - } - - /** - * Getter for an instance of this class - * - * @return $thisInstance An instance of this class - */ - public final static function getInstance () { - // Is the instance there? - if (is_null(self::$thisInstance)) { - self::$thisInstance = new ApplicationHelper(); - } - - // Return the instance - return self::$thisInstance; - } - - /** - * Getter for the version number - * - * @return $appVersion The application's version number - */ - public final function getAppVersion () { - return $this->appVersion; - } - - /** - * Setter for the version number - * - * @param $appVersion The application's version number - * @return void - */ - public final function setAppVersion ($appVersion) { - // Cast and set it - $appVersion = (string) $appVersion; - $this->appVersion = $appVersion; - } - - /** - * Getter for human-readable name - * - * @return $appName The application's human-readable name - */ - public final function getAppName () { - return $this->appName; - } - - /** - * Setter for human-readable name - * - * @param $appName The application's human-readable name - * @return void - */ - public final function setAppName ($appName) { - // Cast and set it - $appName = (string) $appName; - $this->appName = $appName; - } - - /** - * Getter for short uni*-like name - * - * @return $shortName The application's short uni*-like name - */ - public final function getAppShortName () { - return $this->shortName; - } - - /** - * Setter for short uni*-like name - * - * @param $shortName The application's short uni*-like name - * @return void - */ - public final function setAppShortName ($shortName) { - // Cast and set it - $shortName = (string) $shortName; - $this->shortName = $shortName; - } - - /** - * Launcher for the application selector - * - * @return void - * @see ApplicationSelector - */ - public final function entryPoint () { - // Get a prepared instance of ApplicationSelector - $selInstance = ApplicationSelector::createApplicationSelector(LanguageSystem::getInstance(), FileIOHandler::getInstance()); - - // Remove the ignore list from the object - $selInstance->removeDirIgnoreList(); - - // Next load all templates for the respective short app names - $selInstance->loadApplicationTemplates(); - - // Then load the selector's own template - $selInstance->loadSelectorTemplate(); - - // Insert all application templates - $selInstance->insertApplicationTemplates(); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/selector/class_ApplicationSelector.php b/ship-simu/application/selector/class_ApplicationSelector.php deleted file mode 100644 index bd3a86b..0000000 --- a/ship-simu/application/selector/class_ApplicationSelector.php +++ /dev/null @@ -1,460 +0,0 @@ - - * @version 0.1 - */ -class ApplicationSelector extends BaseFrameworkSystem { - /** - * An ArrayObject for all found applications - */ - private $foundApps = null; - - /** - * An array object for all loaded application templates (selector_app-name.tpl) - */ - private $loadedTemplates = null; - - /** - * The application selector's own template engine handler - */ - private $selectorTplEngine = null; - - /** - * A list of items we shall ignore while reading from directories - */ - private $dirIgnoreList = array( - ".", - "..", - ".htaccess" - ); - - /** - * The language instance for the template loader - */ - private $langInstance = null; - - /** - * The file I/O instance for the template loader - */ - private $fileIOInstance = null; - - /** - * The private constructor. No direct instances can be created from this. - * - * @return void - */ - private function __construct() { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Applikationswechsler"); - - // Create unique ID number - $this->createUniqueID(); - - // Remove system array and thousand seperator - $this->removeSystemArray(); - $this->removeNumberFormaters(); - - // Initialize the array lists - $this->initializeAppsList(); - $this->initializeTemplatesList(); - } - - /** - * Create a prepared instance of ApplicationSelector - * - * @param $langInstance The language sub-system: LanguageSystem - * @param $fileIOInstance The file I/O instance - * @return $selInstance An instance of ApplicationSelector - */ - public static function createApplicationSelector (ManageableLanguage $langInstance, FileIOHandler $fileIOInstance) { - // Get a new instance - $selInstance = new ApplicationSelector(); - - // Get all applications - $selInstance->readApplicationDirectory(); - - // Set language and file I/O instances - $selInstance->setLanguageInstance($langInstance); - $selInstance->setFileIOInstance($fileIOInstance); - - // Return the prepared instance - return $selInstance; - } - - /** - * Initialize the application list - * - * @return void - */ - private function initializeAppsList () { - $this->foundApps = new FrameworkArrayObject(); - } - - /** - * Initialize the loaded templates list - * - * @return void - */ - private function initializeTemplatesList () { - $this->loadedTemplates = new FrameworkArrayObject(); - } - - /** - * Private getter for language instance - * - * @return $langInstance An instance to the language sub-system - */ - private function getLanguageInstance () { - return $this->langInstance; - } - - /** - * Private getter for file IO instance - * - * @return $fileIOInstance An instance to the file I/O sub-system - */ - private function getFileIOInstance () { - return $this->fileIOInstance; - } - - /** - * Prepare the template engine (TemplateEngine by default) for a give - * application helper instance (ApplicationHelper by default). - * - * @param $appInstance An application helper instance - * @return $tplEngine The template engine instance - * @throws NullPointerException If the template engine could not - * be initialized - * @throws NoObjectException If $tplEngine is not an object - * @throws MissingMethodException If $tplEngine misses a required - * method 'loadWebTemplate()' - */ - private function prepareTemplateEngine (BaseFrameworkSystem $appInstance) { - // Generate FQFN for all application templates - $fqfn = sprintf("%s%s/%s/%s", - PATH, - $this->getConfigInstance()->readConfig("application_path"), - strtolower($appInstance->getAppShortName()), - $this->getConfigInstance()->readConfig("tpl_base_path") - ); - - // Initialize the template engine - $tplEngine = null; - $eval = sprintf("\$tplEngine = %s::create%s( - \"%s\", - \$this->getLanguageInstance(), - \$this->getFileIOInstance() -);", - $this->getConfigInstance()->readConfig("tpl_engine"), - $this->getConfigInstance()->readConfig("tpl_engine"), - $fqfn - ); - - // Debug message - if ((!is_null($this->getDebugInstance())) && (defined('DEBUG_EVAL'))) { - $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", - $this->__toString(), - htmlentities($eval) - )); - } - - // Run the command - @eval($eval); - - // Is it a valid instance? - if (is_null($tplEngine)) { - // No class returned - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($tplEngine)) { - // Not an object! ;-( - throw new NoObjectException($tplEngine, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($tplEngine, 'loadWebTemplate')) { - // Nope, so throw exception - throw new MissingMethodException(array($tplEngine, 'loadWebTemplate'), self::EXCEPTION_MISSING_METHOD); - } - - // Return the prepared instance - return $tplEngine; - } - - /** - * Load the init.php script of an application and append the application - * instance to $foundApps - * - * @param $initScript The FQFN of init.php - * @param $appName The application's Uni* name - * @return void - * @throws AppVarIsNotSetException If 'app' is not set - * @throws NullPointerException If 'app' is null - * @throws NoObjectException If 'app' is not an object - * @throws MissingMethodException If a required method is missing - */ - private function loadInitScript ($initScript, $appName) { - // Is it a file and readable? - if ((is_file($initScript)) && (is_readable($initScript))) { - // Then include it - include ($initScript); - - // We now should have $app re-defined! - if (!isset($app)) { - // This application shall not be loaded - return; - } elseif (is_null($app)) { - // The class instance is null - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($app)) { - // Not an object - throw new NoObjectException($app, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($app, $this->getConfigInstance()->readConfig("entry_method"))) { - // Method not found! - throw new MissingMethodException(array($app, $this->getConfigInstance()->readConfig("entry_method")), self::EXCEPTION_MISSING_METHOD); - } - - // Add the current instance to the list - $this->foundApps->append($app); - - } // END - if ((is_file(... - } - - /** - * Setter for the selector's template engine instance - * - * @param $tplEngine An instance of TemplateEngine - */ - private function setSelectorTemplateEngine (CompileableTemplate $tplEngine) { - $this->selectorTplEngine = $tplEngine; - } - - /** - * Getter for the selector's template engine instance - * - * @return $selectTplEngine The selector's template engine - */ - private function getSelectorTemplateEngine () { - return $this->selectorTplEngine; - } - - /** - * Getter for the $loadedTemplates array object - * - * @return $loadedTemplates An array object holding all loaded - * application templates - */ - private function getLoadedTemplates () { - return $this->loadedTemplates; - } - - /** - * Method for compatiblity with prepareTemplateEngine() - * - * @return $shortName This selector's short name - */ - private function getAppShortName() { - $shortName = $this->getConfigInstance()->readConfig("selector_path"); - return $shortName; - } - - /** - * Add a directory/file to the ignore list - * - * @param $ignoreItem The file/directory we shall ignore - * @return void - */ - public function addDirIgnoreList ($ignoreItem) { - // Cast and add it - $ignoreItem = (string) $ignoreItem; - $this->dirIgnoreList[] = $ignoreItem; - } - - /** - * Setter for language instance - * - * @param $langInstance An instance to the language sub-system - * @return void - * @see LanguageSystem - */ - public function setLanguageInstance (ManageableLanguage $langInstance) { - $this->langInstance = $langInstance; - } - - /** - * Setter for file I/O instance - * - * @param $fileIOInstance An instance to the file I/O sub-system - * @return void - */ - public function setFileIOInstance (FileIOHandler $fileIOInstance) { - $this->fileIOInstance = $fileIOInstance; - } - - /** - * Read the base path for all applications (application/) and create a - * list of all found applications - * - * @return void - */ - public function readApplicationDirectory () { - // Generate the base path for all applications - $appBasePath = sprintf("%s%s/", - PATH, - $this->getConfigInstance()->readConfig("application_path") - ); - - // Add the selector path to the ignore list - $this->addDirIgnoreList($this->getConfigInstance()->readConfig("selector_path")); - - // Get a directory pointer for the application path - $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($appBasePath); - - // Backup and remove the 'app' from global name space - /*$appBackup = $app; - unset($app);*/ - - // Read all directories&files except some parts - while ($appName = $dirInstance->readDirectoryExcept($this->dirIgnoreList)) { - // Generate FQFN for the application name (or better directory name) - $fqfn = sprintf("%s%s", $appBasePath, $appName); - - // Is this a readable directory? (files will be ignored silently) - if ((is_dir($fqfn)) && (is_readable($fqfn))) { - // Then get the init.php script for analyzing - $initScript = sprintf("%s/init%s", $fqfn, $this->getConfigInstance()->readConfig("php_extension")); - - // Load the application's init.php script and append the - // application to the ArrayObject - $this->loadInitScript($initScript, $appName); - - } // END - if ((is_dir(... - - } // END - while - - // Close directory pointer - $dirInstance->closeDirectory(); - - // Restore old 'app' from backup - //$app = $appBackup; - } - - /** - * Load all templates for found applications in previous scan - * - * @return void - */ - public function loadApplicationTemplates () { - // Iterate through all applications - for ($idx = $this->foundApps->getIterator(); $idx->valid(); $idx->next()) { - // Get current application - $appInstance = $idx->current(); - - // Prepare the template engine for the current template - $tplEngine = $this->prepareTemplateEngine($appInstance); - - // Try to load the web template - $tplEngine->loadWebTemplate(sprintf("%s_%s", - $this->getConfigInstance()->readConfig("tpl_selector_prefix"), - strtolower($appInstance->getAppShortName()) - )); - - // Remember this template and the application for later usage - $this->loadedTemplates->append(array( - 'tpl_engine' => $tplEngine, - 'app_instance' => $appInstance - )); - } - - // Re-initialize the application list to avoid double loading - $this->initializeAppsList(); - } - - /** - * Removes $dirIgnoreList from the object to save some memory - * - * @return void - */ - public function removeDirIgnoreList () { - unset($this->dirIgnoreList); - } - - /** - * Loads the selector's own main template. This step is not linking the - * application's templates into the main one. - * - * @return void - */ - public function loadSelectorTemplate () { - // Prepare the template engine - $tplEngine = $this->prepareTemplateEngine($this); - - // Load the selector's template - $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig("selector_main_tpl")); - - // Now store it in the class - $this->setSelectorTemplateEngine($tplEngine); - } - - /** - * Inserts all loaded application templates into the selector's template - * - * @return void - * @throws NullPointerException If $curr is null - * @throws NoArrayException If $curr is not an array - * @throws InvalidArrayCountException If $curr contains an - * unexpected count of elements - * @throws MissingArrayElementsException If $curr is missing expected - * array elements - */ - public function insertApplicationTemplates () { - // First prepare the instance - $tplEngine = $this->prepareTemplateEngine($this); - - // Load template which shall later hold all application templates - $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig("selector_apps_tpl")); - - // Add all loaded application templates together - $dummy = ""; - for ($idx = $this->getLoadedTemplates()->getIterator(); $idx->valid(); $idx->next()) { - // Get current item from array object - $curr = $idx->current(); - - // Do some sanity checks on the loaded item - if (is_null($curr)) { - // $curr is null - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_array($curr)) { - // Not an array - throw new NoArrayException($curr, self::EXCEPTION_IS_NO_ARRAY); - } elseif (count($curr) != 2) { - // Not expected count of entries - throw new InvalidArrayCountException(array($this, "curr", count($curr), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } elseif (!isset($curr['tpl_engine']) || (!isset($curr['app_instance']))) { - // Expected entries missing - throw new MissingArrayElementsException(array($this, "curr", array('tpl_engine', 'app_instance')), self::EXCEPTION_ARRAY_ELEMENTS_MISSING); - } - die("
".print_r($curr, true)."
"); - - } // END - for - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/selector/debug.php b/ship-simu/application/selector/debug.php deleted file mode 100644 index 2322bb5..0000000 --- a/ship-simu/application/selector/debug.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/ship-simu/application/selector/exceptions.php b/ship-simu/application/selector/exceptions.php deleted file mode 100644 index c0d5422..0000000 --- a/ship-simu/application/selector/exceptions.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/ship-simu/application/selector/init.php b/ship-simu/application/selector/init.php deleted file mode 100644 index a1255a9..0000000 --- a/ship-simu/application/selector/init.php +++ /dev/null @@ -1,28 +0,0 @@ -readConfig("app_helper_class") -); -eval($eval); - -// Set application name and version -$app->setAppName("Applikationsauswähler"); -$app->setAppVersion("0.1a"); -$app->setAppShortName(FrameworkConfiguration::getInstance()->readConfig("selector_name")); - -// Initialize output system -require(PATH . "inc/output.php"); - -// Initialize file i/o system -require(PATH . "inc/file_io.php"); - -// Include the language sub-system -require(PATH . "inc/language.php"); - -// [EOF] -?> diff --git a/ship-simu/application/selector/loader.php b/ship-simu/application/selector/loader.php deleted file mode 100644 index 46f5bf8..0000000 --- a/ship-simu/application/selector/loader.php +++ /dev/null @@ -1,19 +0,0 @@ -application nicht gefunden!"); -} - -// Load all classes -ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application)); - -// Include all classes -ClassLoader::getInstance()->includeAllClasses(); - -// Clean up the global namespace -unset($lowerClasses); -unset($class); - -// [EOF] -?> diff --git a/ship-simu/application/selector/starter.php b/ship-simu/application/selector/starter.php deleted file mode 100644 index 1e6e523..0000000 --- a/ship-simu/application/selector/starter.php +++ /dev/null @@ -1,42 +0,0 @@ -%s kann nicht gestartet werden, da die Hilfsklasse %s nicht geladen ist!", - $application, - FrameworkConfiguration::getInstance()->readConfig("app_helper_class") - )); -} elseif (!is_object($app)) { - // No object! - ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die 'app' kein Objekt ist!", - $application - )); -} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) { - // Method not found! - ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die Methode %s fehlt!", - $application, - FrameworkConfiguration::getInstance()->readConfig("entry_method") - )); -} - -// Call the entry point method -try { - $eval = sprintf("%s::getInstance()->%s();", - FrameworkConfiguration::getInstance()->readConfig("app_helper_class"), - FrameworkConfiguration::getInstance()->readConfig("entry_method") - ); - eval($eval); -} catch (FrameworkException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden. Grund: %s", - $application, - $e->getMessage() - )); -} - - -// [EOF] -?> diff --git a/ship-simu/application/selector/templates/.htaccess b/ship-simu/application/selector/templates/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/selector/templates/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/selector/templates/de/.htaccess b/ship-simu/application/selector/templates/de/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/selector/templates/de/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/selector/templates/de/code/.htaccess b/ship-simu/application/selector/templates/de/code/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/selector/templates/de/code/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/selector/templates/de/code/selector_apps.ctp b/ship-simu/application/selector/templates/de/code/selector_apps.ctp deleted file mode 100644 index 00d37a1..0000000 --- a/ship-simu/application/selector/templates/de/code/selector_apps.ctp +++ /dev/null @@ -1,2 +0,0 @@ - -$content[apps_list] diff --git a/ship-simu/application/selector/templates/de/code/selector_main.ctp b/ship-simu/application/selector/templates/de/code/selector_main.ctp deleted file mode 100644 index 6e10877..0000000 --- a/ship-simu/application/selector/templates/de/code/selector_main.ctp +++ /dev/null @@ -1,15 +0,0 @@ - - -{?header:title={--WELCOME_APPLICATION_SELECTOR--}?} - -{?navigation:nav_row=home;imprint;contact?} - -
- {--HEADER_APPLICATION_SELECTOR--} -
- -
- {?selector_apps?} -
- -{?footer_msg:footer_msg={--FOOTER_APPLICATION_SELECTOR--}?} diff --git a/ship-simu/application/ship-simu/.htaccess b/ship-simu/application/ship-simu/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/class_ApplicationHelper.php b/ship-simu/application/ship-simu/class_ApplicationHelper.php deleted file mode 100644 index a177d34..0000000 --- a/ship-simu/application/ship-simu/class_ApplicationHelper.php +++ /dev/null @@ -1,156 +0,0 @@ - - * @version 0.1 - */ -class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplication { - /** - * The version number of this application - */ - private $appVersion = ""; - - /** - * The human-readable name for this application - */ - private $appName = ""; - - /** - * The short uni*-like name for this application - */ - private $shortName = ""; - - /** - * An instance of this class - */ - private static $thisInstance = null; - - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Application-Helper"); - - // Create an unique ID - $this->createUniqueID(); - - // Tidy up a little - $this->removeSystemArray(); - } - - /** - * Getter for an instance of this class - * - * @return $thisInstance An instance of this class - */ - public final static function getInstance () { - // Is the instance there? - if (is_null(self::$thisInstance)) { - self::$thisInstance = new ApplicationHelper(); - } - - // Return the instance - return self::$thisInstance; - } - - /** - * Getter for the version number - * - * @return $appVersion The application's version number - */ - public final function getAppVersion () { - return $this->appVersion; - } - - /** - * Setter for the version number - * - * @param $appVersion The application's version number - * @return void - */ - public final function setAppVersion ($appVersion) { - // Cast and set it - $appVersion = (string) $appVersion; - $this->appVersion = $appVersion; - } - - /** - * Getter for human-readable name - * - * @return $appName The application's human-readable name - */ - public final function getAppName () { - return $this->appName; - } - - /** - * Setter for human-readable name - * - * @param $appName The application's human-readable name - * @return void - */ - public final function setAppName ($appName) { - // Cast and set it - $appName = (string) $appName; - $this->appName = $appName; - } - - /** - * Getter for short uni*-like name - * - * @return $shortName The application's short uni*-like name - */ - public final function getAppShortName () { - return $this->shortName; - } - - /** - * Setter for short uni*-like name - * - * @param $shortName The application's short uni*-like name - * @return void - */ - public final function setAppShortName ($shortName) { - // Cast and set it - $shortName = (string) $shortName; - $this->shortName = $shortName; - } - - /** - * Launches the ship-simulator game - * - * @return void - */ - public final function entryPoint () { - // Must still be implemented! - trigger_error(__METHOD__.": Not implemented yet!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/debug.php b/ship-simu/application/ship-simu/debug.php deleted file mode 100644 index 5c6e9c8..0000000 --- a/ship-simu/application/ship-simu/debug.php +++ /dev/null @@ -1,40 +0,0 @@ - diff --git a/ship-simu/application/ship-simu/exceptions.php b/ship-simu/application/ship-simu/exceptions.php deleted file mode 100644 index df23634..0000000 --- a/ship-simu/application/ship-simu/exceptions.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/ship-simu/application/ship-simu/exceptions/.htaccess b/ship-simu/application/ship-simu/exceptions/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/exceptions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/exceptions/class_BirthdayInvalidException.php b/ship-simu/application/ship-simu/exceptions/class_BirthdayInvalidException.php deleted file mode 100644 index 032d5e4..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_BirthdayInvalidException.php +++ /dev/null @@ -1,25 +0,0 @@ -%s
ist leider falsch.", - date("d.m.Y", mktime( - 0, 0, 0, - $birthArray[1], - $birthArray[2], - $birthArray[0] - )) - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_CabinShipMismatchException.php b/ship-simu/application/ship-simu/exceptions/class_CabinShipMismatchException.php deleted file mode 100644 index 25890a9..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_CabinShipMismatchException.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/ship-simu/application/ship-simu/exceptions/class_ContractAllreadySignedException.php b/ship-simu/application/ship-simu/exceptions/class_ContractAllreadySignedException.php deleted file mode 100644 index 03b4f6e..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_ContractAllreadySignedException.php +++ /dev/null @@ -1,22 +0,0 @@ -%s
und %s haben den Vertrag bereits unterzeichnet!", - $classArray[0]->__toString(), - $classArray[1]->getCompanyName(), - $classArray[2]->getCompanyName() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_ContractPartnerMismatchException.php b/ship-simu/application/ship-simu/exceptions/class_ContractPartnerMismatchException.php deleted file mode 100644 index 2195fbb..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_ContractPartnerMismatchException.php +++ /dev/null @@ -1,22 +0,0 @@ -%s ist ungütig (%s) und darf diesen Vertrag nicht unterzeichnen!", - $classArray[0]->__toString(), - $classArray[1]->getCompanyName(), - $classArray[2]->getCompanyName() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_DeckShipMismatchException.php b/ship-simu/application/ship-simu/exceptions/class_DeckShipMismatchException.php deleted file mode 100644 index f4967aa..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_DeckShipMismatchException.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/ship-simu/application/ship-simu/exceptions/class_EmptyStructuresListException.php b/ship-simu/application/ship-simu/exceptions/class_EmptyStructuresListException.php deleted file mode 100644 index d84efb7..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_EmptyStructuresListException.php +++ /dev/null @@ -1,17 +0,0 @@ -__toString() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_InvalidContractPartnerException.php b/ship-simu/application/ship-simu/exceptions/class_InvalidContractPartnerException.php deleted file mode 100644 index 0b1c304..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_InvalidContractPartnerException.php +++ /dev/null @@ -1,18 +0,0 @@ -%s ist kein gütiger Vertragspartner.", - $class->__toString(), - $class->getPartDescr() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_InvalidIDFormatException.php b/ship-simu/application/ship-simu/exceptions/class_InvalidIDFormatException.php deleted file mode 100644 index 3ce2e0d..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_InvalidIDFormatException.php +++ /dev/null @@ -1,17 +0,0 @@ -__toString() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_ItemNotInPriceListException.php b/ship-simu/application/ship-simu/exceptions/class_ItemNotInPriceListException.php deleted file mode 100644 index 500ba92..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_ItemNotInPriceListException.php +++ /dev/null @@ -1,18 +0,0 @@ -%s %s nicht gefunden.", - $class->__toString(), - $class->getPartDescr() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_ItemNotTradeableException.php b/ship-simu/application/ship-simu/exceptions/class_ItemNotTradeableException.php deleted file mode 100644 index a83485f..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_ItemNotTradeableException.php +++ /dev/null @@ -1,18 +0,0 @@ -%s ist nicht handelbar!", - $classArray[0]->__toString(), - $classArray[1]->getPartDescr() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_MissingSimulatorIDException.php b/ship-simu/application/ship-simu/exceptions/class_MissingSimulatorIDException.php deleted file mode 100644 index d656dde..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_MissingSimulatorIDException.php +++ /dev/null @@ -1,18 +0,0 @@ -%s scheint ungültig zu sein.", - $classArray[0]->__toString(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_MotorShipMismatchException.php b/ship-simu/application/ship-simu/exceptions/class_MotorShipMismatchException.php deleted file mode 100644 index ce48791..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_MotorShipMismatchException.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/ship-simu/application/ship-simu/exceptions/class_NoShipyardsConstructedException.php b/ship-simu/application/ship-simu/exceptions/class_NoShipyardsConstructedException.php deleted file mode 100644 index 32e1339..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_NoShipyardsConstructedException.php +++ /dev/null @@ -1,22 +0,0 @@ -__toString() - ); - } else { - // No class given - $message = sprintf("Please provide a class for %s", __CLASS__); - } - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_PersonellListAlreadyCreatedException.php b/ship-simu/application/ship-simu/exceptions/class_PersonellListAlreadyCreatedException.php deleted file mode 100644 index 3ac9078..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_PersonellListAlreadyCreatedException.php +++ /dev/null @@ -1,17 +0,0 @@ -__toString() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_RoomShipMismatchException.php b/ship-simu/application/ship-simu/exceptions/class_RoomShipMismatchException.php deleted file mode 100644 index 19d5eed..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_RoomShipMismatchException.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/ship-simu/application/ship-simu/exceptions/class_ShipNotConstructedException.php b/ship-simu/application/ship-simu/exceptions/class_ShipNotConstructedException.php deleted file mode 100644 index 07b9bb9..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_ShipNotConstructedException.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/ship-simu/application/ship-simu/exceptions/class_ShipPartNotConstructableException.php b/ship-simu/application/ship-simu/exceptions/class_ShipPartNotConstructableException.php deleted file mode 100644 index 338386e..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_ShipPartNotConstructableException.php +++ /dev/null @@ -1,17 +0,0 @@ -%s ist nicht constrierbar!", - $partArray[0] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_StructureShipMismatchException.php b/ship-simu/application/ship-simu/exceptions/class_StructureShipMismatchException.php deleted file mode 100644 index 273c405..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_StructureShipMismatchException.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/ship-simu/application/ship-simu/exceptions/class_StructuresOutOfBoundsException.php b/ship-simu/application/ship-simu/exceptions/class_StructuresOutOfBoundsException.php deleted file mode 100644 index 8b5d4cd..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_StructuresOutOfBoundsException.php +++ /dev/null @@ -1,15 +0,0 @@ -%s liegt ausserhalb des gütigen Bereiches! Schiffsteil nicht auffindbar.", $idx); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_ToMuchEmployeesException.php b/ship-simu/application/ship-simu/exceptions/class_ToMuchEmployeesException.php deleted file mode 100644 index 227c379..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_ToMuchEmployeesException.php +++ /dev/null @@ -1,21 +0,0 @@ -%d Leute nicht einstellbar, da nur %d arbeitslos sind!", - $amountArray[0], - $amountArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_TotalPriceNotCalculatedException.php b/ship-simu/application/ship-simu/exceptions/class_TotalPriceNotCalculatedException.php deleted file mode 100644 index c649bed..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_TotalPriceNotCalculatedException.php +++ /dev/null @@ -1,17 +0,0 @@ -__toString() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_UnsupportedLimitationPartException.php b/ship-simu/application/ship-simu/exceptions/class_UnsupportedLimitationPartException.php deleted file mode 100644 index 152a898..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_UnsupportedLimitationPartException.php +++ /dev/null @@ -1,15 +0,0 @@ -%s wird derzeit nicht unterstützt.", $str); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php b/ship-simu/application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php deleted file mode 100644 index ae12ce5..0000000 --- a/ship-simu/application/ship-simu/exceptions/class_WrongGenderSpecifiedException.php +++ /dev/null @@ -1,15 +0,0 @@ -%s Ist nicht M (Männlich) oder F (Weiblich).", $gender); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/init.php b/ship-simu/application/ship-simu/init.php deleted file mode 100644 index 0446060..0000000 --- a/ship-simu/application/ship-simu/init.php +++ /dev/null @@ -1,40 +0,0 @@ -isClass("ApplicationSelector"))) { return; } -// -// isset() is required to prevent a warning and is_object() is highly required -// when the application itself is requested in URL (hint: index.php?app=your_app) -// -// Get an instance of the helper -$eval = sprintf("\$app = %s::getInstance();", - FrameworkConfiguration::getInstance()->readConfig("app_helper_class") -); -eval($eval); - -// Set application name and version -$app->setAppName("Ship-Simu Schiffsimulator"); -$app->setAppVersion("0.1"); -$app->setAppShortName("ship-simu"); - -// Initialize output system -require(PATH . "inc/output.php"); - -// Initialize file i/o system -require(PATH . "inc/file_io.php"); - -// Include the language sub-system -require(PATH . "inc/language.php"); - -// This application needs a database connection then we have to simply include -// the inc/database.php script -require(PATH . "inc/database.php"); - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/interfaces/.htaccess b/ship-simu/application/ship-simu/interfaces/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/interfaces/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/interfaces/class_ConstructableShip.php b/ship-simu/application/ship-simu/interfaces/class_ConstructableShip.php deleted file mode 100644 index 9804433..0000000 --- a/ship-simu/application/ship-simu/interfaces/class_ConstructableShip.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @version 0.1 - */ -interface ConstructableShip extends FrameworkInterface { -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/interfaces/class_ConstructableShipPart.php b/ship-simu/application/ship-simu/interfaces/class_ConstructableShipPart.php deleted file mode 100644 index 0721b8c..0000000 --- a/ship-simu/application/ship-simu/interfaces/class_ConstructableShipPart.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @version 0.1 - */ -interface ConstructableShipPart extends FrameworkInterface { -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/interfaces/class_ContractPartner.php b/ship-simu/application/ship-simu/interfaces/class_ContractPartner.php deleted file mode 100644 index 9b1bb8c..0000000 --- a/ship-simu/application/ship-simu/interfaces/class_ContractPartner.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @version 0.1 - */ -interface ContractPartner extends FrameworkInterface { - /** - * This is a contract partner - * - * @param $contractInstance Must be a valid instance of WorksContract - * @return boolean true = can be a contract partner, - * false = no partner for contracts - */ - function isContractPartner (WorksContract $contractInstance); -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/interfaces/class_Customer.php b/ship-simu/application/ship-simu/interfaces/class_Customer.php deleted file mode 100644 index a49150e..0000000 --- a/ship-simu/application/ship-simu/interfaces/class_Customer.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.1 - */ -interface Customer extends FrameworkInterface { - /** - * Adds a contract to the customer's list - * - * @param $contractInstance A valid instance to WorksContract - * @return void - */ - function addNewWorksContract (WorksContract $contractInstance); - - /** - * Signs a works contract. - * - * @param $contractInstance A valid instance to WorksContract - * @param $partnerInstance An instance the other - * contract partner - * @return void - * @throws NullPointerException If an instance variable - * is null - * @throws NoObjectException If an instance variable - * is not an object - * @throws MissingMethodException If a required method was - * not found in $contractInstance - * @throws InvalidContractPartnerException If the in $contractInstance - * set contract partner is - * not the expected - */ - function signContract (WorksContract $contractInstance, ContractPartner $partnerInstance); - - /** - * Withdraw from a signed contract - * - * @param $contractInstance A valid instance to WorksContract - * @return void - */ - function withdrawFromContract (WorksContract $contractInstance); -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/interfaces/class_ItemIsTradeable.php b/ship-simu/application/ship-simu/interfaces/class_ItemIsTradeable.php deleted file mode 100644 index 8952000..0000000 --- a/ship-simu/application/ship-simu/interfaces/class_ItemIsTradeable.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @version 0.1 - */ -interface ItemIsTradeable extends FrameworkInterface { - /** - * Is this item (=object) tradeable? - * - * @return boolean true = is a tradeable object, - * false = is not tradeable - */ - function isTradeable (); -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/interfaces/class_Personellizer.php b/ship-simu/application/ship-simu/interfaces/class_Personellizer.php deleted file mode 100644 index f4474e7..0000000 --- a/ship-simu/application/ship-simu/interfaces/class_Personellizer.php +++ /dev/null @@ -1,184 +0,0 @@ - - * @version 0.1 - */ -interface Personellizer extends FrameworkInterface { - /////////////////////// - /// General methods /// - /////////////////////// - - /** - * Remove min/max age - * - * @return void - */ - function removeMinMaxAge (); - - /** - * Create a valid birthday - * - * @return void - */ - function createBirthday (); - - /** - * Verify if given year/month/day is a valid date combination - * - * @param $year 4-digit year (valid : 2007, 1946, - * invalid: 24, 2a, aa) - * @param $month 1 to 2-digit month (range: 1 to 12) - * @param $day 1 to 2-digit day (range: 1 to 31/30/29/28) - * @return boolean true = date is valid, - * false = date is invalid - */ - function isDateValid ($year, $month, $day); - - ///////////////////////// - //// Status requests //// - ///////////////////////// - - /** - * Is the person employed? - * - * @return boolean true = person is employed - * false = person is umemployed - */ - function isEmployed (); - - /** - * Is the person married? (to which one doesn't matter here) - * - * @return boolean true = person is married - * false = person is not married - */ - function isMarried (); - - /** - * Is the person a male? - * - * @return boolean true = person is male - * false = person is not male (maybe female? ;-)) - */ - function isMale (); - - /** - * Is the person a female? - * - * @return boolean true = person is female - * false = person is not female (maybe male? ;-)) - */ - function isFemale (); - - ///////////////// - //// Getters //// - ///////////////// - - /** - * Getter for surname - * - * @return $surname The person's surname - */ - function getSurname (); - - /** - * Getter for family name - * - * @return $family The person's family name - */ - function getFamily (); - - /** - * Getter for gender - * - * @return $gender The person's gender (F/M) - */ - function getGender (); - - /** - * Getter for salary - * - * @return $salary The person's current salary - */ - function getSalary (); - - ///////////////// - //// Setters //// - ///////////////// - - /** - * Setter for surname - * - * @param $surname The person's new surname as a string - * @return void - */ - function setSurname ($surname); - - /** - * Setter for family name - * - * @param $family The person's new family name as a string - * @return void - */ - function setFamily ($family); - - /** - * Setter for gender. Do not use this so often... ;-) - * This method shall only be used when the person is "created" - * - * @param $gender The person's new gender as a 1-char string (M/F) - * @return void - */ - function setGender ($gender); - - /** - * Setter for employment status - * - * @param $employed The person's new employment stats - * @return void - */ - function setEmployed ($employed); - - /** - * Setter for marrital status - * - * @param $married The person's new marrital status - * @return void - */ - function setMarried ($married); - - /** - * Setter for a already validated birthday. - * - * @param $year The person's new year-of-birth (4 digits) - * @param $month The person's new month-of-birth (1 to 2 digits) - * @param $day The person's new day-of-birth (1 to 2 digits) - * @return void - */ - function setBirthday ($year, $month, $day); - - ///////////////////////////////////// - //// Methods for changing salary //// - ///////////////////////////////////// - - /** - * Increase person's salary by a specified amount - * - * @param $add Add this float amount to current salary - * @return void - */ - function increaseSalary ($add); - - /** - * Decrease person's salary by a specified amount - * - * @param $sub Subtract this float amount to current salary - * @return void - */ - function decreaseSalary ($sub); -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/loader.php b/ship-simu/application/ship-simu/loader.php deleted file mode 100644 index 41dca7d..0000000 --- a/ship-simu/application/ship-simu/loader.php +++ /dev/null @@ -1,44 +0,0 @@ -application nicht gefunden!"); -} - -// Load all classes for the application -foreach ($lowerClasses as $class) { - // Try to load the application classes - try { - ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application, $class)); - } catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", - $class, - $e->getMessage() - )); - } catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", - $class, - $e->getMessage() - )); - } catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", - $class, - $e->getMessage() - )); - } catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", - $class, - $e->getMessage() - )); - } -} - -// Include all classes -ClassLoader::getInstance()->includeAllClasses(); - -// Clean up the global namespace -unset($lowerClasses); -unset($class); - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/.htaccess b/ship-simu/application/ship-simu/main/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/class_ b/ship-simu/application/ship-simu/main/class_ deleted file mode 100644 index 9644fd5..0000000 --- a/ship-simu/application/ship-simu/main/class_ +++ /dev/null @@ -1,7 +0,0 @@ - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - die("limitObject() reached! Stub!"); - } diff --git a/ship-simu/application/ship-simu/main/class_BasePersonell.php b/ship-simu/application/ship-simu/main/class_BasePersonell.php deleted file mode 100644 index 6f78c65..0000000 --- a/ship-simu/application/ship-simu/main/class_BasePersonell.php +++ /dev/null @@ -1,240 +0,0 @@ -getDebugInstance()->output("[PersonellBase:] Konstruktor erreicht.
\n"); - - // Beschreibung setzen - $this->setPartDescr("Personal"); - } - - // Calls the constructor - public function constructor ($class) { - $this->__construct($class); - } - - // Remove min/max ages - public final function removeMinMaxAge () { - if (defined('DEBUG_PERSONELL')) $this->getDebugInstance()->output(sprintf("[%s:%d] Minimum-/Maximum-Alter entfernt.
\n", - __CLASS__, - __LINE__ - )); - unset($this->MIN_AGE); - unset($this->MAX_AGE); - } - - // Generates a birthday based on MAX_AGE/MIN_AGE and the current date - public final function createBirthday () { - // Is the birthday already set? - if ($this->isDateValid($this->yearBirth, $this->monthBirth, $this->dayBirth)) return false; - - // Get current year - $currYear = date("Y", time()); - - // Generate random year/month/day - $year = mt_rand(($currYear - $this->MIN_AGE), ($currYear - $this->MAX_AGE)); - $month = 0; - $day = 0; - while (!$this->isDateValid($year, $month, $day)) { - $month = mt_rand(1, 12); - switch ($month) { - case 1: - case 3: - case 5: - case 7: - case 8: - case 10: - case 12: - $day = mt_rand(1, 31); - break; - - case 4: - case 6: - case 9: - case 11: - $day = mt_rand(1, 30); - break; - - case 2: // February - if ($year % 4 == 0) { - // Is a "Schaltjahr" - $day = mt_rand(1, 29); - } else { - // Regular year - $day = mt_rand(1, 28); - } - break; - } // switch - END - } // while - END - - // Set the new birthday - $this->setBirthday($year, $month, $day); - } - - // Is the current day valid? - public final function isDateValid ($year, $month, $day) { - // Create timestamp - $stamp = mktime(0, 0, 0, $month, $day, $year); - - // Get year/month/day back - $y = date("Y", $stamp); - $m = date("m", $stamp); - $d = date("d", $stamp); - - // Compare all - return (($y == $year) && ($m == $month) && ($d == $day)); - } - - // Employed? - public final function isEmployed () { - return $this->employed; - } - - // Married? - public final function isMarried () { - return $this->married; - } - - // Male? - public final function isMale () { - return ($this->gender == "M"); - } - - // Female - public final function isFemale () { - return ($this->gender == "F"); - } - - // Setter for surname - public final function setSurname ($surname) { - $this->surname = (string) $surname; - } - - // Getter for surname - public function getSurname () { - return $this->surname; - } - - // Setter for family name - public final function setFamily ($family) { - $this->family = (string) $family; - } - - // Getter for family name - public final function getFamily () { - return $this->family; - } - - // Setter for gender - public final function setGender ($gender) { - // Set random gender here - if (($gender == "M") || ($gender == "F") || ((empty($gender)) && ($this->getSurname() == ""))) { - $this->gender = $gender; - } else { - throw new WrongGenderSpecifiedException($gender, self::EXCEPTION_GENDER_IS_WRONG); - } - } - - // Getter for gender - public final function getGender () { - return $this->gender; - } - - // Setter for employment status - public final function setEmployed ($employed) { - $this->employed = (boolean) $employed; - } - - // Setter for marriage status - public final function setMarried ($married) { - $this->married = (boolean) $married; - } - - // Getter for salary - public final function getSalary () { - return $this->salary; - } - - // Increase salary - public final function increaseSalary ($add) { - $this->salary += (float) abs($add); - } - - // Decrease salary - public final function decreaseSalary ($sub) { - $this->salary -= (float) abs($sub); - } - - // Setter for birthday - public final function setBirthday ($year, $month, $day) { - $this->yearBirth = (int) abs($year); - $this->monthBirth = (int) abs($month); - $this->dayBirth = (int) abs($day); - } - - // Remove gender - public function removeGender () { - unset($this->gender); - } - - // Remove both names - public function removeNames () { - unset($this->surname); - unset($this->family); - } - - // Remove complete birthday - public function removeBirthday () { - unset($this->yearBirth); - unset($this->monthBirth); - unset($this->dayBirth); - } - - // Remove salary - public function removeSalary () { - unset($this->salary); - } - - // Remove employment status - public function removeEmployed () { - unset($this->employed); - } - - // Remove marrital status - public function removeMarried () { - unset($this->married); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/class_BaseSimulator.php b/ship-simu/application/ship-simu/main/class_BaseSimulator.php deleted file mode 100644 index 4726d29..0000000 --- a/ship-simu/application/ship-simu/main/class_BaseSimulator.php +++ /dev/null @@ -1,392 +0,0 @@ - 1, - 'height' => 1, - 'length' => 1 - ); - - // Konstruktor - private function __construct ($class) { - // Call highest constructor - parent::constructor($class); - - if ((defined('DEBUG_CORE')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Set part description and class name - $this->setPartDescr("Simulator-Basis-Einheit"); - - // Etwas aufraeumen, dies sollte ganz zum Schluss erfolgen! - $this->removeResizeFactorArray(); - $this->removeCurrPart(); - $this->removeCurrShip(); - } - - // Public constructor - public function constructor ($class) { - // Call real constructor - $this->__construct($class); - } - - // Magic __isset method - private function __isset ($var) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Checking %s in class.
\n", - $this->__toString(), $var - )); - return isset($this->$var); - } - - // Magic __unset method - private function __unset($var) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Removing %s from class.
\n", - $this->__toString(), $var - )); - unset($this->$var); - } - - // Setter-Methode fuer Laenge - public function setLength ($length) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Länge gesetzt.
\n", - $this->__toString(), - $length - )); - $this->length = (float) $length; - } - - // Setter-Methode fuer Breite - public function setWidth ($width) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Breite gesetzt.
\n", - $this->__toString(), - $width - )); - $this->width = (float) $width; - } - - // Setter-Methode fuer Hoehe - public function setHeight ($height) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] %dm Höhe gesetzt.
\n", - $this->__toString(), - $height - )); - $this->height = (float) $height; - } - - // Getter-Methode fuer Laenge - public function getLength () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge angefordert.
\n", - $this->__toString() - )); - return $this->length; - } - - // Getter-Methode fuer Breite - public function getWidth () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge angefordert.
\n", - $this->__toString() - )); - return $this->width; - } - - // Getter-Methode fuer Hoehe - public function getHeight () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe angefordert.
\n", - $this->__toString() - )); - return $this->height; - } - - // Setter-Methode fuer Teil-Instanz - public function setPartInstance ($struct) { - $this->partInstance = (Object) $struct; - } - - // Getter-Methode fuer Teil-Instanz - public function getPartInstance () { - if (!isset($this->partInstance)) { - return null; - } - return $this->partInstance; - } - - // Remover-Methode fuer die Teil-Instanz - public function removePartInstance () { - if ($this->getPartInstance() !== null) { - // Warnung ausgeben - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] partInstance ist nicht null! Instanz-Attribut wird nicht entfernt.
\n", - $this->__toString() - )); - } else { - // Leere Instanz kann entfernt werden - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] partInstance wurde entfernt.
\n", - $this->__toString() - )); - unset($this->partInstance); - } - } - - // Prueft ob all Umberechnungsfaktoren gesetzt sind - private function isResizeFactorValid () { - return (($this->getResizeFactorElement('width') > 1) - || ($this->getResizeFactorElement('height') > 1) - || ($this->getResizeFactorElement('length') > 1) - ); - } - - // Baut einen Motor in das Schiff ein - public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $partInstance) { - // Schiff/-steil merken - $this->currShip = $shipInstance; - $this->currPart = $partInstance; - - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Maschinenraum mit Motor %s wird fuer das Schiff %s konstruiert.
\n", - $this->__toString(), - $this->currPart->getPartDescr(), - $this->currShip->getShipName() - )); - - // Passt ueberhaupt das Schiffsteil in's Schiff? - if ($this->isShipPartSizeValid()) { - // Berechnungen fuer umliegendes Objekt anpassen - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil %s vom Typ %s passt in das Schiff %s hinein.
\n", - $this->__toString(), - $this->currPart->getPartDescr(), - $this->currPart->__toString(), - $this->currShip->getShipName() - )); - - // Muessen die Masse angepasst werden? - if ($this->isResizeFactorValid()) { - // Neue Angaben berechnen (wir lassen etwas Lust fuer Kabelbaeume, Roehren, Maschinisten, etc.) - $this->newWidth = (float) $this->currPart->getWidth() * $this->resizeFactorArray['width']; - $this->newHeight = (float) $this->currPart->getHeight() * $this->resizeFactorArray['height']; - $this->newLength = (float) $this->currPart->getLength() * $this->resizeFactorArray['length']; - - // Passt dies nun immer noch? - if ($this->isNewSizeValid()) { - // Das passt auch, dann Werte setzen und Motor-Instanz merken - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Das Schiffsteil %s passt in das Schiff %s hinein.
\n", - $this->__toString(), - $this->getPartDescr(), - $this->currShip->getShipName() - )); - $this->setWidth($this->newWidth); - $this->setHeight($this->newHeight); - $this->setLength($this->newLength); - - // Einige Dinge entfernen... - $this->removeAllNewAttr(); - } else { - // Passt nicht! Also wieder Exception werfen... - throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil %s vom Typ %s ist zu gross für das Schiff!", - $this->currPart->__toString(), - $this->currPart->getPartDescr(), - $this->currPart->__toString() - ), 2); - } - } elseif ($this->currPart != null) { - // Aktuelle Masse setzen - $this->setWidth($this->currPart->getWidth()); - $this->setHeight($this->currPart->getHeight()); - $this->setLength($this->currPart->getLength()); - } - - // Existiert ein Schiffsteil? - if (!is_null($this->currPart)) { - // Debug-Meldung ausgeben - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Schiffsteil %s gefunden.
\n", - $this->currPart->realClass, - $this->currPart->getPartDescr() - )); - - // Schiffsteil-Instanz setzen - $this->setPartInstance($this->currPart); - - // Instanzen entfernen - $this->currPart->removeCurrShip(); - $this->currPart->removeCurrPart(); - $this->currPart->removePartInstance(); - $this->currPart->removeResizeFactorArray(); - } - } else { - // Exception werfen! - throw new StructureShipMismatchException(sprintf("[%s:] Das Schiffsteil %s vom Typ %s passt nicht in das Schiff!", - $this->currPart->realClass, - $this->currPart->getPartDescr(), - $this->currPart->__toString() - ), 1); - } - - // Nochmals etwas aufraeumen - $this->removeResizeFactorArray(); - $this->removeCurrShip(); - $this->removeCurrPart(); - } - - // Array fuer Umrechnungstabelle entfernen - public function removeResizeFactorArray () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeResizeFactor erreicht.
\n", - $this->__toString() - )); - unset($this->resizeFactorArray); - } - - // Alle newXXX-Attribute entfernen - public function removeAllNewAttr () { - unset($this->newWidth); - unset($this->newHeight); - unset($this->newLength); - } - - // Aktuelle Schiff-Instanz entfernen - public function removeCurrShip () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrShip erreicht.
\n", - $this->__toString() - )); - unset($this->currShip); - } - - // Aktuelle Schiff-Instanz entfernen - public function removeCurrPart () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrPart erreicht.
\n", - $this->__toString() - )); - unset($this->currPart); - } - - // Breite entfernen - public function removeWidth () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Breite entfernt.
\n", - $this->__toString() - )); - unset($this->width); - } - - // Hoehe entfernen - public function removeHeight () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe entfernt.
\n", - $this->__toString() - )); - unset($this->height); - } - - // Laenge entfernen - public function removeLength () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge entfernt.
\n", - $this->__toString() - )); - unset($this->length); - } - - // Tiefgang entfernen - public function removeDraught () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Tiefgang entfernt.
\n", - $this->__toString() - )); - unset($this->draught); - } - - // Getter-Methode fuer Element aus resizeFactor - public function getResizeFactorElement ($el) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] getResizeFactorElement erreicht. (element=%s)
\n", - $this->__toString(), - $el - )); - if (isset($this->resizeFactorArray[$el])) { - // Element gefunden - return $this->resizeFactorArray[$el]; - } else { - // Element nicht gefunden! - return 0; - } - } - - // Setter-Methode fuer Element in resizeFactor - public function setResizeFactorElement ($el, $value) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Umberechnungsfaktor %s=%s gesetzt.
\n", - $this->__toString(), - $el, - $value - )); - $this->resizeFactorArray[$el] = (float) $value; - } - - // Kontrolliert, ob die Abmasse Schiffsteil->Schiff stimmen - public function isShipPartSizeValid () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] isShipPartSizeValid erreicht.
\n", - $this->__toString() - )); - return ( - ( - ( // Already defined ship messurings - ($this->currPart->getWidth() < $this->currShip->getWidth()) - && ($this->currPart->getHeight() < $this->currShip->getDraught()) - && ($this->currPart->getLength() < $this->currShip->getLength()) - ) || ( // Ship messurings shall be calculated - ($this->currShip->getWidth() == 0) - && ($this->currShip->getHeight() == 0) - && ($this->currShip->getLength() == 0) - ) - // The inserted part must be messured! - ) && ($this->currPart->getWidth() > 0) - && ($this->currPart->getHeight() > 0) - && ($this->currPart->getLength() > 0) - ); - } - - // Kontrolliert, ob die Abmasse Maschinenraum->Schiff stimmen - public function isNewSizeValid () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] isNewSizeValid erreicht.
\n", - $this->__toString() - )); - return ( - ( // Already defined ship messurings - ($this->newWidth < $this->currShip->getWidth()) - && ($this->newHeight < $this->currShip->getDraught()) - && ($this->newLength < $this->currShip->getLength()) - ) || ( // Ship messurings shall be calculated - ($this->currShip->getWidth() == 0) - && ($this->currShip->getHeight() == 0) - && ($this->currShip->getLength() == 0) - ) - ); - } - - // Masse extrahieren - public function extractDimensions ($dim) { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] extractDimensions erreicht für %s.
\n", - $this->__toString(), - $this->getPartDescr() - )); - - // Abmasse setzen - if ((isset($dim)) && (is_array($dim)) && (count($dim) == 3)) { - // Abmasse aus Array holen - $this->setWidth($dim[0]); - $this->setHeight($dim[1]); - $this->setLength($dim[2]); - } else { - // Nicht gefundene Abmasse! - throw new DimNotFoundInArrayException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); - } - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/class_Merchant.php b/ship-simu/application/ship-simu/main/class_Merchant.php deleted file mode 100644 index 1ef6dbd..0000000 --- a/ship-simu/application/ship-simu/main/class_Merchant.php +++ /dev/null @@ -1,188 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Händler"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Haendler mit Namen erzeugen - public static function createMerchant ($merchantName, Harbor $harborInstance) { - // String absichern - $merchantName = (string) $merchantName; - - // Instanz holen - $merchantInstance = new Merchant(); - - // Debug message - if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) { - $merchantInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Händler %s wird angelegt und soll sich am %s niederlassen.
\n", - __CLASS__, - __LINE__, - $merchantName, - $harborInstance->getHarborName() - )); - } - - // Haendlernamen setzen - $merchantInstance->setMerchantName($merchantName); - - // In dem angegebenen Hafen den Haendler ansiedeln - $merchantInstance->setHarborInstance($harborInstance); - - // Preisliste initialisieren - $merchantInstance->createPriceList(); - - // Instanz zurueckliefern - return $merchantInstance; - } - - // Initialize pricing list - private function createPriceList () { - if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler %s erhält eine leere Preisliste.
\n", - __CLASS__, - __LINE__, - $this->getMerchantName() - )); - $this->priceList = new FrameworkArrayObject(); - } - - // Setter for merchant name - public function setMerchantName ($merchantName) { - // Secure string - $merchantName = (string) $merchantName; - - // Debug message - if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händlername %s ist nun bekannt.
\n", - __CLASS__, - __LINE__, - $merchantName - )); - $this->merchantName = $merchantName; - } - - // Getter for merchant name - public function getMerchantName () { - if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händlername %s wird verlangt.
\n", - __CLASS__, - __LINE__, - $this->merchantName - )); - return $this->merchantName; - } - - // Setter for harbor instance - public function setHarborInstance (Harbor $harborInstance) { - if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler %s lässt sich am %s nieder.
\n", - __CLASS__, - __LINE__, - $this->getMerchantName(), - $harborInstance->getHarborName() - )); - $this->harborInstance = $harborInstance; - } - - // Getter for harbor instance - public function getHarborInstance () { - if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler %s hat sich am %s niedergelassen.
\n", - __CLASS__, - __LINE__, - $this->getMerchantName(), - $harborInstance->getHarborName() - )); - return $this->harborInstance; - } - - // Add new item to merchant's price list - public function addItemToPriceList (ItemIsTradeable $itemInstance, $price) { - // Secure pricing - $price = (float) $price; - - // Debug message - if ((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Händler %s kann nun das Schiffsteil %s "%s" zu %s verkaufen.
\n", - __CLASS__, - __LINE__, - $this->getMerchantName(), - $itemInstance->__toString(), - $itemInstance->getPartDescr(), - $this->formatCurrency($price) - )); - - // Construct pricing item and add it to the list - $this->priceList->append(array( - 'item' => $itemInstance, - 'price' => $price - )); - - // Remove price attribute - $itemInstance->removePrice(); - } - - // Get a price from the merchant's list - public function getPriceFromList (ItemIsTradeable $itemInstance) { - $price = 0; - - // Iterate throw whole list - for ($iter = $this->priceList->getIterator(); $iter->valid(); $iter->next()) { - // Get current item - $item = $iter->current(); - - // Does this item match? The unique ID may not work... - if ($item['item']->itemMatches($itemInstance)) { - // Extract price and stop searching - $price = $item['price']; - break; - } - } - - // Was the item found? - if ($price === 0) { - // Throw exception - throw new ItemNotInPriceListException($itemInstance, self::EXCEPTION_ITEM_NOT_IN_PRICE_LIST); - } - - // Return price - return $price; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/class_WorksContract.php b/ship-simu/application/ship-simu/main/class_WorksContract.php deleted file mode 100644 index 961ef17..0000000 --- a/ship-simu/application/ship-simu/main/class_WorksContract.php +++ /dev/null @@ -1,444 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Bauvertrag"); - - // Unique-ID generieren - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Neuen Bauvertrag generieren - public static function createWorksContract ($shipType, $shipName, ContractPartner $partnerInstance) { - // Strings absichern - $shipType = (string) $shipType; - $shipName = (string) $shipName; - - // Is the other one a contract partner? - if (is_null($partnerInstance)) { - // Opps! Empty partner instance? - throw new NullPointerException($partnerInstance, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($partnerInstance)) { - // Not an object! ;-( - throw new NoObjectException($partnerInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($partnerInstance, 'isContractPartner')) { - // Does not have the required feature (method) - throw new MissingMethodException(array($partnerInstance, 'isContractPartner'), self::EXCEPTION_MISSING_METHOD); - } - - // Instanz holen - $contractInstance = new WorksContract(); - - // Debug-Meldung ausgeben - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->getDebugInstance()->output(sprintf("[%s:%d] Neuer Bauvertrag wird für das Schiff %s mit der %s %s erstellt.
\n", - __CLASS__, - __LINE__, - $shipName, - $partnerInstance->getPartDescr(), - $partnerInstance->getCompanyName() - )); - - // Schiffsnamen setzen - $contractInstance->setShipName($shipName); - - // Existiert die Klasse ueberhaupt? - if (!class_exists($shipType)) { - // Klasse nicht gefunden - throw new ClassNotFoundException ($shipType, 0); - } - - // Schiff-Instanz temporaer erzeugen und in den Bauvertrag einfuegen - $eval = sprintf("\$contractInstance->setShipInstance(%s::create%s(\"%s\"));", - $shipType, - $shipType, - $shipName - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $contractInstance->getDebugInstance()->output(sprintf("[%s:%d] Konstruierte PHP-Anweisung:
%s

\n", - __CLASS__, - __LINE__, - htmlentities($eval) - )); - - // Execute constructed command - @eval($eval); - - // Set itself as contract partner - $contractInstance->setContractPartner($partnerInstance); - - // Instanz zurueckgeben - return $contractInstance; - } - - // Setter for ship instance - private function setShipInstance (ConstructableShip $shipInstance) { - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s wird in den Bauvertrag aufgenommen.
\n", - __CLASS__, - __LINE__, - $shipInstance->getShipName() - )); - $this->shipInstance = $shipInstance; - } - - // Setter for ship name - private function setShipName ($shipName) { - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das neue Schiff wird %s heissen.
\n", - __CLASS__, - __LINE__, - $shipName - )); - $this->shipName = (string) $shipName; - } - - // Getter for ship name - public function getShipName () { - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Schiffsname %s angefordert.
\n", - __CLASS__, - __LINE__, - $this->shipName - )); - return $this->shipName; - } - - // Getter for ship instance - public function getShipInstance () { - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Schiff-Instanz angefordert.
\n", - __CLASS__, - __LINE__ - )); - return $this->shipInstance; - } - - // Add detail to the contract - public function addContractDetails ($shipPart, $parentPart, array $dataArray) { - // Secure strings - $shipPart = (string) $shipPart; - $parentPart = (string) $parentPart; - - // Debug message - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiffsteil %s wird zusammen mit dem Konstruktionsteil %s in den Bauvertrag aufgenommen.
\n", - __CLASS__, - __LINE__, - $shipPart, - $parentPart - )); - - // Initialize the instance (shall not be done within dynamic part) - $instance = null; - - // Prepare the big command for everthing - $eval = "try { - \$instance = ".$shipPart."::create".$shipPart."("; - foreach ($dataArray as $pIdx => $parts) { - if (is_string($parts)) { - // String einbauen - $eval .= "\"".$parts."\", "; - } elseif (is_array($parts)) { - // Ist ein weiteres Array! - $eval .= "array("; - foreach ($parts as $idx2 => $sub) { - $eval .= "'".$idx2."' => "; - if (is_string($sub)) { - // Ist erneut ein String - $eval .= "\"".$sub."\""; - } elseif (is_array($sub)) { - // Wird nicht mehr unterstuetzt! - ApplicationEntryPoint::app_die("No more arrays!"); - } else { - // Direkt anhaengen - $eval .= $sub; - } - $eval .= ", "; - } - - // Letztes Komma entfernen - $eval = substr($eval, 0, -2); - $eval .= "), "; - } else { - // Etwas anderes direkt! - $eval .= $parts.", "; - } - } - - // Letztes Komma abhaengen - $eval = substr($eval, 0, -2); - $eval .= "); -} catch (DimNotFoundInArrayException \$e) { - \$this->getDebugInstance()->output(sprintf(\"[main:] Die %s konnte nicht vervollständigt werden. Grund: %s
\\n\", - \$this->getShipInstance()->getShipName(), - \$e->getMessage() - )); - \$instance = null; -}"; - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Ship:] Konstruierte PHP-Anweisung:
%s

\n", - htmlentities($eval) - )); - - // Code ausfuhren - @eval($eval); - - // Try to add the ship part to the contract - try { - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.
\n", - __CLASS__, - __LINE__ - )); - if (!$instance instanceof ConstructableShipPart) { - // Ship part not constructable! - throw new ShipPartNotConstructableException(array($shipPart), self::EXCEPTION_NOT_CONSTRUCTABLE); - } elseif (!$this->getShipInstance()->createShipPart($instance, $parentPart)) { - // Schiff konnte nicht gebaut werden! - throw new ShipNotConstructedException(sprintf("Das Schiff %s konnte wegen eines Fehlers nicht gebaut werden. Siehe obere Meldungen.", - $this->getShipInstance()->getShipName() - )); - } - } catch(ClassNotFoundException $e) { - // Throw it again... - throw new ClassNotFoundException($e->getMessage(), $e->getCode()); - } - - // Get price for this item - $price = $this->getMerchantInstance()->getPriceFromList($instance); - - // Final debug message - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %s kostet %s.
\n", - __CLASS__, - __LINE__, - $instance->getPartDescr(), - $this->getMerchantInstance()->formatCurrency($price) - )); - - // Add price - $instance->setPrice($price); - - // Final debug message - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %s wurde in den Bauvertrag aufgenommen.
\n", - __CLASS__, - __LINE__, - $instance->getPartDescr() - )); - } - - // Setter for contract partner - public function setContractPartner (ContractPartner $partnerInstance) { - $this->contractPartner = $partnerInstance; - } - - // Getter for contract partner - public function getContractPartner () { - return $this->contractPartner; - } - - // Setter for contract party - public function setContractParty (ContractPartner $partyInstance) { - $this->contractParty = $partyInstance; - } - - // Getter for contract party - public function getContractParty () { - return $this->contractParty; - } - - // Setter for signature - public function setSigned ($signed) { - $this->signed = (boolean) $signed; - } - - // Getter for signature - public function isSigned () { - return $this->signed; - } - - // Sign the contract - public function signContract (ContractPartner $partnerInstance, ContractPartner $partyInstance) { - // Is this contract already signed? - if ($this->isSigned()) { - // Throw an exception - throw new ContractAllreadySignedException(array($this, $this->getContractPartner(), $this->getContractParty()), self::EXCEPTION_CONTRACT_ALREADY_SIGNED); - } - - // Is the first contract partner still the same? - if ($partnerInstance->equals($this->getContractPartner())) { - // Set contract party (other partner is already set) - $this->setContractParty($partyInstance); - - // Finally sign it - $this->setSigned(true); - } else { - // Throw an exception - throw new ContractPartnerMismatchException(array($this, $this->getContractPartner(), $partyInstance), self::EXCEPTION_CONTRACT_PARTNER_MISMATCH); - } - - // Debug message - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) { - if ($partnerInstance->equals($partyInstance)) { - // With itself - $this->getDebugInstance()->output(sprintf("[%s:%d] Die %s %s stimmt einem Bauvertrag über das %s %s zu.
\n", - __CLASS__, - __LINE__, - $partnerInstance->getPartDescr(), - $partnerInstance->getCompanyName(), - $this->getShipInstance()->getPartDescr(), - $this->getShipInstance()->getShipName() - )); - } else { - // Other contract party - $this->getDebugInstance()->output(sprintf("[%s:%d] Die %s %s geht mit der %s %s einen Bauvertrag über das %s %s ein.
\n", - __CLASS__, - __LINE__, - $partnerInstance->getPartDescr(), - $partnerInstance->getCompanyName(), - $partyInstance->getPartDescr(), - $partyInstance->getCompanyName(), - $this->getShipInstance()->getPartDescr(), - $this->getShipInstance()->getShipName() - )); - } - } - } - - // Setter for merchant instance - public function setMerchantInstance (Merchant $merchantInstance) { - $this->merchantInstance = $merchantInstance; - } - - // Getter for merchant instance - public function getMerchantInstance () { - return $this->merchantInstance; - } - - // Getter for total price - public function getTotalPrice () { - // Get ship instance - $shipInstance = $this->getShipInstance(); - - // Is this a ship? - if (is_null($shipInstance)) { - // Opps! Empty partner instance? - throw new NullPointerException($shipInstance, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipInstance)) { - // Not an object! ;-( - throw new NoObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!$shipInstance instanceof ConstructableShip) { - // Does not have the required feature (method) - throw new ShipIsInvalidException(array($shipInstance), self::EXCEPTION_INVALID_SHIP_INSTANCE); - } - - // Get the structure array - $struct = $shipInstance->getStructuresArray(); - - // Is this a ship? - if (is_null($struct)) { - // Opps! Empty partner instance? - throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY); - } - - // Init total price - $totalPrice = 0; - - // Iterate through the list - for ($iter = $struct->getIterator(); $iter->valid(); $iter->next()) { - // Get item - $item = $iter->current(); - - // Is this a ship? - if (is_null($item)) { - // Opps! Empty partner instance? - throw new NullPointerException($item, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($item)) { - // Not an object! ;-( - throw new NoObjectException($item, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($item, 'getPartInstance')) { - // Does not have the required feature (method) - throw new MissingMethodException(array($item, 'getPartInstance'), self::EXCEPTION_MISSING_METHOD); - } - - // Get part instance - $part = $item->getPartInstance(); - - // Is this a ship? - if (is_null($part)) { - // Opps! Empty partner instance? - throw new NullPointerException($part, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($part)) { - // Not an object! ;-( - throw new NoObjectException($part, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($part, 'getPrice')) { - // Does not have the required feature (method) - throw new MissingMethodException(array($part, 'getPrice'), self::EXCEPTION_MISSING_METHOD); - } - - // Get price for one item - $price = $part->getPrice(); - - // Is there numCabin() available? - if (method_exists($item, 'getNumCabin')) { - // Get total cabin and multiply it with the price - $price = $price * $item->getNumCabin(); - } - - // Add price to total price - $totalPrice += $price; - } - - // Total price calculated? - if ($totalPrice === 0) { - // Throw exception - throw new TotalPriceNotCalculatedException($this, self::EXCEPTION_TOTAL_PRICE_NOT_CALCULATED); - } - - // Return total price - return $totalPrice; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/companies/.htaccess b/ship-simu/application/ship-simu/main/companies/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/companies/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/companies/class_ShippingCompany.php b/ship-simu/application/ship-simu/main/companies/class_ShippingCompany.php deleted file mode 100644 index 54b3e28..0000000 --- a/ship-simu/application/ship-simu/main/companies/class_ShippingCompany.php +++ /dev/null @@ -1,636 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Reederei"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Reederei gruenden (create wegen Namenskonvention) - public static function createShippingCompany ($companyName, Harbor $hqInstance) { - // Instanz holen - $companyInstance = new ShippingCompany(); - - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $companyInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s wird gegründet.
\n", - __CLASS__, - __LINE__, - $companyName - )); - - // Firmennamen setzen - $companyInstance->setCompanyName($companyName); - - // Kuerzel setzen - $companyInstance->createShortName(); - - // Sitz festlegen - $companyInstance->setHQInstance($hqInstance); - - // Werftenliste erstellen - $companyInstance->createshipyardList(); - - // Angestellten-Liste erstellen - $companyInstance->createEmployeeList(); - - // Auftragsliste erstellen - $companyInstance->createContractList(); - - // Etwas aufraeumen - $companyInstance->removeWidth(); - $companyInstance->removeHeight(); - $companyInstance->removeLength(); - $companyInstance->removeDraught(); - $companyInstance->removePartInstance(); - - // Instanz zurueckgeben - return $companyInstance; - } - - // Angestellten-Liste erstellen - private function createEmployeeList () { - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erhält eine Angestelltenliste.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName() - )); - $this->employeeList = new FrameworkArrayObject(); - } - - // Werftenliste erstellen - public function createShipyardList () { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erhält eine Werftsliste.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName() - )); - $this->shipyardList = new FrameworkArrayObject(); - } - - // Auftragsliste erstellen - public function createContractList () { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erhält eine Auftragsliste.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName() - )); - $this->contractList = new FrameworkArrayObject(); - } - - // Setter-Methode fuer Firmennamen - public function setCompanyName ($companyName) { - $this->companyName = (string) $companyName; - } - - // Getter-Methode fuer Firmennamen - public function getCompanyName () { - return $this->companyName; - } - - // Setter-Methode fuer Firmensitz - public function setHQInstance (Harbor $hqInstance) { - $this->hqInstance = $hqInstance; - } - - // Kuerzel setzen - private function createShortName () { - // Mindestens eine Leerstelle? - $dummy = explode(" ", $this->getCompanyName()); - foreach ($dummy as $part) { - $this->shortName .= substr($part, 0, 1); - } - } - - // Reedereien Werften bauen lassen - public function createShipyardInHarbor($shipyardName, Harbor $harborInstance) { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s baut im %s eine Werft %s.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $harborInstance->getHarborName(), - $shipyardName - )); - - // Wird im HQ gebaut? - if ($this->hqInstance->equals($harborInstance)) { - // Die neue Werft wird im HQ gebaut! - $this->hqInstance->addNewShipyardNotify($shipyardName, $this); - // Die Werft drueber in Kenntnis setzen, welcher Reederei sie angehoert - } else { - // Ausserhalb des Heimathafens soll eine Werft gebaut werden - $harborInstance->addNewShipyardNotify($shipyardName, $this); - } - } - - // Setter fuer Reederei-Gruender - public function setCompanyFounder(CompanyEmployee $founderInstance) { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s ist von %s %s gegründet worden.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $founderInstance->getSurname(), - $founderInstance->getFamily() - )); - $this->founderInstance = $founderInstance; - } - - // Getter for founder instance - public function getFounderInstance () { - return $this->founderInstance; - } - - // Neue(n) Angestellte(n) in Angestellten-Liste aufnehmen - public function addNewEmployee (SimulatorPersonell $employeeInstance) { - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %s %s tritt der Reederei %s als %s bei und erhält ein Gehalt von %s.
\n", - __CLASS__, - __LINE__, - $employeeInstance->getSurname(), - $employeeInstance->getFamily(), - $this->getCompanyName(), - $employeeInstance->getPartDescr(), - $this->formatCurrency($employeeInstance->getSalary()) - )); - $this->employeeList->append($employeeInstance); - } - - // Neue Werft in Liste aufnehmen - public function addNewShipyard (Shipyard $shipyardInstance) { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erhält die Werft %s hinzugefügt.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $shipyardInstance->getShipyardName() - )); - $this->shipyardList->append($shipyardInstance); - } - - // Neue Mitarbeiter per Zufall einstellen/rekrutieren - public function recruitRandomEmployees($amount, SimulatorPersonell $personellInstance) { - // Anzahl Mitarbeiter absichern - $amount = (int) $amount; - - // Debug-Meldung ausgeben - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s stellt per Zufall %d neue Mitarbeiter ein.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $amount - )); - - // Gesamtanzahl verfuegbarer Erwerbsloser holen - $totalUnemployed = $personellInstance->getAllUnemployed(); - - // Existiert die gewuenschte Anzahl freier Arbeiter? (doppelt geht derzeit nicht) - if ($totalUnemployed < $amount) { - // Reichte nicht aus! - throw new ToMuchEmployeesException(array($amount, $personellInstance->getAllUnemployed()), self::EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES); - } - - // Get list for all unemployed people - $list = $personellInstance->getSpecialPersonellList(false); // Should be cached - - // Get iterator of the list - $iterator = $list->getIterator(); - - // Get the requested amount of personell - for ($idx = 0; $idx < $amount; $idx++) { - $employee = null; - // Is this personl unemployed? - while (is_null($employee) || $employee->isEmployed()) { - // Generate random number - $pos = mt_rand(0, ($totalUnemployed - 1)); // Don't remove the -1 here: - // E.g. 100 entries means latest position is 99... - - // Seek for the position - $iterator->seek($pos); - - // Is the current position valid? - if ($iterator->valid()) { - // Element holen - $employee = $iterator->current(); - } else { - // Should normally not happen... :( - throw new StructuresOutOfBoundsException($idx, self::EXCEPTION_INDEX_OUT_OF_BOUNDS); - } - } - - // A dummy just for the description and real class - $dummy = CompanyEmployee::createCompanyEmployee("", "", "M", 1970, 1, 1, $employee->isMarried(), 0); - - // Make this person employed and give him some money to work - $employee->setEmployed(true); - $employee->setPartDescr($dummy->getPartDescr()); - $employee->setRealClass($dummy->__toString()); - $employee->increaseSalary((mt_rand(7, 14) * 100)); // Are 700 to 1400 EUR for the begin okay? - - // Debug message - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s stellt den/die Angestellte(n) %s %s ein.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $employee->getSurname(), - $employee->getFamily() - )); - - // Add this employee - $this->addNewEmployee($employee); - } // End - for - - // Cache resetten - $personellInstance->resetCache(); - - // Debug-Meldung ausgeben - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s hat per Zufall %d neue Mitarbeiter eingestellt.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $amount - )); - } // End - method - - // Distribute all personells on all shipyards - public function distributeAllPersonellOnShipyards () { - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s verteilt alle ihre %d Mitarbeiter auf alle %d Werft(en).
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $this->getTotalEmployee(), - $this->getTotalShipyards() - )); - - // Do we have some shipyards? - if (is_null($this->shipyardList)) { - // No shipyards created - throw new NoShipyardsConstructedException($this, self::EXCEPTION_HARBOR_HAS_NO_SHIPYARDS); - } - - // Get iterator for shipyards - $shipyardIter = $this->shipyardList->getIterator(); - - // Iterate through all employees - for ($idx = $this->employeeList->getIterator(); $idx->valid(); $idx->next()) { - // Is the shipyard iterator still okay? - if (!$shipyardIter->valid()) { - // Rewind to first position - $shipyardIter->seek(0); - } - - // Get Shipyard object - $shipyard = $shipyardIter->current(); - - // Is this a Shipyard object? - if (is_null($shipyard)) { - // No class returned - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipyard)) { - // Not an object! ;-( - throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!$shipyard->isClass("Shipyard")) { - // Nope, so throw exception - throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); - } - - // Add employee to the shipyard - $shipyard->addNewPersonell($idx->current()); - - // Continue to next shipyard - $shipyardIter->next(); - } - } - - // Getter for total employees - public function getTotalEmployee () { - // Count all... - $total = $this->employeeList->count(); - - // Debug message - if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s hat %d Mitarbeiter.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $total - )); - - // Return amount - return $total; - } - - // Getter for total shipyards - public function getTotalShipyards () { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Für die Reederei %s werden die Anzahl der Werften in allen Häfen ermittelt.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName() - )); - - // Do we have some shipyards? - if (is_null($this->shipyardList)) { - // No shipyards created - throw new NoShipyardsConstructedException($this, self::EXCEPTION_HARBOR_HAS_NO_SHIPYARDS); - } - - // Get iterator - $total = $this->shipyardList->count(); - - // Debug message - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s hat %d Werft(en).
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $total - )); - - // Return amount - return $total; - } - - // Add a ship type (class) to all shipyards - public function addShipTypeToAllShipyards ($shipType) { - // Secure strings - $shipType = (string) $shipType; - - // Is the class there? - if (!class_exists($shipType)) { - // Throw exception - throw new ClassNotFoundException($shipType, 0); - } - - // Create dummy ship - eval(sprintf("\$shipInstance = %s::create%s(\"M/S Dummy\");", - $shipType, - $shipType - )); - - // Debug message - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s baut in allen Werften bald Schiffe vom Typ %s.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $shipInstance->getPartDescr() - )); - - // Iterate shipyard list - for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) { - // Get current element - $shipyard = $idx->current(); - - // Is this a shipyard? - if (is_null($shipyard)) { - // Opps! Empty list? - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipyard)) { - // Not an object! ;-( - throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!$shipyard->isClass("Shipyard")) { - // Class is not a shipyard - throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); - } - - // Add the new ship type to the shipyard - $shipyard->addNewConstructableShipType($shipType); - } - } - - // Validate the requested ship type with the company if they can construct it - public function validateWorksContractShipType (WorksContract $contractInstance) { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s prüft den Bauauftrag der %s.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $contractInstance->getShipName() - )); - - // First get the ship type - $shipInstance = $contractInstance->getShipInstance(); - - // Ist there a ship instance? - if (is_null($shipInstance)) { - // Opps! Empty entry? - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipInstance)) { - // Not an object! ;-( - throw new NoObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); - } - - // Get it's real class name - $shipType = $shipInstance->__toString(); - - // Debug message - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s prüft, ob die %s (Typ:%s) gebaut werden kann.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $contractInstance->getShipName(), - $shipInstance->getPartDescr() - )); - - // Now check if the ship type is in any list and return the result - return ($this->isShipTypeConstructable($shipType)); - } - - // Is the ship type constructable? - public function isShipTypeConstructable ($shipType) { - // The type must be a string! - $shipType = (string) $shipType; - - // Debug message - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s fragt alle Werften ab, ob diese Schiffe vom Typ %s bauen können.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $shipType - )); - - // First everthing is failed... - $result = false; - - // Iterate through all shipyards - for ($idx = $this->shipyardList->getIterator(); $idx->valid(); $idx->next()) { - // Get current Shipyard instance - $shipyard = $idx->current(); - - // Is this a shipyard? - if (is_null($shipyard)) { - // Opps! Empty list? - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($shipyard)) { - // Not an object! ;-( - throw new NoObjectException($shipyard, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!$shipyard->isClass("Shipyard")) { - // Class is not a shipyard - throw new ClassMismatchException(array($shipyard->__toString(), "Shipyard"), self::EXCEPTION_CLASSES_NOT_MATCHING); - } - - // Validate if the first found shipyard can construct the requested type - $result = $shipyard->isShipTypeConstructable($shipType); - - // Does this shipyard construct the requested ship type? - if ($result) break; // Then abort the search! - } - - // Debug message - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s hat die Suche nach einer Werft beendet, die Schiffe vom Typ %s bauen kann.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $shipType - )); - - // Return result - return $result; - } - - // As a customer the shipping company can add new contracts - public function addNewWorksContract (WorksContract $contractInstance) { - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erstellt einen Bauauftrag für ein %s mit dem Namen %s.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $contractInstance->getShipInstance()->getPartDescr(), - $contractInstance->getShipInstance()->getShipName() - )); - $this->contractList->append($contractInstance); - } - - // As a customer the shippng company can withdraw from a contract - public function withdrawFromContract (WorksContract $contractInstance) { - ApplicationEntryPoint::app_die("WITHDRAW:
".print_r($contractInstance, true)."
"); - } - - // Get latest added contract instance - public function getLastContractInstance () { - // Get iterator - $iter = $this->contractList->getIterator(); - - // Get latest entry (total - 1) - $iter->seek($iter->count() - 1); - - // Return entry - return $iter->current(); - } - - // Sign a contract with an other party which must also implement Customer - public function signContract (WorksContract $contractInstance, ContractPartner $partnerInstance) { - if (!$partnerInstance->isContractPartner($contractInstance)) { - // Invalid contract partner! - throw new InvalidContractPartnerException($partnerInstance, self::EXCEPTION_CONTRACT_PARTNER_INVALID); - } - - // Determine if company "signs" own contract (must be done) or with an other party - if ($this->equals($partnerInstance)) { - // With itself - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s erteilt an sich selbst einen Bauauftrag für das %s "%s".
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $contractInstance->getShipInstance()->getPartDescr(), - $contractInstance->getShipInstance()->getShipName() - )); - } else { - // Other external company - if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei %s unterzeichnet einen Bauauftrag für das %s "%s" mit der %s.
\n", - __CLASS__, - __LINE__, - $this->getCompanyName(), - $contractInstance->getShipInstance()->getPartDescr(), - $contractInstance->getShipInstance()->getShipName(), - $partnerInstance->getCompanyName() - )); - } - - // Sign the contract - $contractInstance->signContract($this, $partnerInstance); - - /** - * @todo Maybe do something more here... - */ - } - - // Is this the right contract partner? - public function isContractPartner (WorksContract $contractInstance) { - // Get contract partner instance and compare it with $this contract partner - return ($this->equals($contractInstance->getContractPartner())); - } - - // Setter for merchant instance - public function setMerchantInstance (Merchant $merchantInstance) { - // Get contract - $contractInstance = $this->getLastContractInstance(); - - if (is_null($contractInstance)) { - // Opps! Empty contract instance? - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($contractInstance)) { - // Not an object! ;-( - throw new NoObjectException($contractInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!$contractInstance->isClass('WorksContract')) { - // Is not a merchant - throw new ClassMismatchException(array($contractInstance->__toString(), "WorksContract"), self::EXCEPTION_CLASSES_NOT_MATCHING); - } - - // Set the merchant in the contract (for getting prices) - $contractInstance->setMerchantInstance($merchantInstance); - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/constructions/.htaccess b/ship-simu/application/ship-simu/main/constructions/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/constructions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/constructions/berths/.htaccess b/ship-simu/application/ship-simu/main/constructions/berths/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/constructions/berths/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/constructions/berths/class_Berth.php b/ship-simu/application/ship-simu/main/constructions/berths/class_Berth.php deleted file mode 100644 index 06eac84..0000000 --- a/ship-simu/application/ship-simu/main/constructions/berths/class_Berth.php +++ /dev/null @@ -1,48 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Eltern-Konstruktor aufrufen - parent::constructor(__CLASS__); - - // Beschreibung setzen - $this->setPartDescr("Liegeplatz"); - - // Unique-ID erzeugen - $this->createUniqueID(); - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/constructions/class_BaseConstruction.php b/ship-simu/application/ship-simu/main/constructions/class_BaseConstruction.php deleted file mode 100644 index 16ef468..0000000 --- a/ship-simu/application/ship-simu/main/constructions/class_BaseConstruction.php +++ /dev/null @@ -1,39 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Beschreibung setzen - $this->setPartDescr("Namenlose Landkonstruktion"); - - // Etwas aufraeumen (brauchen wir hier nicht) - $this->removeNumberFormaters(); - } - - // Konstruktor aufrufen - public function constructor ($class) { - $this->__construct($class); - } - - // Tiefgang entfernen - public function removeDraught () { - if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Tiefgang wird entfernt.
\n", - $this->__toString() - )); - unset($this->draught); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/constructions/docks/.htaccess b/ship-simu/application/ship-simu/main/constructions/docks/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/constructions/docks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/constructions/docks/class_DryDock.php b/ship-simu/application/ship-simu/main/constructions/docks/class_DryDock.php deleted file mode 100644 index b0f19e6..0000000 --- a/ship-simu/application/ship-simu/main/constructions/docks/class_DryDock.php +++ /dev/null @@ -1,41 +0,0 @@ -getDebugInstance()->output("[DryDock:] Konstruktor erreicht.
\n"); - - // Eltern-Konstruktor aufrufen - parent::constructor(__CLASS__); - - // Beschreibung setzen - $this->setPartDescr("Trockendock"); - - // Unique-ID erzeugen - $this->createUniqueID(); - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/constructions/harbors/.htaccess b/ship-simu/application/ship-simu/main/constructions/harbors/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/constructions/harbors/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/constructions/harbors/class_Harbor.php b/ship-simu/application/ship-simu/main/constructions/harbors/class_Harbor.php deleted file mode 100644 index 1839754..0000000 --- a/ship-simu/application/ship-simu/main/constructions/harbors/class_Harbor.php +++ /dev/null @@ -1,116 +0,0 @@ -getDebugInstance()->output("[Harbor:] Konstruktor erreicht.
\n"); - - // Beschreibung setzen - $this->setPartDescr("Hafen"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - $this->removePartInstance(); - } - - // Creates a harbor - public static function createHarbor ($harborName) { - // Hafen-Instanz holen - $harborInstance = new Harbor(); - - // Debug message - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $harborInstance->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen %s wird konstruiert.
\n", $harborName)); - - // Hafenname setzen - $harborInstance->setHarborName($harborName); - - // Werftliste initialisieren - $harborInstance->createshipyardList(); - - // Debug-Meldung ausgeben - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $harborInstance->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen %s ist jetzt fertig gebaut.
\n", $harborName)); - - // Instanz zurueckliefern - return $harborInstance; - } - - // Werft-Liste generieren - public function createshipyardList () { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Werft-Liste wird für den Hafen %s erstellt.
\n", - $this->getHarborName() - )); - $this->shipyardList = new FrameworkArrayObject(); - } - - // Setter fuer Hafennamen - public function setHarborName ($harborName) { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Der Hafen heisst jetzt %s.
\n", $harborName)); - $this->harborName = (string) $harborName; - } - - // Getter fuer Hafennamen - public function getHarborName () { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Hafenname %s wurde angefordert.
\n", $this->harborName)); - return $this->harborName; - } - - // Werft in den Hafen einbauen und Werft->Reederei zuweisen - public function addNewShipyardNotify ($shipyardName, ShippingCompany $companyInstance) { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Die Werft %s wird im Hafen %s gebaut.
\n", - $shipyardName, $this->getHarborName() - )); - - // Werft generieren und in die Werftliste aufnehmen - $this->shipyardList->append(Shipyard::createShipyardNotify($this, $shipyardName, $companyInstance)); - } - - // Werft in den Hafen einbauen ohne Zuweisung einer Reederei (gehoert der "Stadt" dann) - public function addNewShipyard ($shipyardName) { - if ((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[Harbor:] Die Werft %s wird im Hafen %s gebaut.
\n", - $shipyardName, $this->getHarborName() - )); - - // Werft generieren und in die Werftliste aufnehmen - $this->shipyardList->append(Shipyard::createShipyard($this, $shipyardName)); - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/constructions/terminals/.htaccess b/ship-simu/application/ship-simu/main/constructions/terminals/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/constructions/terminals/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/constructions/terminals/class_Terminal.php b/ship-simu/application/ship-simu/main/constructions/terminals/class_Terminal.php deleted file mode 100644 index ca61501..0000000 --- a/ship-simu/application/ship-simu/main/constructions/terminals/class_Terminal.php +++ /dev/null @@ -1,46 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Eltern-Konstruktor aufrufen - parent::constructor(__CLASS__); - - // Beschreibung setzen - $this->setPartDescr("Anlegebrücke"); - - // Unique-ID erzeugen - $this->createUniqueID(); - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/constructions/yards/.htaccess b/ship-simu/application/ship-simu/main/constructions/yards/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/constructions/yards/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/constructions/yards/class_Shipyard.php b/ship-simu/application/ship-simu/main/constructions/yards/class_Shipyard.php deleted file mode 100644 index 9d555dd..0000000 --- a/ship-simu/application/ship-simu/main/constructions/yards/class_Shipyard.php +++ /dev/null @@ -1,241 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Werft"); - - // Staff-Liste/Schiffstyp-Liste erzeugen - $this->createStaffList(); - $this->createShipTypeList(); - - // Unique-ID erzeugen - $this->createUniqueID(); - } - - // Create a shipyard and notify it about it's owner - public static function createShipyardNotify (Harbor $harborInstance, $shipyardName, ShippingCompany $companyInstance) { - // Werft-Instanz holen - $shipyardInstance = self::createShipyard($harborInstance, $shipyardName); - - // Reederei der Werft zuweisen - $shipyardInstance->setCompanyInstance($companyInstance); - - // Die Reederei ueber ihre Werft informieren - $companyInstance->addNewShipyard($shipyardInstance); - - // Instanz zurueckgeben - return $shipyardInstance; - } - - // Create a shipyard, first we need to create a harbor - public final static function createShipyard (Harbor $harborInstance, $shipyardName) { - // Instanz temporaer holen - $shipyardInstance = new Shipyard(); - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Werft mit dem Namen %s wird im Hafen %s konstruiert.
\n", - __CLASS__, - __LINE__, - $shipyardName, - $harborInstance->getHarborName() - )); - - // Werft-Name setzen - $shipyardInstance->setShipyardName($shipyardName); - - // Hafen-Instanz setzen - $shipyardInstance->setHarborInstance($harborInstance); - - // Abmasse setzen in Meter - $shipyardInstance->setWidth(30); - $shipyardInstance->setHeight(30); - $shipyardInstance->setLength(100); - - // Etwas aufraeumen - $shipyardInstance->removeDraught(); - $shipyardInstance->removeSystemArray(); - - // Debug-Meldung - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $shipyardInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s wurde gebaut.
\n", - __CLASS__, - __LINE__, - $shipyardName - )); - - // Instanz zurueckliefern - return $shipyardInstance; - } - - // Create staff list - private function createStaffList () { - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s erhält eine Arbeiterliste.
\n", - __CLASS__, - __LINE__, - $this->getShipyardName() - )); - $this->staffList = new FrameworkArrayObject(); - } - - // Create ship type list - private function createShipTypeList () { - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s erhält eine Typenliste.
\n", - __CLASS__, - __LINE__, - $this->getShipyardName() - )); - $this->shipTypeList = new FrameworkArrayObject(); - } - - // Setter-Methode fuer Werft-Name - public function setShipyardName ($shipyardName) { - $this->shipyardName = (string) $shipyardName; - } - - // Getter-Methode fuer Werft-Name - public function getShipyardName () { - return $this->shipyardName; - } - - // Setter-Methode fuer Hafen-Instanz - public function setHarborInstance (Harbor $harborInstance) { - $this->harborInstance = $harborInstance; - } - - // Getter-Methode fuer Hafen-Instanz - public function getHarborInstance () { - return $this->harborInstance; - } - - // Setter fuer Reederei-Instanz - public function setCompanyInstance (ShippingCompany $companyInstance) { - $this->shippingCompany = $companyInstance; - } - - // Getter fuer Reederei-Instanz - public function getCompanyInstance () { - return $this->shippingCompany; - } - - // Add new personell - public function addNewPersonell ($personell) { - if (is_null($this->staffList)) { - // Opps, not initialized! - ApplicationEntryPoint::app_die("New personell:
".print_r($this, true)."
"); - } - - // Add to list - $this->staffList->append($personell); - } - - // Add a new ship type to our list - public function addNewConstructableShipType ($shipType) { - // This must be a string! - $shipType = (string) $shipType; - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s kann bald Schiffe vom Typ %s bauen.
\n", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Add to list - $this->shipTypeList->append($shipType); - } - - // Is the specified ship type in our list? - public function isShipTypeConstructable ($shipType) { - // First we can't build this ship - $result = false; - - // This must be a string! - $shipType = (string) $shipType; - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s prüft, ob Schiffe vom Typ %s baubar sind.
\n", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Iterate through all types - for ($idx = $this->shipTypeList->getIterator(); $idx->valid(); $idx->next()) { - // Get current ship type - $type = (string) $idx->current(); - - // Is both the same? - $result = ($type == $shipType); - - // Type is found? - if ($result) break; // Then abort the search! - } - - // Debug message - if ((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Werft %s hat die Suche nach dem Schiffstyp %s abgeschlossen.
\n", - __CLASS__, - __LINE__, - $this->getShipyardName(), - $shipType - )); - - // Return result - return $result; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/drives/.htaccess b/ship-simu/application/ship-simu/main/drives/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/drives/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/drives/class_BaseDrive.php b/ship-simu/application/ship-simu/main/drives/class_BaseDrive.php deleted file mode 100644 index 7ebef58..0000000 --- a/ship-simu/application/ship-simu/main/drives/class_BaseDrive.php +++ /dev/null @@ -1,74 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Namenloser Antrieb"); - - // Etwas aufraeumen - $this->removeNumberFormaters(); - $this->removePartInstance(); - } - - // Konstruktor aufrufen - public function constructor ($class) { - $this->__construct($class); - } - - // Setter-Methode fuert PS-Zahl - public function setHorsePower ($hp) { - if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Antriebsleistung wird auf %d PS gesetzt.
\n", - __CLASS__, - __LINE__, - $hp - )); - $this->horsePower = (int) $hp; - } - - // Setter-Methode fuer Nockenanzahl - public function setNumCams ($cams) { - if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Nockenanzahl wird auf %d Nocken gesetzt.
\n", - __CLASS__, - __LINE__, - $cams - )); - $this->numCams = (int) $cams; - } - - // Setter for price - public function setPrice ($price) { - $this->price = (float) $price; - } - - // Getter for price - public function getPrice () { - return $this->price; - } - - public function removePrice () { - unset($this->price); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/drives/motor/.htaccess b/ship-simu/application/ship-simu/main/drives/motor/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/drives/motor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/drives/motor/class_Motor.php b/ship-simu/application/ship-simu/main/drives/motor/class_Motor.php deleted file mode 100644 index 0af6b97..0000000 --- a/ship-simu/application/ship-simu/main/drives/motor/class_Motor.php +++ /dev/null @@ -1,78 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Namenloser Motor"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Einen Motor erstellen - public static function createMotor ($descr, $hp, $cams, $w, $h, $l) { - // Instanz holen - $motorInstance = new Motor(); - - // Debug message - if ((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) $motorInstance->getDebugInstance()->output(sprintf("[%s:%d] Motor %s wird gebaut...
\n", - __CLASS__, - __LINE__, - $descr - )); - - // Beschreibung und Abmasse setzen - $motorInstance->setPartDescr($descr); - $motorInstance->setWidth($w); - $motorInstance->setHeight($h); - $motorInstance->setLength($l); - - // Weitere Daten setzen - $motorInstance->setHorsePower($hp); - $motorInstance->setNumCams($cams); - - // Instanz zurueckgeben - return $motorInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/parts/.htaccess b/ship-simu/application/ship-simu/main/parts/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/parts/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/parts/class_BaseShipPart.php b/ship-simu/application/ship-simu/main/parts/class_BaseShipPart.php deleted file mode 100644 index 4ce775f..0000000 --- a/ship-simu/application/ship-simu/main/parts/class_BaseShipPart.php +++ /dev/null @@ -1,50 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d:] Kontruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung - $this->setPartDescr("Schiffsteil"); - - // Etwas aufraeumen - $this->removeNumberFormaters(); - } - - // Konstruktor aufrufen - public function constructor ($class) { - $this->__construct($class); - } - - // Setter for price - public function setPrice ($price) { - $this->price = (float) $price; - } - - // Getter for price - public function getPrice () { - return $this->price; - } - - // Remove price - public function removePrice () { - unset($this->price); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/parts/maschineroom/.htaccess b/ship-simu/application/ship-simu/main/parts/maschineroom/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/parts/maschineroom/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php b/ship-simu/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php deleted file mode 100644 index 0e3f472..0000000 --- a/ship-simu/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php +++ /dev/null @@ -1,67 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Maschinenraum"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Maschinenraum erstellen - public static function createMaschineRoom () { - // Instanz holen - $roomInstance = new MaschineRoom(); - - // Debug message - if ((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) $roomInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Maschinenraum wird konstruiert.
\n", - __CLASS__, - __LINE__ - )); - - // Umrechnungsfaktoren setzen - $roomInstance->setResizeFactorElement('width' , 1.3); - $roomInstance->setResizeFactorElement('height', 1.8); - $roomInstance->setResizeFactorElement('length', 1.3); - - // Instanz zurueckgeben - return $roomInstance; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/personell/.htaccess b/ship-simu/application/ship-simu/main/personell/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/personell/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/personell/class_SimulatorPersonell.php b/ship-simu/application/ship-simu/main/personell/class_SimulatorPersonell.php deleted file mode 100644 index 8581536..0000000 --- a/ship-simu/application/ship-simu/main/personell/class_SimulatorPersonell.php +++ /dev/null @@ -1,467 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Set description - $this->setPartDescr("Simulationspersonal"); - - // Create unique ID - $this->createUniqueID(); - - // Clean-up a little - $this->removeSystemArray(); - } - - /** - * Magic wake-up method called when unserialize() is called. This is - * neccessary because in this case a personell does not need to know the - * min/max ages range and system classes. This would anyway use more RAM - * what is not required. - * - * @return void - */ - public function __wakeup () { - // Tidy up a little - $this->removePersonellList(); - $this->removeMinMaxAge(); - $this->removeCache(); - $this->removeSystemArray(); - } - - /** - * Generate a specified amount of personell and return the prepared instance - * - * @param $amountPersonell Number of personell we shall - * generate - * @return $personellInstance An instance of this object with a - * list of personells - */ - public static function createSimulatorPersonell ($amountPersonell) { - // Make sure only integer can pass - $amountPersonell = (int) $amountPersonell; - - // Get a new instance - $personellInstance = new SimulatorPersonell(); - - // Generate unique ID number - $personellInstance->createUniqueID(); - - // Debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Es werden %d Personal bereitgestellt.
\n", - __CLASS__, - __LINE__, - $amountPersonell - )); - - // Initialize the personell list - $personellInstance->createPersonellList(); - - // Create requested amount of personell - for ($idx = 0; $idx < $amountPersonell; $idx++) { - $personellInstance->addPersonell(); - } - - // Debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] %d Personal bereitgestellt.
\n", - __CLASS__, - __LINE__, - $amountPersonell - )); - - // Tidy up a little - $personellInstance->removeGender(); - $personellInstance->removeNames(); - $personellInstance->removeBirthday(); - $personellInstance->removeSalary(); - $personellInstance->removeEmployed(); - $personellInstance->removeMarried(); - $personellInstance->removeNumberFormaters(); - //$personellInstance->removeCache(); - $personellInstance->removeSystemArray(); - - // Instanz zurueckgeben - return $personellInstance; - } - - /** - * Create a SimulatorPersonell object by loading the specified personell - * list from an existing database backend - * - * @param $idNumber The ID number (only right part) of the list - * @return $personellInstance An instance of - * @throws InvalidIDFormatException If the given id number - * $idNumber is invalid - * @throws NullPointerException If a null pointer (instance) - * has been returned. - * @throws NoObjectException If a non-object has been - * returned - * @throws MissingMethodException If a required method is missing - * @throws MissingSimulatorIDException If an ID number was not found - */ - public final static function createSimulatorPersonellByID ($idNumber) { - // Add the class name if it was not found - if (count(explode("@", $idNumber)) < 2) { - // Add class name in front of the incomplete ID number - $tempID = sprintf("%s@%s", __CLASS__, $idNumber); - } else { - // Use the direct ID number - $tempID = $idNumber; - } - - // Validate the ID number - if (!preg_match(sprintf("/%s\@([a-f0-9]){32}/i", __CLASS__), $tempID)) { - // Invalid format - throw new InvalidIDFormatException(new SimulatorPersonell(), self::EXCEPTION_ID_IS_INVALID_FORMAT); - } - - // Get instance - $personellInstance = new SimulatorPersonell(false); - - // Get database instance - $dbInstance = $personellInstance->getDatabaseInstance(); - - // Is this a valid database instance? - if (is_null($dbInstance)) { - // No class returned - throw new NullPointerException($personellInstance, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($dbInstance)) { - // Not an object! ;-( - throw new NoObjectException($dbInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($dbInstance, 'isUniqueIdUsed')) { - // Required method not found - throw new MissingMethodException(array($dbInstance, 'isUniqueIdUsed'), self::EXCEPTION_MISSING_METHOD); - } - - // Is the unique ID already used? Then it must be there! - if (!$dbInstance->isUniqueIdUsed($tempID)) { - // Entry not found! - throw new MissingSimulatorIDException(array($personellInstance, $idNumber), self::EXCEPTION_SIMULATOR_ID_INVALID); - } - - // Load the personell list and add it to this object - $personellInstance->loadPersonellList($tempID); - - // Clean-up a little - $personellInstance->removeGender(); - $personellInstance->removeNames(); - $personellInstance->removeBirthday(); - $personellInstance->removeSalary(); - $personellInstance->removeEmployed(); - $personellInstance->removeMarried(); - $personellInstance->removeNumberFormaters(); - //$personellInstance->removeCache(); - $personellInstance->removeSystemArray(); - - // Return instance - return $personellInstance; - } - - // Create personell list - public function createPersonellList () { - if (is_null($this->personellList)) { - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Personell-Liste erstellt.
\n", - __CLASS__, - __LINE__ - )); - $this->personellList = new FrameworkArrayObject(); - } else { - throw new PersonellListAlreadyCreatedException($this, self::EXCEPTION_DIMENSION_ARRAY_INVALID); - } - } - - // Remove the personell list - private function removePersonellList () { - if (defined('DEBUG_PERSONELL')) $this->getDebugInstance()->output(sprintf("[%s:%d] Personell-Liste entfernt.
\n", - __CLASS__, - __LINE__ - )); - unset($this->personellList); - } - - // Add new personell object to our list - public function addPersonell () { - // Gender list... - $genders = array('M', 'F'); - - // Create new personell members - $personellInstance = new SimulatorPersonell(); - - // Set a randomized gender - $personellInstance->setGender($genders[mt_rand(0, 1)]); - - // Set a randomized birthday (maximum age required, see const MAX_AGE) - $personellInstance->createBirthday(); - - // Married? Same values means: married - if (mt_rand(0, 5) == mt_rand(0, 5)) $personellInstance->setMarried(true); - - // Tidy up a little - $personellInstance->removePersonellList(); - $personellInstance->removeMinMaxAge(); - $personellInstance->removeCache(); - $personellInstance->removeSystemArray(); - - // Add new member to the list - $this->personellList->append($personellInstance); - } - - /** - * Get a specifyable list of our people, null or empty string will be ignored! - * - * @return $cacheList A list of cached personells - */ - function getSpecialPersonellList ($isEmployed = null, $isMarried = null, $hasGender = "") { - // Serialize the conditions for checking if we can take the cache - $serialized = serialize(array($isEmployed, $isMarried, $hasGender)); - - // The same (last) conditions? - if (($serialized == $this->cacheCond) && (!is_null($this->cacheCond))) { - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Gecachte Liste wird verwendet.
\n", - __CLASS__, - __LINE__ - )); - - // Return cached list - return $this->cacheList; - } - - // Output debug message - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Personalliste wird nach Kriterien durchsucht...
\n", - __CLASS__, - __LINE__ - )); - - // Remember the conditions - $this->setCacheCond($serialized); - - // Create cached list - $this->setAllCacheList(new FrameworkArrayObject()); - - // Search all unemployed personells - for ($idx = $this->personellList->getIterator(); $idx->valid(); $idx->next()) { - // Element holen - $el = $idx->current(); - - // Check currenylt all single conditions (combined conditions are not yet supported) - if ((!is_null($isEmployed)) && ($el->isEmployed() == $isEmployed)) { - // Add this one (employed status asked) - $this->cacheList->append($el); - } elseif ((!is_null($isMarried)) && ($el->isMarried() == $isMarried)) { - // Add this one (marrital status asked) - $this->cacheList->append($el); - } elseif ((!empty($hasGender)) && ($el->getGender() == $hasGender)) { - // Add this one (specified gender) - $this->cacheList->append($el); - } - } - - // Return the completed list - return $this->cacheList; - } - - /** - * Get amount of unemployed personell - * - * @return $count Amount of unemployed personell - */ - public function getAllUnemployed () { - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Es werden alle erwerbslosen Personen gesucht.
\n", - __CLASS__, - __LINE__ - )); - - // Get a temporary list - $list = $this->getSpecialPersonellList(false); - - // Anzahl zurueckliefern - return $list->count(); - } - - /** - * Remove cache things - * - * @return void - */ - private function removeCache () { - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Cache-Attribute entfernt.
\n", - __CLASS__, - __LINE__ - )); - - // Remove cache data - unset($this->cacheList); - unset($this->cacheCond); - } - - /** - * Setter for cache list - * - * @param $cacheList The new cache list to set or null for initialization/reset - * @return void - */ - private function setAllCacheList (FrameworkArrayObject $cacheList = null) { - $this->cacheList = $cacheList; - } - - /** - * Setter for cache conditions - * - * @param $cacheCond The new cache conditions to set - * @return void - */ - private function setCacheCond ($cacheCond) { - $this->cacheCond = (string) $cacheCond; - } - - /** - * Reset cache list - * - * @return void - */ - public function resetCache () { - if ((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Cache-Liste zurückgesetzt.
\n", - __CLASS__, - __LINE__ - )); - $this->setAllCacheList(null); - $this->setCacheCond(""); - } - - /** - * Getter for surname. If no surname is set then default surnames are set - * for male and female personells. - * - * @return $surname The personell' surname - */ - public final function getSurname () { - $surname = parent::getSurname(); - // Make sure every one has a surname... - if (empty($surname)) { - if ($this->isMale()) { - // Typical male name - $surname = "John"; - } else { - // Typical female name - $surname = "Jennifer"; - } - - // Set typical family name - parent::setFamily("Smith"); - } - return $surname; - } - - /** - * Saves only the personell list to the database - * - * @return void - */ - public function saveObjectToDatabase () { - // Get the database - $dbInstance = $this->getDatabaseInstance(); - - // Prepare the limitation object. We just need the personellList array object. - $limitInstance = ObjectLimits::createObjectLimits(array("personellList")); - - // Limitate the saving amount - $dbInstance->limitObject($limitInstance); - - // Save this object - $dbInstance->saveObject($this); - } - - /** - * Getter for personell list - * - * @return $personellList The list of all personells - */ - public function getPersonellList () { - return $this->personellList; - } - - /** - * Loads the mostly pre-cached personell list - * - * @param $idNumber The ID number we shall use for looking up - * the right data. - * @return void - * @throws ContainerItemIsNullException If a container item is null - * @throws ContainerItemIsNoArrayException If a container item is - * not an array - * @throws ContainerMaybeDamagedException If the container item - * is missing the indexes - * 'name' and/or 'value' - * @see SerializationContainer A special container class which - * helps storing only some attributes - * of a class. - */ - public function loadPersonellList ($idNumber) { - // Get database instance - $dbInstance = $this->getDatabaseInstance(); - - // Get the serialization container within the personell list from - // the database layer - $containerInstance = $dbInstance->getObjectFromCachedData($idNumber); - - // Iterate through the whole container - for ($idx = $containerInstance->getIterator(); $idx->valid(); $idx->next()) { - // Get current item from container - $item = $idx->current(); - - // Validate it a bit - if (is_null($item)) { - // Is null - throw new ContainerItemIsNullException($this, self::EXCEPTION_CONTAINER_ITEM_IS_NULL); - } elseif (!is_array($item)) { - // Is not an array - throw new ContainerItemIsNoArrayException($this, self::EXCEPTION_ITEM_IS_NO_ARRAY); - } elseif ((!isset($item['name'])) || (!isset($item['value']))) { - // Missing elements - throw new ContainerMaybeDamagedException($this, self::EXCEPTION_CONTAINER_MAYBE_DAMAGED); - } - - // Okay, now we can get the item and generate a valid command for eval(). - // We need to convert the first letter to lower-case but keep all others intact - $eval = sprintf("\$this->%s = \$item['value'];", - strtolower(substr($item['name'], 0, 1)) - . - substr($item['name'], 1) - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruierte PHP-Anweisung:
%s

\n", - __CLASS__, - __LINE__, - htmlentities($eval) - )); - - // Run the command - @eval($eval); - } - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/personell/company/.htaccess b/ship-simu/application/ship-simu/main/personell/company/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/personell/company/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/personell/company/class_CompanyEmployee.php b/ship-simu/application/ship-simu/main/personell/company/class_CompanyEmployee.php deleted file mode 100644 index 1ea8ab2..0000000 --- a/ship-simu/application/ship-simu/main/personell/company/class_CompanyEmployee.php +++ /dev/null @@ -1,102 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Firmenangestellte(r)"); - - // Create unique ID - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Generate a specified amount of personell - public static function createCompanyEmployee ($surname, $family, $gender, $year, $month, $day, $married, $salary) { - // Get instance - $personellInstance = new CompanyEmployee(); - - // Debug message - if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) { - $personellInstance->getDebugInstance()->output(sprintf("[%s:%d] Der/Die Angestellte %s %s wird angelegt.
\n", - __CLASS__, - __LINE__, - $surname, - $family - )); - } - - // Ist the given birthday valid? - if ($personellInstance->isDateValid($year, $month, $day)) { - // Set birthday - $personellInstance->setBirthday($year, $month, $day); - } else { - // Something is wrong ... - throw new BirthdayInvalidException(array($year, $month, $day), self::EXCEPTION_BIRTH_DATE_IS_INVALID); - } - - // Set as employed/marrital status - $personellInstance->setEmployed(true); - $personellInstance->setMarried($married); - - // Set surname/family/gender - $personellInstance->setSurname($surname); - $personellInstance->setFamily($family); - $personellInstance->setGender($gender); - - // Set salary - $personellInstance->increaseSalary($salary); - - // Tidy up a little - $personellInstance->removeEmployeeList(); - $personellInstance->removeMinMaxAge(); - - // Return prepared instance - return $personellInstance; - } - - // Remove the employee list - private function removeEmployeeList () { - if (((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) { - $this->getDebugInstance()->output(sprintf("[%s:%d] Angestellten-List entfernt.
\n", - __CLASS__, - __LINE__ - )); - } - unset($this->employeeList); - } - - /** - * Call parent method - */ - public function saveObjectToDatabase () { - parent::saveObjectToDatabase(); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - parent::limitObject($limitInstance); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/ships/.htaccess b/ship-simu/application/ship-simu/main/ships/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/ships/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/ships/class_BaseShip.php b/ship-simu/application/ship-simu/main/ships/class_BaseShip.php deleted file mode 100644 index 65e4da0..0000000 --- a/ship-simu/application/ship-simu/main/ships/class_BaseShip.php +++ /dev/null @@ -1,233 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Bezeichnung setzen - $this->setPartDescr("Schiff"); - - // Array-Objekt generieren - $this->createStructuresArray(); - - // Instanz entfernen - $this->removePartInstance(); - $this->removeNumberFormaters(); - } - - // Konstruktor aufrufen - public function constructor ($class) { - $this->__construct($class); - } - - // Array-Objekt anlegen - private function createStructuresArray () { - $this->structures = new FrameworkArrayObject(); - } - - // Schiffsteil generieren (kann alles sein) - // buildInstance = Das was in das Schiffsteil evtl. eingebaut werden soll (null = kein besonderes Teil einbauen!) - // partClass = Das zu konstruierende Schiffsteil - public function createShipPart (ConstructableShipPart $buildInstance, $partClass) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s erhält ein neues Schiffsteil (%s).
\n", - __CLASS__, - __LINE__, - $this->getShipName(), - $partClass - )); - - // Ist die gewuenschte Klasse vorhanden? - if (class_exists($partClass)) { - // Befehl zusammenbauen - $eval = sprintf("\$partInstance = %s::create%s();", - $partClass, $partClass - ); - - // Debug-Meldung ausgeben - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruierte PHP-Anweisung:
%s

\n", - __CLASS__, - __LINE__, - htmlentities($eval) - )); - - // ... und ausfuehren - eval($eval); - } else { - // Nicht vorhanden, dann Ausnahme werfen! - throw new ClassNotFoundException($partClass, 0); - } - - // Das Einbauen versuchen... - try { - $partInstance->addShipPartToShip($this, $buildInstance); - } catch (MotorShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keinen Motor erhalten! Grund: %s
\n", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - } catch (RoomShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keinen Maschinenraum erhalten! Grund: %s
\n", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - - } catch (StructureShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keine Aufbauten erhalten! Grund: %s
\n", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - } catch (CabinShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat keine Kabine erhalten! Grund: %s
\n", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - } catch (DeckShipMismatchException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat kein Deck erhalten! Grund: %s
\n", - __CLASS__, - __LINE__, - $this->getShipName(), - $e->getMessage() - )); - return false; - } catch (ExceptionNotChangedException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Eine Exception wurde nicht geändert. Details: %s
\n", - __CLASS__, - __LINE__, - $e->getMessage() - )); - return false; - } catch (ExceptionNotFoundException $e) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Eine Exception wurde nicht gefunden. Details: %s
\n", - __CLASS__, - __LINE__, - $e->getMessage() - )); - return false; - } - - // Instanz im Aufbauten-Array vermerken - $this->structures->append($partInstance); - - // Debug-Meldung ausgeben - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiff %s hat das Schiffsteil %s eingebaut bekommen.
\n", - __CLASS__, - __LINE__, - $this->getShipName(), - $partInstance->getPartDescr() - )); - - // Alles klar! - return true; - } - - // Getter-Methode fuer Strukturen-Array - public function getStructuresArray () { - return $this->structures; - } - - // STUB: Getter-Methode Anzahl Betten - public function calcTotalBeds () { - $this->getDebugInstance()->output("[%s:%d] Stub! Anzahl Betten erreicht.
\n"); - return 0; - } - - // Setter-Methode fuer Schiffsnamen - public function setShipName ($shipName) { - // Cast the string - $shipName = (string) $shipName; - - // Debug message - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das neue Schiff vom Typ %s wird auf den Namen %s getauft.
\n", - __CLASS__, - __LINE__, - $this->__toString(), - $shipName - )); - - // Set ship name - $this->shipName = $shipName; - } - - // Getter-Methode fuer Schiffsnamen - public function getShipName () { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das %s ist auf den Namen %s getauft worden.
\n", - __CLASS__, - __LINE__, - $this->__toString(), - $this->shipName - )); - return $this->shipName; - } - - // Setter-Methode fuer Tiefgang - public function setDraught ($draught) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das %s mit dem Namen %s hat einen Tiefgang von %sm.
\n", - __CLASS__, - __LINE__, - $this->__toString(), - $this->shipName, - $draught - )); - $this->draught = (int) $draught; - } - - // Getter-Methode fuer Tiefgang - public function getDraught() { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Der Tiefgang des Schiffes %s wurde angefordert.
\n", - __CLASS__, - __LINE__, - $this->shipName - )); - return $this->draught; - } - - // Setter-Methode fuer Anzahl Anker - public function setNumAnchor ($numAnchor) { - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das %s mit dem Namen %s hat %s Anker.
\n", - __CLASS__, - __LINE__, - $this->__toString(), - $this->shipName, - $numAnchor - )); - $this->numAnchor = (int) $numAnchor; - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/ships/passenger/.htaccess b/ship-simu/application/ship-simu/main/ships/passenger/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/ships/passenger/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/ships/passenger/class_PassengerShip.php b/ship-simu/application/ship-simu/main/ships/passenger/class_PassengerShip.php deleted file mode 100644 index de78050..0000000 --- a/ship-simu/application/ship-simu/main/ships/passenger/class_PassengerShip.php +++ /dev/null @@ -1,130 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Passagier-Schiff"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Passagier-Schiff erstellen - public static function createPassengerShip ($shipName) { - // Instanz holen - $passInstance = new PassengerShip(); - - // Debug message - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) { - $passInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Passagier-Schiff wird erstellt.
\n", - __CLASS__, - __LINE__ - )); - } - - // Set ship's name - $passInstance->setShipName($shipName); - - // Instanz zurueckgeben - return $passInstance; - } - - // Anzahl Betten ermitteln - final function calcTotalBeds () { - // Struktur-Array holen - $struct = $this->getStructuresArray(); - - if (is_null($struct)) { - // Empty structures list! - throw new EmptyStructuresListException($this, self::EXCEPTION_EMPTY_STRUCTURES_ARRAY); - } - - // Anzahl Betten auf 0 setzen - $numBeds = 0; - - // Alle Strukturen nach Kabinen durchsuchen - for ($idx = $struct->getIterator(); $idx->valid(); $idx->next()) { - // Element holen - $el = $idx->current(); - - // Ist es eine Kabine? - if ($el->isCabin()) { - // Anzahl Betten ermitteln - $total = $el->calcTotalBedsByCabin(); - $numBeds += $total; - - // Debug-Meldung ausgeben? - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) { - // Instanz holen - $cabType = "Kabine ohne Namen"; - $cab = $el->getPartInstance(); - if (!is_null($cab)) { - // Kabinenbeschreibung holen - $cabType = $cab->getPartDescr(); - } - - // Debug-Meldung ausgeben - $this->getDebugInstance()->output(sprintf("[%s:%d] Es stehen %d Betten vom Kabinen-Typ %s bereit.
\n", - __CLASS__, - __LINE__, - $total, - $cabType - )); - } - } else { - // Keine Kabine! - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %s ist keine Kabine.
\n", - __CLASS__, - __LINE__, - $el->getPartDescr() - )); - } - } - - if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das %s mit dem Namen %s hat %d Betten.
\n", - __CLASS__, - __LINE__, - $this->getPartDescr(), - $this->getShipName(), - $numBeds - )); - - // Anzahl zurueckliefern - return $numBeds; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/.htaccess b/ship-simu/application/ship-simu/main/structures/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/structures/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/structures/class_BaseStructure.php b/ship-simu/application/ship-simu/main/structures/class_BaseStructure.php deleted file mode 100644 index 3e8d3f0..0000000 --- a/ship-simu/application/ship-simu/main/structures/class_BaseStructure.php +++ /dev/null @@ -1,49 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Schiffsstrukturen"); - - // Etwas aufraeumen - $this->removeNumberFormaters(); - } - - // Konstruktor aufrufen - public function constructor ($class) { - $this->__construct($class); - } - - // Setter for price - public function setPrice ($price) { - $this->price = (float) $price; - } - - // Getter for price - public function getPrice () { - return $this->price; - } - - // Remove price - public function removePrice () { - unset($this->price); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/.htaccess b/ship-simu/application/ship-simu/main/structures/extended/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/structures/extended/cabines/.htaccess b/ship-simu/application/ship-simu/main/structures/extended/cabines/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/cabines/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php b/ship-simu/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php deleted file mode 100644 index a70be56..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php +++ /dev/null @@ -1,73 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Kabine"); - - // Maybe clean up a little - if ($class == __CLASS__) { - $this->removeSystemArray(); - } - } - - // Konstruktor aufrufen - public function constructor ($class) { - $this->__construct($class); - } - - // Allgemeine Kabine erstellen - public static function createBaseCabin () { - // Instanz holen - $cabinInstance = new BaseCabin(__CLASS__); - - // Debug message - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $cabinInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine allgemeine Kabine wird erstellt.
\n", - __CLASS__, - __LINE__ - )); - - // Unique-ID erzeugen - $cabinInstance->createUniqueID(); - - // Instanz zurueckgeben - return $cabinInstance; - } - - // Is this a cabin? - public function isCabin () { - return ($this->isClass("BaseCabin")); - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/.htaccess b/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php b/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php deleted file mode 100644 index bc1bde2..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_EconomyCabin.php +++ /dev/null @@ -1,97 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Economy-Class-Kabine"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Economy-Kabine erstellen - public static function createEconomyCabin ($numLuxury, $numRooms, $numBeds, $dim) { - // Instanz holen - $ecoInstance = new EconomyCabin(); - - // Debug message - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $ecoInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Economy-Class-Kabine wird konstruiert...
\n", - __CLASS__, - __LINE__ - )); - - // Abmasse extrahieren - $ecoInstance->extractDimensions($dim); - - // Den Rest auch setzen - $ecoInstance->setNumCabin($numLuxury); - $ecoInstance->setNumRooms($numRooms); - $ecoInstance->setNumBeds($numBeds); - - // Nicht noetig! - $ecoInstance->removePartInstance(); - - // Instanz zurueckgeben - return $ecoInstance; - } - - // Loesch-Methode fuer Anzahl Betten - public function removeNumBeds() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numBeds); - parent::removeNumBeds(); - } - - // Loesch-Methode fuer Anzahl Kabinen - public function removeNumCabin() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numCabin); - parent::removeNumCabin(); - } - - // Loesch-Methode fuer Anzahl Raeume - public function removeNumRooms() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numRooms); - parent::removeNumRooms(); - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php b/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php deleted file mode 100644 index 4c6d263..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_LowCabin.php +++ /dev/null @@ -1,95 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Beschreibung setzen - $this->setPartDescr("2Star-Class-Kabine"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // 2-Sterne-Klasse erstellen - public static function createLowCabin ($numLuxury, $numRooms, $numBeds, $dim) { - // Instanz holen - $lowInstance = new LowCabin(); - - // Debug message - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $lowInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine 2-Sterne-Kabine wird konstruiert...
\n", - __CLASS__, - __LINE__ - )); - - // Abmasse extrahieren - $lowInstance->extractDimensions($dim); - - // Den Rest auch setzen - $lowInstance->setNumCabin($numLuxury); - $lowInstance->setNumRooms($numRooms); - $lowInstance->setNumBeds($numBeds); - - // Nicht noetig! - $lowInstance->removePartInstance(); - - // Instanz zurueckgeben - return $lowInstance; - } - - // Loesch-Methode fuer Anzahl Betten - public function removeNumBeds() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numBeds); - parent::removeNumBeds(); - } - - // Loesch-Methode fuer Anzahl Kabinen - public function removeNumCabin() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numCabin); - parent::removeNumCabin(); - } - - // Loesch-Methode fuer Anzahl Raeume - public function removeNumRooms() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numRooms); - parent::removeNumRooms(); - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php b/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php deleted file mode 100644 index bc36d6e..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_LuxuryCabin.php +++ /dev/null @@ -1,95 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Beschreibung setzen - $this->setPartDescr("Luxuskabine"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Eine Luxuskabine erstellen - public static function createLuxuryCabin ($numLuxury, $numRooms, $numBeds, $dim) { - // Instanz holen - $luxuryInstance = new LuxuryCabin(); - - // Debug message - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $luxuryInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Luxuskabine wird konstruiert...
\n", - __CLASS__, - __LINE__ - )); - - // Abmasse extrahieren - $luxuryInstance->extractDimensions($dim); - - // Den Rest auch setzen - $luxuryInstance->setNumCabin($numLuxury); - $luxuryInstance->setNumRooms($numRooms); - $luxuryInstance->setNumBeds($numBeds); - - // Nicht noetig! - $luxuryInstance->removePartInstance(); - - // Instanz zurueckgeben - return $luxuryInstance; - } - - // Loesch-Methode fuer Anzahl Betten - public function removeNumBeds() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numBeds); - parent::removeNumBeds(); - } - - // Loesch-Methode fuer Anzahl Kabinen - public function removeNumCabin() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numCabin); - parent::removeNumCabin(); - } - - // Loesch-Methode fuer Anzahl Raeume - public function removeNumRooms() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numRooms); - parent::removeNumRooms(); - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php b/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php deleted file mode 100644 index 99b41b2..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/cabines/ship/class_PremierCabin.php +++ /dev/null @@ -1,92 +0,0 @@ -getDebugInstance()->output(sprintf("[PremierCabin:] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Beschreibung setzen - $this->setPartDescr("Premier-Class-Kabine"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Premier-Kabine erstellen - public static function createPremierCabin ($numLuxury, $numRooms, $numBeds, $dim) { - // Instanz holen - $premierInstance = new PremierCabin(); - - // Debug message - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $premierInstance->getDebugInstance()->output("[PremierCabin:] Eine Premier-Kabine wird konstruiert...
\n"); - - // Abmasse extrahieren - $premierInstance->extractDimensions($dim); - - // Den Rest auch setzen - $premierInstance->setNumCabin($numLuxury); - $premierInstance->setNumRooms($numRooms); - $premierInstance->setNumBeds($numBeds); - - // Nicht noetig! - $premierInstance->removePartInstance(); - - // Instanz zurueckgeben - return $premierInstance; - } - - // Loesch-Methode fuer Anzahl Betten - public function removeNumBeds() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numBeds); - parent::removeNumBeds(); - } - - // Loesch-Methode fuer Anzahl Kabinen - public function removeNumCabin() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numCabin); - parent::removeNumCabin(); - } - - // Loesch-Methode fuer Anzahl Raeume - public function removeNumRooms() { - if ((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numRooms); - parent::removeNumRooms(); - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/class_ b/ship-simu/application/ship-simu/main/structures/extended/class_ deleted file mode 100644 index 9644fd5..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/class_ +++ /dev/null @@ -1,7 +0,0 @@ - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - die("limitObject() reached! Stub!"); - } diff --git a/ship-simu/application/ship-simu/main/structures/extended/class_BaseCabinStructure.php b/ship-simu/application/ship-simu/main/structures/extended/class_BaseCabinStructure.php deleted file mode 100644 index 7d7d7fb..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/class_BaseCabinStructure.php +++ /dev/null @@ -1,186 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Kabinenstruktur"); - } - - // Konstruktor aufrufen - public function constructor ($class) { - $this->__construct($class); - } - - // Kabine hinzufuegen - public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $cabinInstance) { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Kabine %s wird für das Schiff %s konstruiert.
\n", - __CLASS__, - __LINE__, - $cabinInstance->getPartDescr(), - $shipInstance->getShipName() - )); - - // Eltern-Methode aufrufen - parent::addShipPartToShip ($shipInstance, $cabinInstance); - - // Restlichen Daten ebenfalls - $this->setNumCabin($cabinInstance->numCabin); - $this->setNumRooms($cabinInstance->numRooms); - $this->setNumBeds($cabinInstance->numBeds); - - // Unnoetige Attribute entfernen - $cabinInstance->removeNumCabin(); - $cabinInstance->removeNumRooms(); - $cabinInstance->removeNumBeds(); - - // Instanz setzen - $this->setDeckInstance($cabinInstance); - - // Einbaut-Meldung ausgeben - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Kabine %s wurde in das Schiff eingebaut.
\n", - __CLASS__, - __LINE__, - $cabinInstance->getPartDescr(), - $shipInstance->getShipName() - )); - } - - // Wrapper fuer setDeckInstance->setPartInstance - public function setDeckInstance ($deck) { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Wrapper setDeckInstance->setPartInstance erreicht.
\n", - __CLASS__, - __LINE__ - )); - parent::setPartInstance($deck); - } - - // Getter-Methode fuer Anzahl Betten - public function getNumBeds () { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Betten angefordert.
\n", - __CLASS__, - __LINE__, - $this->numBeds - )); - return $this->numBeds; - } - - // Getter-Methode fuer Anzahl Kabinen - public function getNumCabin () { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Kabine(n) angefordert.
\n", - __CLASS__, - __LINE__, - $this->numCabin - )); - return $this->numCabin; - } - - // Setter-Methode fuer Anzahl Betten - public function setNumBeds ($numBeds) { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Betten gesetzt.
\n", - __CLASS__, - __LINE__, - $numBeds - )); - $this->numBeds = $numBeds; - } - - // Setter-Methode fuer Anzahl Raeume - public function setNumRooms ($numRooms) { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Raum/Räume gesetzt.
\n", - __CLASS__, - __LINE__, - $numRooms - )); - $this->numRooms = $numRooms; - } - - // Setter-Methode fuer Anzahl Kabinen - public function setNumCabin ($numCabin) { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] %d Kabine(n) gesetzt.
\n", - __CLASS__, - __LINE__, - $numCabin - )); - $this->numCabin = $numCabin; - } - - // Loesch-Methode fuer Anzahl Betten - public function removeNumBeds() { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Betten gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numBeds); - } - - // Loesch-Methode fuer Anzahl Kabinen - public function removeNumCabin() { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Kabinen gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numCabin); - } - - // Loesch-Methode fuer Anzahl Raeume - public function removeNumRooms() { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Räume gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numRooms); - } - - // Bettenanzahl pro Kabine berechnen - public function calcTotalBedsByCabin () { - // Dann Bettenanzahl holen und aufaddieren - $beds = $this->getNumBeds(); - $num = $this->getNumCabin(); - $cabinBeds = $beds * $num; - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) { - // Instanz holen - $cabType = "Kabine ohne Namen"; - $cab = $this->getPartInstance(); - if (!is_null($cab)) { - // Kabinenbeschreibung holen - $cabType = $cab->__toString(); - } - - // Debug-Meldung ausgeben - $this->getDebugInstance()->output(sprintf("[%s:%d] Es exisitieren %d Kabinen vom Typ %s zu je %d Betten. Das sind %d Betten.
\n", - __CLASS__, - __LINE__, - $num, - $cabType, - $beds, - $cabinBeds - )); - } - return $cabinBeds; - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php b/ship-simu/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php deleted file mode 100644 index 1b225ca..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/class_BaseDeckStructure.php +++ /dev/null @@ -1,74 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Deckstruktur"); - } - - // Konstruktor aufrufen - public function constructor ($class) { - $this->__construct($class); - } - - // Deckstruktur dem Schiff hinzufuegen - public function addShipPartToShip (ConstructableShip $shipInstance, ConstructableShipPart $deckInstance) { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Deck %s wird für das Schiff %s konstruiert.
\n", - __CLASS__, - __LINE__, - $deckInstance->getPartDescr(), - $shipInstance->getShipName() - )); - - // Eltern-Methode aufrufen - parent::addShipPartToShip($shipInstance, $deckInstance); - - // Andere Daten uebertragen und von der Quelle loeschen - $this->setNumDecks($deckInstance->getNumDecks()); - $deckInstance->removeNumDecks(); - - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Deck %s wurde in das Schiff %s eingebaut.
\n", - __CLASS__, - __LINE__, - $deckInstance->getPartDescr(), - $shipInstance->getShipName() - )); - } - - // Deckanzahl entfernen - public function removeNumDecks() { - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gelöscht.
\n", - __CLASS__, - __LINE__ - )); - unset($this->numDecks); - } - - // Setter-Methode fuer Anzahl Decks - public function setNumDecks($numDecks) { - $this->numDecks = (int) $numDecks; - } - - // Getter-Methode fuer Anzahl Decks - public function getNumDecks() { - return $this->numDecks; - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php b/ship-simu/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php deleted file mode 100644 index 06bdf30..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/class_BaseUpperStructure.php +++ /dev/null @@ -1,76 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - } - - // Beschreibung setzen - $this->setPartDescr("Aufbauten"); - - // Shall we clean up? - if ($class == __CLASS__) { - $this->removeSystemArray(); - } - } - - /** - * Call new constructor - */ - function constructor ($class) { - $this->__construct($class); - } - - /** - * Creates an upper(=super) structure - */ - public static function createBaseUpperStructure () { - // Instanz holen - $upperInstance = new BaseUpperStructure (__CLASS__); - - // Debug message - if ((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) { - $upperInstance->getDebugInstance()->output(sprintf("[%s:%d] Aufbauten wird konstruiert.
\n", - __CLASS__, - __LINE__ - )); - } - - // Unique-ID setzen - $upperInstance->createUniqueID(); - - // Return instance - return $upperInstance; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/decks/.htaccess b/ship-simu/application/ship-simu/main/structures/extended/decks/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/decks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/.htaccess b/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php b/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php deleted file mode 100644 index b95faf6..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_CarDeck.php +++ /dev/null @@ -1,82 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Beschreibung setzen - $this->setPartDescr("Autodeck"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Autodeck erstellen - public static function createCarDeck ($numDecks, $dim) { - // Instanz holen - $carInstance = new CarDeck(); - - // Debug message - if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $carInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein Autodeck wird konstruiert...
\n", - __CLASS__, - __LINE__ - )); - - // Abmasse extrahieren - $carInstance->extractDimensions($dim); - - // Andere Daten uebetragen - $carInstance->setNumDecks($numDecks); - - // Nicht noetige Instanz - $carInstance->removePartInstance(); - - // Instanz zurueckgeben - return $carInstance; - } - - // Deckanzahl entfernen - public function removeNumDecks() { - if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gelöscht.
\n", - __CLASS__, - __LINE__ - )); - parent::removeNumDecks(); - } - - // Setter-Methode fuer Anzahl Decks - public function setNumDecks($numDecks) { - parent::setNumDecks($numDecks); - } - - // Getter-Methode fuer Anzahl Decks - public function getNumDecks() { - return parent::getNumDecks(); - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php b/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php deleted file mode 100644 index 840c1aa..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_TrainDeck.php +++ /dev/null @@ -1,82 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Beschreibung setzen - $this->setPartDescr("Zug-Deck"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // LKW-Deck erstellen - public static function createTrainDeck ($numDecks, $dim) { - // Instanz holen - $trainInstance = new TrainDeck(); - - // Debug message - if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $trainInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein LKW-Deck wird konstruiert...
\n", - __CLASS__, - __LINE__ - )); - - // Abmasse extrahieren - $trainInstance->extractDimensions($dim); - - // Andere Daten uebetragen - $trainInstance->setNumDecks($numDecks); - - // Nicht noetige Instanz - $trainInstance->removePartInstance(); - - // Instanz zurueckliefern - return $trainInstance; - } - - // Deckanzahl entfernen - public function removeNumDecks() { - if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gelöscht.
\n", - __CLASS__, - __LINE__ - )); - parent::removeNumDecks(); - } - - // Setter-Methode fuer Anzahl Decks - public function setNumDecks ($numDecks) { - parent::setNumDecks($numDecks); - } - - // Getter-Methode fuer Anzahl Decks - public function getNumDecks() { - return parent::getNumDecks(); - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php b/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php deleted file mode 100644 index ecccce2..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/decks/cargo/class_TruckDeck.php +++ /dev/null @@ -1,82 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Beschreibung setzen - $this->setPartDescr("LKW-Deck"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // LKW-Deck erstellen - public static function createTruckDeck ($numDecks, $dim) { - // Instanz holen - $truckInstance = new TruckDeck(); - - // Debug message - if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $truckInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein LKW-Deck wird konstruiert...
\n", - __CLASS__, - __LINE__ - )); - - // Abmasse extrahieren - $truckInstance->extractDimensions($dim); - - // Andere Daten uebetragen - $truckInstance->setNumDecks($numDecks); - - // Nicht noetige Instanz - $truckInstance->removePartInstance(); - - // Instanz zurueckliefern - return $truckInstance; - } - - // Deckanzahl entfernen - public function removeNumDecks() { - if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Anzahl Decks wurde gelöscht.
\n", - __CLASS__, - __LINE__ - )); - parent::removeNumDecks(); - } - - // Setter-Methode fuer Anzahl Decks - public function setNumDecks ($numDecks) { - parent::setNumDecks($numDecks); - } - - // Getter-Methode fuer Anzahl Decks - public function getNumDecks() { - return parent::getNumDecks(); - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php b/ship-simu/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php deleted file mode 100644 index ba1a32f..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php +++ /dev/null @@ -1,61 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Beschreibung setzen - $this->setPartDescr("Deck"); - - // Maybe clean up? - if ($class == __CLASS__) { - $this->removeSystemArray(); - } - } - - // Ruft nur den privaten Konstruktor auf - public function constructor ($class) { - $this->__construct($class); - } - - // Ein allgemeines Deck erstellen - public static function createBaseDeck () { - // Instanz holen - $deckInstance = new BaseDeck(__CLASS__); - - // Debug message - if ((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) $deckInstance->getDebugInstance()->output(sprintf("[%s:%d] Ein allgemeines Deck wird konstruiert.
\n", - __CLASS__, - __LINE__ - )); - - // Unique-ID setzen - $deckInstance->createUniqueID(); - - // Instanz zurueckgeben - return $deckInstance; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/main/structures/extended/lower/.htaccess b/ship-simu/application/ship-simu/main/structures/extended/lower/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/lower/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/structures/extended/upper/.htaccess b/ship-simu/application/ship-simu/main/structures/extended/upper/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/upper/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/main/structures/extended/upper/class_Bridge.php b/ship-simu/application/ship-simu/main/structures/extended/upper/class_Bridge.php deleted file mode 100644 index 08ea8e7..0000000 --- a/ship-simu/application/ship-simu/main/structures/extended/upper/class_Bridge.php +++ /dev/null @@ -1,70 +0,0 @@ -getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.
\n", - __CLASS__, - __LINE__ - )); - - // Beschreibung setzen - $this->setPartDescr("Brücke"); - - // Unique-ID erzeugen - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - $this->removePartInstance(); - } - - // Eine Kommandobruecke erstellen - public static function createBridge ($width, $height, $length) { - // Instanz holen - $bridgeInstance = new Bridge(); - - // Debug message - if ((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) $bridgeInstance->getDebugInstance()->output(sprintf("[%s:%d] Eine Brücke wird konstruiert...
\n", - __CLASS__, - __LINE__ - )); - - // Abmasse setzen - $bridgeInstance->setWidth($width); - $bridgeInstance->setHeight($height); - $bridgeInstance->setLength($length); - - // Instanz zurueckgeben - return $bridgeInstance; - } - - // Overwritten method for tradeable items - public function isTradeable () { - return true; - } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/starter.php b/ship-simu/application/ship-simu/starter.php deleted file mode 100644 index 1e6e523..0000000 --- a/ship-simu/application/ship-simu/starter.php +++ /dev/null @@ -1,42 +0,0 @@ -%s kann nicht gestartet werden, da die Hilfsklasse %s nicht geladen ist!", - $application, - FrameworkConfiguration::getInstance()->readConfig("app_helper_class") - )); -} elseif (!is_object($app)) { - // No object! - ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die 'app' kein Objekt ist!", - $application - )); -} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) { - // Method not found! - ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die Methode %s fehlt!", - $application, - FrameworkConfiguration::getInstance()->readConfig("entry_method") - )); -} - -// Call the entry point method -try { - $eval = sprintf("%s::getInstance()->%s();", - FrameworkConfiguration::getInstance()->readConfig("app_helper_class"), - FrameworkConfiguration::getInstance()->readConfig("entry_method") - ); - eval($eval); -} catch (FrameworkException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden. Grund: %s", - $application, - $e->getMessage() - )); -} - - -// [EOF] -?> diff --git a/ship-simu/application/ship-simu/templates/.htaccess b/ship-simu/application/ship-simu/templates/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/templates/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/templates/de/.htaccess b/ship-simu/application/ship-simu/templates/de/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/templates/de/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/templates/de/html/.htaccess b/ship-simu/application/ship-simu/templates/de/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/application/ship-simu/templates/de/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/ship-simu/templates/de/html/selector_ship-simu.tpl b/ship-simu/application/ship-simu/templates/de/html/selector_ship-simu.tpl deleted file mode 100644 index d56a95f..0000000 --- a/ship-simu/application/ship-simu/templates/de/html/selector_ship-simu.tpl +++ /dev/null @@ -1,17 +0,0 @@ -
-
- Gründen Sie eine virtuelle Reederei an den bedeutestens - Welthäfen! Oder treten Sie einer Reederei als Angestellter bei und - arbeiten Sie sich bis in die Chef-Etagge hoch! -
- -
- Oder fangen Sie als Matrose auf einem Passagierschiff (virtuell) an zu - arbeiten und werden Sie nach wenigen Kreuzfahrten bald Kapitän! -
- -
- Oder buchen Sie eine virtuelle Kreuzfahrt durch die bekannten Meeren in - {!POINTS!} in einer Luxus-Suite! -
-
diff --git a/ship-simu/db/.htaccess b/ship-simu/db/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/db/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/devel/.htaccess b/ship-simu/devel/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/devel/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/devel/class_Debug.php b/ship-simu/devel/class_Debug.php deleted file mode 100644 index 1adbe5a..0000000 --- a/ship-simu/devel/class_Debug.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 Debug { - // Constructor - public function __construct () { - // Konstruktoren debuggen (nur im Zusammenhang mit den folgenden Schaltern effektiv) - // VIELE DEBUG-MELDUNGEN!!! - //define('DEBUG_CONSTRUCT', true); - // eval()-Befehle debuggen - //define('DEBUG_EVAL', true); - // Systeme debuggen - //define('DEBUG_SYSTEM', true); - // SimulatorBase debuggen (VORSICHT! SEHR VIELE DEBUG-MELDUNGEN!!!) - //define('DEBUG_CORE', true); - //////// Objekte debuggen (ausgeben) //////// - // Datenbank-Objekt debuggen - //define('DEBUG_DATABASE_OBJ', true); - //////// Alles unteren debuggen //////// - //define('DEBUG_ALL', true); - // Kompressor debuggen - //define('DEBUG_COMPRESSOR', true); - // Datenbankschichten debuggen - //define('DEBUG_DATABASE', true); - // Template-System debuggen - //define('DEBUG_TEMPLATE', true); - // Konfiguration debuggen - //define('DEBUG_CONFIG', true); - } -} - -/** - * Initialize the dummy debug class - */ -$dummy = new Debug(); -unset($dummy); - -// -?> diff --git a/ship-simu/docs/THANKS b/ship-simu/docs/THANKS deleted file mode 100644 index bd56a2c..0000000 --- a/ship-simu/docs/THANKS +++ /dev/null @@ -1,6 +0,0 @@ -Special Thanks goes to: - - Daff - - toms - - And all the others I have not listed here. - -If you think your name is missing here please ICQ me: 8809296 diff --git a/ship-simu/inc/.htaccess b/ship-simu/inc/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes.php b/ship-simu/inc/classes.php deleted file mode 100644 index fb00ebf..0000000 --- a/ship-simu/inc/classes.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ - -// Lower framework classes -$lowerClasses = array( - 0 => "exceptions", // Exceptions - 1 => "interfaces", // Interfaces - 2 => "main", // General main classes - 3 => "middleware" // The middleware -); - -// Load all classes -foreach ($lowerClasses as $class) { - // Try to load the framework classes - try { - ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $class)); - } catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", - $class - )); - } catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", - $class - )); - } catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", - $class - )); - } catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", - $class - )); - } -} - -// Include all classes -ClassLoader::getInstance()->includeAllClasses(); - -// Clean up the global namespace -unset($lowerClasses[3]); // Applications shall not have any middleware -unset($class); - -////// Until here the framework classes are loaded ////// - -// [EOF] -?> diff --git a/ship-simu/inc/classes/.htaccess b/ship-simu/inc/classes/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/.htaccess b/ship-simu/inc/classes/exceptions/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/class_FrameworkException.php b/ship-simu/inc/classes/exceptions/class_FrameworkException.php deleted file mode 100644 index 46a0342..0000000 --- a/ship-simu/inc/classes/exceptions/class_FrameworkException.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ -abstract class FrameworkException extends ReflectionException { - /** - * Array for the backtrace - */ - private $backTrace = array(); - - /** - * The super constructor for all exceptions - * - * @param $message The non-optional message for the exception - * @param $code An optional code for better debugging - * @return void - */ - public function __construct($message, $code = 0) { - // Extract backtrace - $this->saveBackTrace(); - - // Cast all data - $message = (string) $message; - $code = (int) $code; - - // make sure everything is assigned properly - parent::__construct($message, $code); - } - - /** - * Save the current backtrace - * - * @return void - */ - private final function saveBackTrace () { - $this->backTrace = debug_backtrace(); - } - - /** - * Get saved backtrace - * - * @return $backTrace The full backtrace in an array - */ - public final function getBackTrace () { - return $this->backTrace; - } - - /** - * Returns the name of the thrown exception - * - * @return $toString The name of the thrown exception - */ - public function __toString() { - return get_class($this); - } - - /** - * Getter for hex-decimal code - * - * @return $hexCode The exception code in hex-decimal format - */ - public final function getHexCode () { - // Get the decimal code - $code = $this->getCode(); - - // Format it to hex-decimal, 0x as prefix and 3 chars - $hexCode = sprintf("0x%03s", dechex($code)); - - // Return it - return $hexCode; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/compressor/.htaccess b/ship-simu/inc/classes/exceptions/compressor/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/compressor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php b/ship-simu/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php deleted file mode 100644 index f619601..0000000 --- a/ship-simu/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 MismatchingCompressorsException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Kompressor %s zu den geladenen Daten aus %s und der aktuell verwendete Kompressor %s stimmen nicht überein!", - $array[0]->__toString(), - $this->getLine(), - strtoupper($array[1]), - sprintf("%s:%s", - basename(dirname($array[2])), - basename($array[2]) - ), - strtoupper($array[3]) - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/container/.htaccess b/ship-simu/inc/classes/exceptions/container/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/container/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php b/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php deleted file mode 100644 index ae3dfad..0000000 --- a/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ContainerItemIsNoArrayException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Ein Container-Item ist kein Array.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNullException.php b/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNullException.php deleted file mode 100644 index 3d70144..0000000 --- a/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNullException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ContainerItemIsNullException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Ein Container-Item ist auf null gesetzt.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php b/ship-simu/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php deleted file mode 100644 index f5e77ac..0000000 --- a/ship-simu/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ContainerMaybeDamagedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Ein Container ist möglicherweise beschädigt.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/database/.htaccess b/ship-simu/inc/classes/exceptions/database/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/database/local_file/.htaccess b/ship-simu/inc/classes/exceptions/database/local_file/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php b/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php deleted file mode 100644 index 938edc5..0000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 SavePathIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Speicherpfad ist leer.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php b/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php deleted file mode 100644 index fa59a43..0000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 SavePathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der angegebene Speicherpfad %s ist ungütig (kein Pfad).", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php b/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php deleted file mode 100644 index 8647da1..0000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 SavePathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der Pfad %s ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php b/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php deleted file mode 100644 index 7236f56..0000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 SavePathWriteProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der angegebene Speicherpfad %s ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/.htaccess b/ship-simu/inc/classes/exceptions/io/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/io/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php b/ship-simu/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php deleted file mode 100644 index a8a616f..0000000 --- a/ship-simu/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DirPointerNotOpenedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Für den Pfad %s konnte kein Pointer initialisiert werden.", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php b/ship-simu/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php deleted file mode 100644 index da5e8fe..0000000 --- a/ship-simu/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FilePointerNotOpenedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Für die Datei %s konnte kein Pointer initialisiert werden. Möglicherweise ist die Datei nicht lesbar oder fehlt!", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_InvalidDataLengthException.php b/ship-simu/inc/classes/exceptions/io/class_InvalidDataLengthException.php deleted file mode 100644 index 7952be8..0000000 --- a/ship-simu/inc/classes/exceptions/io/class_InvalidDataLengthException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 InvalidDataLengthException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Eine unerwartete Datenlänge von %s Byte ist aufgetreten. %s wurden erwartet!", - $array[0]->__toString(), - $this->getLine(), - $array[1], - $array[2] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php b/ship-simu/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php deleted file mode 100644 index caabc32..0000000 --- a/ship-simu/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 InvalidDirectoryResourceException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - if (is_null($class)) { - $message = "[???:] Ungütige Verzeichnis-Resource."; - } elseif (is_object($class)) { - $message = sprintf("[%s:%d] Ungütige Verzeichnis-Resource.", - $class->__toString(), - $this->getLine() - ); - } - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php b/ship-simu/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php deleted file mode 100644 index 349e713..0000000 --- a/ship-simu/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 InvalidMD5ChecksumException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Die MD5-Prüfsummen %s und %s stimmen nicht überein!", - $array[0]->__toString(), - $this->getLine(), - $array[1], - $array[2] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_PathIsEmptyException.php b/ship-simu/inc/classes/exceptions/io/class_PathIsEmptyException.php deleted file mode 100644 index cd6010c..0000000 --- a/ship-simu/inc/classes/exceptions/io/class_PathIsEmptyException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 PathIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - if (is_null($class)) { - $message = "[???:] Der Verzeichnisname ist leer."; - } elseif (is_object($class)) { - $message = sprintf("[%s:%d] Der Verzeichnisname ist leer.", - $class->__toString(), - $this->getLine() - ); - } - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php b/ship-simu/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php deleted file mode 100644 index b458387..0000000 --- a/ship-simu/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 PathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der angegebene Pfad %s ist ungütig (kein Pfad).", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_PathReadProtectedException.php b/ship-simu/inc/classes/exceptions/io/class_PathReadProtectedException.php deleted file mode 100644 index d630daf..0000000 --- a/ship-simu/inc/classes/exceptions/io/class_PathReadProtectedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 PathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der Pfad %s ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/language/.htaccess b/ship-simu/inc/classes/exceptions/language/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/language/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php b/ship-simu/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php deleted file mode 100644 index f9656d8..0000000 --- a/ship-simu/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 InvalidLanguagePathStringException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] %s ist keine Zeichenkette!", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php b/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php deleted file mode 100644 index 01068d8..0000000 --- a/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 LanguagePathIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Sprachen-Basispfad ist leer.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php b/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php deleted file mode 100644 index 1761298..0000000 --- a/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 LanguagePathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Sprach-Basispfad %s existiert nicht oder ist eine Datei!", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php b/ship-simu/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php deleted file mode 100644 index f803c42..0000000 --- a/ship-simu/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 LanguagePathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Sprach-Basispfad %s ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/.htaccess b/ship-simu/inc/classes/exceptions/main/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/main/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/main/class_ClassMismatchException.php b/ship-simu/inc/classes/exceptions/main/class_ClassMismatchException.php deleted file mode 100644 index 5f73e05..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_ClassMismatchException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ClassMismatchException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($classArray, $code) { - // Add a message around the missing class - $message = sprintf("Die Klasse %s ist ungleich %s.", - $classArray[0], - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ClassNotFoundException.php b/ship-simu/inc/classes/exceptions/main/class_ClassNotFoundException.php deleted file mode 100644 index 0d3918c..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_ClassNotFoundException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ClassNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("Die interne Script-Klasse %s konnte nicht gefunden werden!", $class); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php b/ship-simu/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php deleted file mode 100644 index 497438e..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ConfigEntryIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Leeren Konfigurationseintrag angegeben!", - $class, - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php b/ship-simu/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php deleted file mode 100644 index 14244c8..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ConfigEntryNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct (array $classArray, $code) { - // Cast the array - $classArray = (array) $classArray; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Konfigurationseintrag %s nicht gefunden.", - $classArray[0], - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php b/ship-simu/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php deleted file mode 100644 index 7407c50..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DimNotFoundInArrayException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - if (is_object($class)) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Abmasse konnten nicht extrahiert werden!", - $class->__toString(), - $this->getLine() - ); - } else { - // No class given - $message = sprintf("Please provide a class for %s", __CLASS__); - } - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ExceptionNotChangedException.php b/ship-simu/inc/classes/exceptions/main/class_ExceptionNotChangedException.php deleted file mode 100644 index d6d0635..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_ExceptionNotChangedException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @deprecated - * - * 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 ExceptionNotChangedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Exception(s) wurde(n) nicht geändert.", - $class, - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ExceptionNotFoundException.php b/ship-simu/inc/classes/exceptions/main/class_ExceptionNotFoundException.php deleted file mode 100644 index 04b2685..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_ExceptionNotFoundException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ExceptionNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct (array $classArray, $code) { - // Cast the array - $classArray = (array) $classArray; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Exception %s nicht gefunden.", - $classArray[0], - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_GetterNotFoundException.php b/ship-simu/inc/classes/exceptions/main/class_GetterNotFoundException.php deleted file mode 100644 index 95ecc95..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_GetterNotFoundException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 GetterNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($dataArray, $code) { - // Cast the array - $dataArray = (array) $dataArray; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Getter-Methode für Attribut %s nicht gefunden.", - $dataArray[0]->__toString(), - $this->getLine(), - $dataArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_InvalidArrayCountException.php b/ship-simu/inc/classes/exceptions/main/class_InvalidArrayCountException.php deleted file mode 100644 index 3c1a7e6..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_InvalidArrayCountException.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 InvalidArrayCountException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] %s hat %d Elemente, soll aber %d enthalten!", - $array[0]->__toString(), - $this->getLine(), - $array[1], - $array[2], - $array[3] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_InvalidObjectException.php b/ship-simu/inc/classes/exceptions/main/class_InvalidObjectException.php deleted file mode 100644 index c847c22..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_InvalidObjectException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 InvalidObjectException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: %s)", - $class->__toString(), - $this->getLine(), - $class->getPartDescr() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_MissingArrayElementsException.php b/ship-simu/inc/classes/exceptions/main/class_MissingArrayElementsException.php deleted file mode 100644 index aee6090..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_MissingArrayElementsException.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 MissingArrayElementsException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($classArray, $code) { - // Cast the array - $classArray = (array) $classArray; - - // Extract all elements - $elements = ""; - if ((isset($classArray[2])) && (is_array($classArray[2]))) { - // Convert into strings - $elements = implode(", ", $classArray[2]); - } else { - // Invalid data - $elements = "invalid_data"; - } - - // Add a message around the missing class - $message = sprintf("[%s:%d] Das Array %s() keine Elemente %s auf!", - $classArray[0]->__toString(), - $this->getLine(), - $classArray[1], - $elements - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php b/ship-simu/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php deleted file mode 100644 index 392474d..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @deprecated - * - * 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 MissingDecimalsThousandsSeperatorException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($instance, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Die Dezimal- und Tausendertrenner fehlen!", - $instance->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_MissingMethodException.php b/ship-simu/inc/classes/exceptions/main/class_MissingMethodException.php deleted file mode 100644 index f8c5a68..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_MissingMethodException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 MissingMethodException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($classArray, $code) { - // Cast the array - $classArray = (array) $classArray; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Weisst keine Methode %s() auf!", - $classArray[0]->__toString(), - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_NoArrayCreatedException.php b/ship-simu/inc/classes/exceptions/main/class_NoArrayCreatedException.php deleted file mode 100644 index 69e4ad2..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_NoArrayCreatedException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 NoArrayCreatedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] %s ist kein erstelltes Objekt.", - $array[0]->__toString(), - $this->getLine(), - $array[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_NoArrayException.php b/ship-simu/inc/classes/exceptions/main/class_NoArrayException.php deleted file mode 100644 index 490a6c0..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_NoArrayException.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 NoArrayException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($string, $code) { - // Add a message around the missing class - $message = sprintf("%s ist kein Array!", - $string - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_NoObjectException.php b/ship-simu/inc/classes/exceptions/main/class_NoObjectException.php deleted file mode 100644 index 7c7b519..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_NoObjectException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @deprecated - * @see InvalidObjectException - * - * 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 NoObjectException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($string, $code) { - // Add a message around the missing class - $message = sprintf("%s ist kein Objekt!", - $string - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_NullPointerException.php b/ship-simu/inc/classes/exceptions/main/class_NullPointerException.php deleted file mode 100644 index c43f466..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_NullPointerException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 NullPointerException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Eine Instanz/Pointer ist auf null gesetzt.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_VariableIsNotSetException.php b/ship-simu/inc/classes/exceptions/main/class_VariableIsNotSetException.php deleted file mode 100644 index 821dfb4..0000000 --- a/ship-simu/inc/classes/exceptions/main/class_VariableIsNotSetException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 VariableIsNotSetException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Bei der Initialisierung der Applikation %s wurde keine Variable %s erzeugt.", - $array[0]->__toString(), - $this->getLine(), - $array[1], - $array[2] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/.htaccess b/ship-simu/inc/classes/exceptions/template/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/exceptions/template/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/template/class_BasePathIsEmptyException.php b/ship-simu/inc/classes/exceptions/template/class_BasePathIsEmptyException.php deleted file mode 100644 index 4c6cbc5..0000000 --- a/ship-simu/inc/classes/exceptions/template/class_BasePathIsEmptyException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 BasePathIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Template-Basispfad ist leer.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php b/ship-simu/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php deleted file mode 100644 index 4c6de81..0000000 --- a/ship-simu/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 BasePathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Template-Basispfad %s existiert nicht oder ist eine Datei!", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_BasePathReadProtectedException.php b/ship-simu/inc/classes/exceptions/template/class_BasePathReadProtectedException.php deleted file mode 100644 index ea35cfe..0000000 --- a/ship-simu/inc/classes/exceptions/template/class_BasePathReadProtectedException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 BasePathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Template-Basispfad %s ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_InvalidBasePathStringException.php b/ship-simu/inc/classes/exceptions/template/class_InvalidBasePathStringException.php deleted file mode 100644 index 36f2002..0000000 --- a/ship-simu/inc/classes/exceptions/template/class_InvalidBasePathStringException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 InvalidBasePathStringException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] %s ist keine Zeichenkette!", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php b/ship-simu/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php deleted file mode 100644 index 7683d2c..0000000 --- a/ship-simu/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 InvalidTemplateVariableNameException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Die im Template %s gefundene Variable %s ist nicht gültig! Gültige Variablennamen sind nur %s.", - $class[0]->__toString(), - $this->getLine(), - basename($class[1]), - $class[2], - $class[3]->readConfig("tpl_valid_var") - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php b/ship-simu/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php deleted file mode 100644 index 5cbe2be..0000000 --- a/ship-simu/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 UnexpectedTemplateTypeException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Template-Typ %s entspricht nicht dem erwartetem Template-Typ %s.", - $class[0]->__toString(), - $this->getLine(), - $class[1], - $class[2] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/.htaccess b/ship-simu/inc/classes/interfaces/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/application/.htaccess b/ship-simu/inc/classes/interfaces/application/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/application/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/application/class_ManageableApplication.php b/ship-simu/inc/classes/interfaces/application/class_ManageableApplication.php deleted file mode 100644 index 60584f8..0000000 --- a/ship-simu/inc/classes/interfaces/application/class_ManageableApplication.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ManageableApplication extends FrameworkInterface { - /** - * Getter for application's version number - * - * @return $appVersion The application's version number - */ - function getAppVersion (); - /** - * Setter for application's version number - * - * @param $appVersion The application's version number - * @return void - */ - function setAppVersion ($appVersion); - - /** - * Getter for application's human-readable name - * - * @return $appName The application's name readable for humans - */ - function getAppName (); - - /** - * Setter for application's human-readable name - * - * @param $appName The application's name readable for humans - * @return void - */ - function setAppName ($appName); - - /** - * Getter for application's short uni*-like name - * - * @return $shortName The application's name readable for humans - */ - function getAppShortName (); - - /** - * Setter for application's short uni*-like name - * - * @param $shortName The application's name readable for humans - * @return void - */ - function setAppShortName ($shortName); - - /** - * Launches the application - * - * @return void - */ - function entryPoint (); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/class_FrameworkInterface.php b/ship-simu/inc/classes/interfaces/class_FrameworkInterface.php deleted file mode 100644 index 3c9d5ff..0000000 --- a/ship-simu/inc/classes/interfaces/class_FrameworkInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FrameworkInterface { -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/compressor/.htaccess b/ship-simu/inc/classes/interfaces/compressor/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/compressor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/compressor/class_Compressor.php b/ship-simu/inc/classes/interfaces/compressor/class_Compressor.php deleted file mode 100644 index 5f42ec3..0000000 --- a/ship-simu/inc/classes/interfaces/compressor/class_Compressor.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 Compressor extends FrameworkInterface { - /** - * A compression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object - */ - function compressStream ($streamData); - - /** - * A decompression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object - */ - function decompressStream ($streamData); - - /** - * Getter for the file extension of this compressor - * - * @return $string The compressor's file extension - */ - function getCompressorExtension (); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/database/.htaccess b/ship-simu/inc/classes/interfaces/database/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php b/ship-simu/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php deleted file mode 100644 index 0b06298..0000000 --- a/ship-simu/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php +++ /dev/null @@ -1,69 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FrameworkDatabaseInterface extends FrameworkInterface { - /** - * Saves a whole object by serializing it entirely or some specifyable - * parts. Specifying parts must be done before this method is called. If - * it is not done this method will serialize the whole object. - * - * @param $object An instance to the object we want to save - * @return void - * @see limitObject(ObjectLimits) limitObject - */ - function saveObject ($object); - - /** - * Analyses if a unique ID has already been used or not. This method does - * only pass the given ID through to the "real" database layer. - * - * @param $uniqueID A unique ID number which shall be checked - * before it will be used - * @param $inConstructor If called from a constructor 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 NullPointerException If $dbInstance is null - * @throws NoObjectException If $dbInstance is not an object - * @throws MissingMethodException If the required method - * isUniqueIdUsed() was not found - */ - function isUniqueIdUsed ($uniqueID, $inConstructor = false); - - /** - * Gets cached data from the database layer and if not found fetch it from - * the database again. This method does not return the header stuff because - * The underlaying database class will return only the requested content. - * - * @param $idNumber The ID number which we need for looking up - * the requested data - * @return $cachedArray The maybe cached data from the database - * @throws NullPointerException If $dbInstance is null - * @throws NoObjectException If $dbInstance is not an object - * @throws MissingMethodException If the required method - * isUniqueIdUsed() was not found - */ - function getObjectFromCachedData ($idNumber); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/database/frontend/.htaccess b/ship-simu/inc/classes/interfaces/database/frontend/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/database/frontend/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php b/ship-simu/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php deleted file mode 100644 index 839ba63..0000000 --- a/ship-simu/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DatabaseFrontendInterface extends FrameworkDatabaseInterface { - /** - * Loads data saved with saveObject from the database and re-creates a - * full object from it. - * If limitObject() was called before a new object ObjectContainer with - * all requested attributes will be returned instead. - * - * @return Object The fully re-created object or instance to - * ObjectContainer - */ - function loadObject (); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/database/middleware/.htaccess b/ship-simu/inc/classes/interfaces/database/middleware/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/database/middleware/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php b/ship-simu/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php deleted file mode 100644 index 0182ef8..0000000 --- a/ship-simu/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DatabaseConnector extends FrameworkDatabaseInterface { -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/debug/.htaccess b/ship-simu/inc/classes/interfaces/debug/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/debug/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/debug/class_Debugger.php b/ship-simu/inc/classes/interfaces/debug/class_Debugger.php deleted file mode 100644 index 46cdeb4..0000000 --- a/ship-simu/inc/classes/interfaces/debug/class_Debugger.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 Debugger extends FrameworkInterface { - /** - * Outputs the given data - * - * @param $output Debug text for output - * @return void - */ - function outputStream ($output); -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/extended/.htaccess b/ship-simu/inc/classes/interfaces/extended/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/extended/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/extended/class_LimitableObject.php b/ship-simu/inc/classes/interfaces/extended/class_LimitableObject.php deleted file mode 100644 index 8ed5eb9..0000000 --- a/ship-simu/inc/classes/interfaces/extended/class_LimitableObject.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 LimitableObject extends FrameworkInterface { - /** - * Reduces the volume of a processed object. - * - * @param $limitInstance An instance to ObjectLimits which holds - * attribute names that we want to include - * in the processing phase. Other attributes - * except $uniqueID and $realClass will be - * ignored and keept out. - * @return void - */ - function limitObject (ObjectLimits $limitInstance); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/io/.htaccess b/ship-simu/inc/classes/interfaces/io/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/io/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/io/class_Streamable.php b/ship-simu/inc/classes/interfaces/io/class_Streamable.php deleted file mode 100644 index 1392564..0000000 --- a/ship-simu/inc/classes/interfaces/io/class_Streamable.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 Streamable extends FrameworkInterface { -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/io/file/.htaccess b/ship-simu/inc/classes/interfaces/io/file/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/io/file/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/io/file/class_FileInputStreamer.php b/ship-simu/inc/classes/interfaces/io/file/class_FileInputStreamer.php deleted file mode 100644 index 6204e34..0000000 --- a/ship-simu/inc/classes/interfaces/io/file/class_FileInputStreamer.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FileInputStreamer extends Streamable { - /** - * Reads from a local or remote file - * - * @param $fqfn The file's FQFN we shall load - * @return $array An array containing all read lines - * @throws NullPointerException If an instance is null - * @throws NoObjectException If the instance is not an object - * instance - * @throws MissingMethodException If a required method is missing. - * @throws InvalidArrayCountException If an array has not the - * expected size - * @throws InvalidMD5ChecksumException If two MD5 hashes did not match - */ - function loadFileContents ($fqfn); -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/io/file/class_FileOutputStreamer.php b/ship-simu/inc/classes/interfaces/io/file/class_FileOutputStreamer.php deleted file mode 100644 index 55bc37e..0000000 --- a/ship-simu/inc/classes/interfaces/io/file/class_FileOutputStreamer.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FileOutputStreamer extends Streamable { - /** - * Saves streamed (that are mostly serialized objects) data to files or - * external servers. - * - * @param $fileName The local file's name including full path - * @param $dataArray Array containing the compressor's extension - * and streamed data - * @return void - * @throws NullPointerException If an instance is null - * @throws NoObjectException If the instance is not an object - * instance - * @throws MissingMethodException If a required method is missing. - */ - function saveFile ($fileName, $dataArray); -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/io/output/.htaccess b/ship-simu/inc/classes/interfaces/io/output/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/io/output/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/io/output/class_OutputStreamer.php b/ship-simu/inc/classes/interfaces/io/output/class_OutputStreamer.php deleted file mode 100644 index 6e4431f..0000000 --- a/ship-simu/inc/classes/interfaces/io/output/class_OutputStreamer.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 OutputStreamer extends Streamable { - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - function assignVariable($var, $value); - - /** - * Output the code - * - * @return void - */ - function output($outStream=false); -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/language/.htaccess b/ship-simu/inc/classes/interfaces/language/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/language/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/language/class_ManageableLanguage.php b/ship-simu/inc/classes/interfaces/language/class_ManageableLanguage.php deleted file mode 100644 index 77f3fbc..0000000 --- a/ship-simu/inc/classes/interfaces/language/class_ManageableLanguage.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ManageableLanguage extends FrameworkInterface { - /** - * Initialize the array-object for all later language strings - * - * @return void - */ - function initLanguageStrings(); -} // END - class - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/template/.htaccess b/ship-simu/inc/classes/interfaces/template/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/interfaces/template/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/template/class_CompileableTemplate.php b/ship-simu/inc/classes/interfaces/template/class_CompileableTemplate.php deleted file mode 100644 index 1477f74..0000000 --- a/ship-simu/inc/classes/interfaces/template/class_CompileableTemplate.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 CompileableTemplate extends FrameworkInterface { - /** - * Assign variables for templates - * - * @param $var The "variable" we want to assign - * @param $value The value we want to store in the variable - * @return void - */ - function assignVariable ($var, $value); - - /** - * Assign a configuration variables for templates - * - * @param $var The configuration "variable" we want to assign - * @param $value The value we want to store in the variable - * @return void - */ - function assignConfigVariable ($var, $value); - - /** - * Load a specified web template into the engine - * - * @param $template The web template we shall load which is - * located in "html" by default - * @return void - */ - function loadWebTemplate ($template); - - /** - * Load a specified code template into the engine for later compilation - * with other code/web/email templates. - * - * @param $template The code template we shall load which is - * located in "html" by default - * @return void - */ - function loadCodeTemplate ($template); - - /** - * Load a specified email template into the engine - * - * @param $template The email template we shall load which is - * located in "emails" by default - * @return void - */ - function loadEmailTemplate ($template); - - /** - * Compile all variables by inserting their respective values - * - * @return void - */ - function compileVariables (); - - - /** - * Compile all required code/web/email-templates into the current one - * - * @return void - */ - function compileTemplate (); - - /** - * Output the compiled template to the outside world. In case of web - * templates this would be vaild (X)HTML code. And in case of email - * templates this would store a prepared email body inside the template - * engine. - * - * @return void - */ - function output (); -} // END - class - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/.htaccess b/ship-simu/inc/classes/main/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/class_BaseFrameworkSystem.php b/ship-simu/inc/classes/main/class_BaseFrameworkSystem.php deleted file mode 100644 index 3721f63..0000000 --- a/ship-simu/inc/classes/main/class_BaseFrameworkSystem.php +++ /dev/null @@ -1,765 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 BaseFrameworkSystem extends stdClass implements FrameworkInterface { - /** - * The instance to the debug output handler (should be DebugConsoleOutput or DebugWebOutput) - * - * @see DebugConsoleOutput - * @see DebugWebOutput - */ - private static $debug = null; - - /** - * The instance to the web output handler (should be WebOutput) - * - * @see WebOutput - */ - private static $webOutput = null; - - /** - * The instance to the compression layer which should be CompressorChannel - */ - private static $compressor = null; - - /** - * The configuration instance which shall be FrameworkConfiguration - */ - private static $cfgInstance = null; - - /** - * The instance to the database layer which should be DatabaseConnection - */ - private $dbInstance = null; - - /** - * The real class name - */ - private $realClass = "FrameworkSystem"; - - /** - * A human-readable description for this simulator part - */ - private $partDescr = "Namenlose Framework-Einheit"; - - /** - * The unique ID string for identifying all type of classes - */ - private $uniqueID = ""; - - /** - * Thousands seperator - */ - private $thousands = "."; // German - - /** - * Decimal seperator - */ - private $decimals = ","; // German - - /*********************** - * Exception codes.... * - ***********************/ - - const EXCEPTION_IS_NULL_POINTER = 0x001; - const EXCEPTION_IS_NO_OBJECT = 0x002; - const EXCEPTION_IS_NO_ARRAY = 0x003; - const EXCEPTION_MISSING_METHOD = 0x004; - const EXCEPTION_CLASSES_NOT_MATCHING = 0x005; - const EXCEPTION_INDEX_OUT_OF_BOUNDS = 0x006; - const EXCEPTION_DIMENSION_ARRAY_INVALID = 0x007; - const EXCEPTION_ITEM_NOT_TRADEABLE = 0x008; - const EXCEPTION_ITEM_NOT_IN_PRICE_LIST = 0x009; - const EXCEPTION_GENDER_IS_WRONG = 0x00a; - const EXCEPTION_BIRTH_DATE_IS_INVALID = 0x00b; - const EXCEPTION_EMPTY_STRUCTURES_ARRAY = 0x00c; - const EXCEPTION_HAS_ALREADY_PERSONELL_LIST = 0x00d; - const EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES = 0x00e; - const EXCEPTION_TOTAL_PRICE_NOT_CALCULATED = 0x00f; - const EXCEPTION_HARBOR_HAS_NO_SHIPYARDS = 0x010; - const EXCEPTION_CONTRACT_PARTNER_INVALID = 0x011; - const EXCEPTION_CONTRACT_PARTNER_MISMATCH = 0x012; - const EXCEPTION_CONTRACT_ALREADY_SIGNED = 0x013; - const EXCEPTION_UNEXPECTED_EMPTY_STRING = 0x014; - const EXCEPTION_PATH_NOT_FOUND = 0x015; - const EXCEPTION_INVALID_PATH_NAME = 0x016; - const EXCEPTION_READ_PROTECED_PATH = 0x017; - const EXCEPTION_WRITE_PROTECED_PATH = 0x018; - const EXCEPTION_DIR_POINTER_INVALID = 0x019; - const EXCEPTION_FILE_POINTER_INVALID = 0x01a; - const EXCEPTION_INVALID_DIRECTORY_POINTER = 0x01b; - const EXCEPTION_UNEXPECTED_OBJECT = 0x01c; - const EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED = 0x01d; - const EXCEPTION_GETTER_IS_MISSING = 0x01e; - const EXCEPTION_ARRAY_EXPECTED = 0x01f; - const EXCEPTION_ARRAY_HAS_INVALID_COUNT = 0x020; - const EXCEPTION_ID_IS_INVALID_FORMAT = 0x021; - const EXCEPTION_MD5_CHECKSUMS_MISMATCH = 0x022; - const EXCEPTION_UNEXPECTED_STRING_SIZE = 0x023; - const EXCEPTION_SIMULATOR_ID_INVALID = 0x024; - const EXCEPTION_MISMATCHING_COMPRESSORS = 0x025; - const EXCEPTION_CONTAINER_ITEM_IS_NULL = 0x026; - const EXCEPTION_ITEM_IS_NO_ARRAY = 0x027; - const EXCEPTION_CONTAINER_MAYBE_DAMAGED = 0x028; - const EXCEPTION_INVALID_STRING = 0x029; - const EXCEPTION_VARIABLE_NOT_SET = 0x02a; - const EXCEPTION_ATTRIBUTES_ARE_MISSING = 0x02b; - const EXCEPTION_ARRAY_ELEMENTS_MISSING = 0x02c; - - /** - * In the super constructor these system classes shall be ignored or else - * we would get an endless calling loop. - * - *--------------------------------------------------------------------* - * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL SHOOT YOUR SERVER!!! * - *--------------------------------------------------------------------* - */ - private $systemClasses = array( - "DebugMiddleware", // Debug middleware output sub-system - "DebugWebOutput", // Debug web output sub-system - "DebugConsoleOutput", // Debug console output sub-system - "DebugErrorLogOutput", // Debug error_log() output sub-system - "CompressorChannel", // Compressor sub-system - "FrameworkDirectoryPointer", // Directory handler sub-system - "NullCompressor", // Null compressor - "Bzip2Compressor", // BZIP2 compressor - "GzipCompressor", // GZIP compressor - "WebOutput", // Web output sub-system - ); - - /** - * Private super constructor - * - * @return void - */ - private function __construct ($class) { - // Set real class - $this->setRealClass($class); - } - - /** - * Destructor reached... - * - * @return void - */ - public function __destruct() { - // Is this object already destroyed? - if ($this->__toString() != "DestructedObject") { - // Debug message - if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { - $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wird zerstört.
\n", - __CLASS__, $this->__toString() - )); - } - - // Destroy all informations about this class but keep some text about it alive - $this->setPartDescr(sprintf("Entferntes Objekt %s", $this->__toString())); - $this->setRealClass("DestructedObject"); - $this->resetUniqueID(); - } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { - // Already destructed object - $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wurde bereits zerstört.
\n", - __CLASS__, $this->__toString() - )); - } - } - - /** - * The call method where all non-implemented methods end up - * - * @return void - */ - public final function __call ($methodName, $args) { - // Implode all given arguments - $argsString = implode("|", $args); - if (empty($argsString)) $argsString = "NULL"; - - $this->getDebugInstance()->output(sprintf("[%s::%s] Stub! Args: %s", - $this->__toString(), - $methodName, - $argsString - )); - - // Return nothing - return null; - } - - /** - * Public constructor (for initializing things, etc.) - * - * @return void - */ - public function constructor ($class) { - // Call constructor - $this->__construct($class); - - // Get the current (singleton) configuration instance - $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration()); - - // Is the class weather debug nor compressor channel? - if (!in_array($class, $this->systemClasses)) { - // Initialize debug instance - if (is_null($this->getDebugInstance())) { - // Set the debug output system if it is not debug class ;) - $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig("debug_engine"))); - } - - // Initialize web instance - if (is_null($this->getWebOutputInstance())) { - // Generate the eval() command - $eval = sprintf("\$this->setWebOutputInstance(%s::create%s(\"%s\"));", - $this->getConfigInstance()->readConfig("web_engine"), - $this->getConfigInstance()->readConfig("web_engine"), - $this->getConfigInstance()->readConfig("web_content_type") - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", - $this->__toString(), - htmlentities($eval) - )); - - // Run the command - eval($eval); - } - - // Initialize compressor channel - if (is_null($this->getCompressorChannel())) { - // Set the compressor channel - $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s", - PATH, - $this->getConfigInstance()->readConfig("compressor_base_path") - ))); - } - - // Initialize database middleware - if (is_null($this->getDatabaseInstance())) { - // Get the middleware instance - $db = DatabaseConnection::getInstance(); - if (is_object($db)) { - // Set the database middleware - $this->setDatabaseInstance($db); - } - } - - // Debug output - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Alle Sub-Systeme sind initialisiert.
\n", - $this->__toString() - )); - } - } - - /** - * Setter for language instance - * - * @param $configInstance The configuration instance which shall - * be FrameworkConfiguration - * @return void - */ - public final function setConfigInstance (FrameworkConfiguration $configInstance) { - $this->cfgInstance = $configInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler auf %s gesetzt.
\n", - $this->__toString(), - $configInstance->__toString() - )); - } - - /** - * Getter for configuration instance - * - * @return $cfhInstance - Configuration instance - */ - public final function getConfigInstance () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler %s angefordert.
\n", - $this->__toString(), - $this->cfgInstance->__toString() - )); - return $this->cfgInstance; - } - - /** - * Setter for debug instance - * - * @param $debugInstance The instance for debug output class - * @return void - */ - public final function setDebugInstance (DebugMiddleware $debugInstance) { - self::$debug = $debugInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Debug-Handler auf %s gesetzt.
\n", - $this->__toString(), - $this->getDebugInstance()->__toString() - )); - } - - /** - * Getter for debug instance - * - * @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput - */ - public final function getDebugInstance () { - return self::$debug; - } - - /** - * Setter for web output instance - * - * @param $webInstance The instance for web output class - * @return void - */ - public final function setWebOutputInstance (OutputStreamer $webInstance) { - self::$webOutput = $webInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Web-Handler auf %s gesetzt.
\n", - $this->__toString(), - $this->getWebOutputInstance()->__toString() - )); - } - - /** - * Getter for web output instance - * - * @return $webOutput - Instance to class WebOutput - */ - public final function getWebOutputInstance () { - return self::$webOutput; - } - - /** - * Static setter for database instance - * - * @param $dbInstance The instance for the database connection - * (forced DatabaseConnection) - * @return void - */ - public final function setDatabaseInstance (DatabaseConnection $dbInstance) { - if ((defined('DEBUG_SYSTEM')) && (is_object($dbInstance->getDebugInstance()))) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Datenbankschicht gesetzt.
\n", - $dbInstance->__toString() - )); - $this->dbInstance = $dbInstance; - } - - /** - * Getter for $realClass - * - * @return $realClass The name of the real class (not BaseFrameworkSystem) - */ - public final function __toString () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] __toString() erreicht.
\n", - $this->realClass - )); - return $this->realClass; - } - - /** - * Setter for the real class name - * - * @param $realClass Class name (string) - * @return void - */ - public final function setRealClass ($realClass) { - // Cast to string - $realClass = (string) $realClass; - - // Set real class - $this->realClass = $realClass; - } - - /** - * Generate unique ID from a lot entropy - * - * @return void - */ - public final function createUniqueID () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID aufgerufen.
\n", - $this->__toString() - )); - - // Existiert noch keine? - if (empty($this->uniqueID)) { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID erzeugt neue Unique-ID.
\n", - $this->__toString() - )); - - // Correct missing class name - $corrected = false; - if ($this->__toString() == "") { - $this->setRealClass(__CLASS__); - $corrected = true; - } - - // Neue ID erstellen - $tempID = false; - while (true) { - // Generate a unique ID number - $tempID = $this->generateIdNumber(); - $isUsed = false; - - // Try to figure out if the ID number is not yet used - try { - if (is_object($this->getDatabaseInstance())) { - $isUsed = $this->getDatabaseInstance()->isUniqueIdUsed($tempID, true); - } - } catch (FrameworkException $e) { - // Catches all and ignores all ;-) - } - - if ( - ( - $tempID !== false - ) && ( - ( - $this->getDatabaseInstance() === null - ) || ( - ( - is_object($this->getDatabaseInstance()) - ) && ( - !$isUsed - ) - ) - ) - ) { - // Abort the loop - break; - } - } - - // Debug message - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] uniqueID ist auf %s gesetzt.
\n", - $this->__toString(), - $tempID - )); - - // Apply the new ID - $this->setUniqueID($tempID); - - // Revert maybe corrected class name - if ($corrected) { - $this->setRealClass(""); - } - - // Remove system classes if we are in a system class - if ((isset($this->systemClasses)) && (in_array($this->__toString(), $this->systemClasses))) { - // This may save some RAM... - $this->removeSystemArray(); - } - } - } - - /** - * Generates a new ID number for classes based from the class' real name, - * the description and some random data - * - * @return $tempID The new (temporary) ID number - */ - private final function generateIdNumber () { - return sprintf("%s@%s", - $this->__toString(), - md5(sprintf("%s:%s:%s:%s:%s:%s", - $this->__toString(), - $this->getPartDescr(), - time(), - getenv('REMOTE_ADDR'), - getenv('SERVER_ADDR'), - mt_rand() - )) - ); - } - - /** - * Setter for unique ID - * - * @param $uniqueID The newly generated unique ID number - * @return void - */ - private final function setUniqueID ($uniqueID) { - // Cast to string - $uniqueID = (string) $uniqueID; - - // Debug message - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID gesetzt auf %s.
\n", - $this->__toString(), - $uniqueID - )); - - // Set the ID number - $this->uniqueID = $uniqueID; - } - - /** - * Getter for unique ID - * - * @return $uniqueID The unique ID of this class - */ - public final function getUniqueID () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID angefordert.
\n", - $this->__toString() - )); - return $this->uniqueID; - } - - /** - * Resets or recreates the unique ID number - * - * @return void - */ - public final function resetUniqueID() { - // Sweet and simple... ;-) - $newUniqueID = $this->generateIdNumber(); - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID zurückgesetzt auf %s.
\n", - $this->__toString(), - $newUniqueID - )); - $this->setUniqueID($newUniqueID); - } - - /** - * Getter for simulator description - * - * @return $partDescr The description of this simulation part - */ - public final function getPartDescr () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] getPartDescr erreicht.
\n", - $this->__toString() - )); - if (isset($this->partDescr)) { - return $this->partDescr; - } else { - return null; - } - } - - /** - * Setter for simulation part description - * - * @param $partDescr The description as string for this simulation part - * @return void - */ - public final function setPartDescr ($partDescr) { - $this->partDescr = (String) $partDescr; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Teilbeschreibung wird auf %s gesetzt.
\n", - $this->__toString(), - $this->partDescr - )); - } - - /** - * Validate if given object is the same as current - * - * @param $object An object instance for comparison with this class - * @return boolean The result of comparing both's unique ID - */ - public final function equals ($object) { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Ist %s=%s?
\n", - $this->__toString(), - $this->__toString(), - $object->__toString() - )); - return ($this->getUniqueID() == $object->getUniqueID()); - } - - /** - * Compare if both simulation part description and class name matches - * (shall be enougth) - * - * @param $itemInstance An object instance to an other class - * @return boolean The result of comparing class name simulation part description - */ - public function itemMatches ($itemInstance) { - return ( - ($this->__toString() == $itemInstance->__toString()) - && ($this->getPartDescr() == $itemInstance->getPartDescr()) - ); - } - - /** - * Compare class name of this and given class name - * - * @param $class The class name as string from the other class - * @return boolean The result of comparing both class names - */ - public final function isClass ($class) { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] %s=%s?
\n", - $this->__toString(), - $this->__toString(), - $class - )); - return ($this->__toString() == $class); - } - - /** - * Stub method (only real cabins shall override it) - * - * @return boolean false = is no cabin, true = is a cabin - */ - public function isCabin () { - return false; - } - - /** - * Stub method for tradeable objects - * - * @return boolean false = is not tradeable by the Merchant class, - * true = is a tradeable object - */ - public function isTradeable () { - return false; - } - - /** - * Formats computer generated price values into human-understandable formats - * with thousand and decimal seperators. - * - * @param $value The in computer format value for a price - * @param $currency The currency symbol (use HTML-valid characters!) - * @param $decNum Number of decimals after commata - * @return $price The for the current language formated price string - * @throws MissingDecimalsThousandsSeperatorException If decimals or - * thousands seperator - * is missing - */ - public function formatCurrency ($value, $currency = "€", $decNum = 2) { - // Are all required attriutes set? - if ((!isset($this->decimals)) || (!isset($this->thousands))) { - // Throw an exception - throw new MissingDecimalsThousandsSeperatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING); - } - - // Cast the number - $value = (float) $value; - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] %d wird umformatiert.
\n", - $this->__toString(), - $value - )); - - // Reformat the US number - $price = sprintf("%s %s", - number_format($value, $decNum, $this->decimals, $this->thousands), - $currency - ); - - // Return as string... - return $price; - } - - /** - * Removes number formating characters - * - * @return void - */ - public final function removeNumberFormaters () { - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Zahlenumformatierungszeichen werden entfernt.
\n", - $this->__toString() - )); - unset($this->thousands); - unset($this->decimals); - } - - /** - * Getter for database layer - * - * @return $dbInstance The database layer instance - */ - public final function getDatabaseInstance () { - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Datenbank-Instanz %s angefordert.
\n", - $this->__toString(), - $this->dbInstance - )); - return $this->dbInstance; - } - - /** - * Setter for compressor channel - * - * @param $compressorChannel An instance of CompressorChannel - * @return void - */ - public final function setCompressorChannel (CompressorChannel $compressorChannel) { - self::$compressor = $compressorChannel; - } - - /** - * Getter for compressor channel - * - * @return $compressor The compressor channel - */ - public final function getCompressorChannel () { - return self::$compressor; - } - - /** - * Remove the $systemClasses array from memory - * - * @return void - */ - public final function removeSystemArray () { - unset($this->systemClasses); - } - - /** - * Create a file name and path name from the object's unique ID number. - * The left part of the ID shall always be a valid class name and the - * right part an ID number. - * - * @return $pfn The file name with a prepended path name - * @throws NoArrayCreatedException If explode() fails to create an array - * @throws InvalidArrayCountException If the array contains less or - * more than two elements - */ - public function getPathFileNameFromObject () { - // Get the main object's unique ID. We use this as a path/filename combination - $pathFile = $this->getUniqueID(); - - // Split it up in path and file name - $pathFile = explode("@", $pathFile); - - // 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); - } - - // Auto-append missing trailing slash - $pathFile[0] = $this->addMissingTrailingSlash($pathFile[0]); - - // Create the file name and return it - $pfn = ($pathFile[0] . $pathFile[1]); - return $pfn; - } - - /** - * Appends a trailing slash to a string - * - * @param $str A string (maybe) without trailing slash - * @return $str A string with an auto-appended trailing slash - */ - public final function addMissingTrailingSlash ($str) { - // Is there a trailing slash? - if (substr($str, -1, 1) != "/") $str .= "/"; - return $str; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/class_FrameworkArrayObject.php b/ship-simu/inc/classes/main/class_FrameworkArrayObject.php deleted file mode 100644 index e73f8a8..0000000 --- a/ship-simu/inc/classes/main/class_FrameworkArrayObject.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FrameworkArrayObject extends ArrayObject { - /** - * Constructor for smooth coding style ;-) - * - * @param $class The class's real name - * @return void - */ - public function constructor ($class) { - // $class will be ignored for backward compatiblity - } - - /** - * Get real class' name back - * - * @return $realClass The class' real name - */ - public function __toString () { - return get_class($this); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/compressor/.htaccess b/ship-simu/inc/classes/main/compressor/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/compressor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/compressor/class_Bzip2Compressor.php b/ship-simu/inc/classes/main/compressor/class_Bzip2Compressor.php deleted file mode 100644 index 56e704c..0000000 --- a/ship-simu/inc/classes/main/compressor/class_Bzip2Compressor.php +++ /dev/null @@ -1,122 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 Bzip2Compressor extends BaseFrameworkSystem implements Compressor { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Set description - $this->setPartDescr("BZIP2-Kompressor"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Create a new compressor channel based a given compression handler - * - * @return $cInstance An instance of this class - */ - public final static function createBzip2Compressor () { - // Get new instance - if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) { - // Compressor can maybe be used - $cInstance = new Bzip2Compressor(); - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompression wird verwendet.
\n", - $cInstance->__toString() - )); - } else { - // Routines not found! - $cInstance = null; - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompressionsroutinen nicht gefunden.
\n", - $cInstance->__toString() - )); - } - - // Return the compressor instance - return $cInstance; - } - - /** - * BZIP2 compression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function compressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the compressed stream - return bzcompress($streamData, 1); - } - - /** - * BZIP2 decompression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function decompressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the decompressed stream - return bzdecompress($streamData); - } - - /** - * Getter for the file extension of this compressor - * - * @return $string Returns always "bz2" - */ - public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); - return "bz2"; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/compressor/class_GzipCompressor.php b/ship-simu/inc/classes/main/compressor/class_GzipCompressor.php deleted file mode 100644 index f00b2d0..0000000 --- a/ship-simu/inc/classes/main/compressor/class_GzipCompressor.php +++ /dev/null @@ -1,122 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 GzipCompressor extends BaseFrameworkSystem implements Compressor { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Set description - $this->setPartDescr("GZIP-Kompressor"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Create a new compressor channel based a given compression handler - * - * @return $cInstance An instance of this class - */ - public final static function createGzipCompressor () { - // Get new instance - if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) { - // Compressor can maybe be used - $cInstance = new GzipCompressor(); - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompression wird verwendet.
\n", - $cInstance->__toString() - )); - } else { - // Routines not found! - $cInstance = null; - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompressionsroutinen nicht gefunden.
\n", - $cInstance->__toString() - )); - } - - // Return the compressor instance - return $cInstance; - } - - /** - * GZIP compression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function compressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the compressed stream - return gzcompress($streamData, 1); - } - - /** - * GZIP decompression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function decompressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the decompressed stream - return gzuncompress($streamData); - } - - /** - * Getter for the file extension of this compressor - * - * @return $string Returns always "gz" - */ - public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); - return "gz"; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/compressor/class_NullCompressor.php b/ship-simu/inc/classes/main/compressor/class_NullCompressor.php deleted file mode 100644 index b4a1236..0000000 --- a/ship-simu/inc/classes/main/compressor/class_NullCompressor.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 NullCompressor extends BaseFrameworkSystem implements Compressor { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Set description - $this->setPartDescr("Null-Kompressor"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Create a new compressor channel based a given compression handler - * - * @return $cInstance An instance of this class - */ - public final static function createNullCompressor () { - // Get new instance - $cInstance = new NullCompressor(); - - // Return the compressor instance - return $cInstance; - } - - /** - * Null compression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function compressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the compressed stream - return $streamData; - } - - /** - * Null decompression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function decompressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the decompressed stream - return $streamData; - } - - /** - * Getter for the file extension of this compressor - * - * @return $string Returns always "bz2" - */ - public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); - return "null"; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/console/.htaccess b/ship-simu/inc/classes/main/console/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/console/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/console/class_ConsoleTools.php b/ship-simu/inc/classes/main/console/class_ConsoleTools.php deleted file mode 100644 index 97f1bc2..0000000 --- a/ship-simu/inc/classes/main/console/class_ConsoleTools.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ConsoleTools extends BaseFrameworkSystem { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Console-Tools"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Aquires the IP address of this host by reading the /etc/hostname file and solving it - * - * @return $ip The resolved IP address - */ - public static function aquireSelfIPAddress () { - // Local IP by default - $ip = "127.0.0.1"; - - // Get a new instance - $helper = new ConsoleTools(); - - try { - // Get a file pointer - $io = FrameworkFileInputPointer::createFrameworkFileInputPointer("/etc/hostname"); - - // Read the file - $hostname = trim($io->readFromFile()); - $helper->getDebugInstance()->output(sprintf("[%s:] Our host name is: %s
\n", - $helper->__toString(), - $hostname - )); - - // Close the file - $io->closeFile(); - - // Resolve it - $ipResolved = gethostbyname($hostname); - if (($ipResolved !== false) && ($ipResolved != $hostname)) { - // Okay, this works! - $ip = $ipResolved; - - // Debug message - $helper->getDebugInstance()->output(sprintf("[%s:] Resolved IP address is: %s
\n", - $helper->__toString(), - $ip - )); - } - } catch (FrameworkException $e) { - // Do nothing here - } - - // Return the IP address - return $ip; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/database/.htaccess b/ship-simu/inc/classes/main/database/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/database/class_BaseDatabaseFrontend.php b/ship-simu/inc/classes/main/database/class_BaseDatabaseFrontend.php deleted file mode 100644 index 7d6f8a0..0000000 --- a/ship-simu/inc/classes/main/database/class_BaseDatabaseFrontend.php +++ /dev/null @@ -1,105 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ -abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject { - /** - * The limiter instance - */ - private $limitInstance = null; - - /** - * Private constructor - * - * @return void - */ - private function __construct($class) { - // Call parent constructor - parent::constructor($class); - - // Debug message - if (((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Clean up a little - $this->removeNumberFormaters(); - } - - /** - * The public constructor - * - * @return void - */ - public function constructor ($class) { - // Calls just the private one - $this->__construct($class); - } - - /** - * Getter for limitation instance - * - * @return $limitInstance The instance to the object ObjectLimits - */ - public final function getLimitInstance () { - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s angefordert.
\n", - $this->__toString(), - $this->limitInstance->__toString() - )); - return $this->limitInstance; - } - - /** - * Setup limitation for the saving process - * - * @param $limitInstance An instance of ObjectLimits which contains - * elements we shall exclusivly include in - * saving process - * @return void - */ - public final function limitObject (ObjectLimits $limitInstance) { - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s soll verwendet werden.
\n", - $this->__toString(), - $limitInstance->__toString() - )); - - // Get limitArray for validation - $array = $limitInstance->getLimitArray(); - - // Sanity-check if some limitations are in the object - if ($array->count() > 0) { - // Okay, there is enougth - $this->limitInstance = $limitInstance; - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s wird verwendet und beinhaltet %s Einträge.
\n", - $this->__toString(), - $limitInstance->__toString(), - $array->count() - )); - } - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/database/classes/.htaccess b/ship-simu/inc/classes/main/database/classes/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/database/classes/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/database/classes/class_LocalFileDatabase.php b/ship-simu/inc/classes/main/database/classes/class_LocalFileDatabase.php deleted file mode 100644 index ff5f1dd..0000000 --- a/ship-simu/inc/classes/main/database/classes/class_LocalFileDatabase.php +++ /dev/null @@ -1,515 +0,0 @@ - - * @version 0.1 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 IO handler for file handling which should be FileIOHandler. - */ - private $ioInstance = null; - - /** - * 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 - */ - private function __construct() { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Dateidatenbankschicht"); - - // 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); - } - - // Debug output - if (defined('DEBUG_DATABASE')) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Es werden lokale Dateien zum Speichern von Objekten verwendet.
\n", - $dbInstance->__toString() - )); - - // Set save path and IO instance - $dbInstance->setSavePath($savePath); - $dbInstance->setIOInstance($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; - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Lokaler Speicherpfad %s wird verwendet.
\n", - $this->__toString(), - $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; - } - - /** - * Getter for file extension - * - * @return $fileExtension The file extension for all file names - */ - public final function getFileExtension () { - return $this->fileExtension; - } - - /** - * 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); - } - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s soll in eine lokale Datei gespeichert werden.
\n", - $this->__toString(), - $object->__toString() - )); - - // 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); - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s ist nach der Serialisierung %s Byte gross.
\n", - $this->__toString(), - $object->__toString(), - strlen($serialized) - )); - - // 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->getIOInstance()->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->getIOInstance(); - - // 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; - } - - /** - * Getter for the file IO instance - * - *�@return $ioInstance An instance for IO operations - * @see FileIOHandler The concrete handler for IO operations - */ - public final function getIOInstance () { - return $this->ioInstance; - } - - /** - * Setter for the file IO instance - * - * @param $ioInstance An instance for IO operations (should be - * FileIOHandler) - * @return void - */ - public final function setIOInstance (FileIOHandler $ioInstance) { - $this->ioInstance = $ioInstance; - } - - /** - * Setter for the last read file - * - * @param $fqfn The FQFN of the last read file - * @return void - */ - private 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 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; - } - - /** - * 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 function getObjectFromCachedData ($uniqueID) { - // Get instance for file handler - $inputHandler = $this->getIOInstance(); - - // 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/ship-simu/inc/classes/main/debug/.htaccess b/ship-simu/inc/classes/main/debug/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/debug/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/debug/class_DebugConsoleOutput.php b/ship-simu/inc/classes/main/debug/class_DebugConsoleOutput.php deleted file mode 100644 index d92648e..0000000 --- a/ship-simu/inc/classes/main/debug/class_DebugConsoleOutput.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DebugConsoleOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Debug-Ausgabe auf Konsole"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Creates an instance of this class - * - * @return $debugInstance The prepared debug instance - */ - public final static function createDebugConsoleOutput () { - // Get a new instance - $debugInstance = new DebugConsoleOutput(); - - // Return it - return $debugInstance; - } - - /** - * Outputs the given data without HTML tags - * - * @param $output The HTML'ed output - * @return void - */ - public final function outputStream ($output) { - print html_entity_decode(strip_tags($output)); - } - - /** - * Outputs the given data without HTML tags - * - * @param $output The HTML'ed output - * @return void - */ - public final function output ($outStream=false) { - // false will be silently ignored - if ($outStream !== false) { - $this->outputStream($outStream); - } - } - - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - public final function assignVariable ($var, $value) { - trigger_error(__METHOD__.": Stub!"); - } -} - -// -?> diff --git a/ship-simu/inc/classes/main/debug/class_DebugErrorLogOutput.php b/ship-simu/inc/classes/main/debug/class_DebugErrorLogOutput.php deleted file mode 100644 index 8916b05..0000000 --- a/ship-simu/inc/classes/main/debug/class_DebugErrorLogOutput.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Debug-Ausgabe in error_log()"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Creates an instance of this class - * - * @return $debugInstance The prepared debug instance - */ - public final static function createDebugErrorLogOutput () { - // Get a new instance - $debugInstance = new DebugErrorLogOutput(); - - // Return it - return $debugInstance; - } - - /** - * Outputs the given data without HTML tags - * - * @param $output The HTML'ed output - * @return void - */ - public final function outputStream ($output) { - // Split multiple lines into and array to put them out line-by-line - $errorLines = explode("\n", $output); - foreach ($errorLines as $err) { - $err = trim($err); - // Log only none-empty lines - if (!empty($err)) { - // Log this line - error_log(html_entity_decode(strip_tags($err)), 0); - } - } - } - - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - public final function assignVariable ($var, $value) { - trigger_error(__METHOD__.": Stub!"); - } - - /** - * Output the code - * - * @return void - */ - public final function output ($outStream=false) { - // false will be silently ignored - if ($outStream !== false) { - $this->outputStream($outStream); - } - } -} - -// -?> diff --git a/ship-simu/inc/classes/main/debug/class_DebugWebOutput.php b/ship-simu/inc/classes/main/debug/class_DebugWebOutput.php deleted file mode 100644 index 062b2cc..0000000 --- a/ship-simu/inc/classes/main/debug/class_DebugWebOutput.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DebugWebOutput extends BaseFrameworkSystem implements Debugger { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Debug-Ausgabe auf Konsole"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Creates an instance of this class - * - * @return $debugInstance The prepared debug instance - */ - public final static function createDebugWebOutput () { - // Get a new instance - $debugInstance = new DebugWebOutput(); - - // Return it - return $debugInstance; - } - - /** - * Outputs the given data directly - * - * @param $output The HTML output - * @return void - */ - public final function outputStream ($output) { - trigger_error($output); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/extended/.htaccess b/ship-simu/inc/classes/main/extended/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/extended/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/extended/class_ObjectLimits.php b/ship-simu/inc/classes/main/extended/class_ObjectLimits.php deleted file mode 100644 index 8cfb0ec..0000000 --- a/ship-simu/inc/classes/main/extended/class_ObjectLimits.php +++ /dev/null @@ -1,130 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ObjectLimits extends BaseFrameworkSystem { - /** - * Limitation array for storing all attribute names we will use later - * only. - */ - private $limitArray = null; - - /** - * Private constructor - * - * @return void - */ - private final function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set part description - $this->setPartDescr("Limitierungsobjekt"); - - // Create unique ID number - $this->createUniqueID(); - - // Clean up a little - $this->removeNumberFormaters(); - } - - /** - * Create a new ObjectLimits object and (maybe prepare it a little) - * - * @param $limitationArray The limitation array we "walk" through - * @return $limitInstance The instance to an ObjectLimits object - */ - public final static function createObjectLimits (array $limitationArray) { - // Is there a limitation array given? - if (count($limitationArray) > 0) { - // Get instance - $limitInstance = new ObjectLimits(); - - // Get all limitations and do them - foreach ($limitationArray as $limit) { - // What shall we limitate? - if ($limit instanceof FrameworkInterface) { - // Add an object - $limitInstance->addObject($limit); - } elseif (is_string($limit)) { - // Add a string - $limitInstance->addString($limit); - } else { - // Others are not supported (yet) - throw new UnsupportedLimitationPartException($limit, self::EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED); - } - } - - // Return instance - return $limitInstance; - } else { - // No limitation given so we send "null" back - return null; - } - } - - /** - * Add an object's name to the limitation list - * - * @param $object The object's name we shall add to the list - * @return void - */ - private final function addObject (FrameworkInterface $object) { - // Auto-initialization - if (is_null($this->limitArray)) { - // Initialize this array - $this->limitArray = new FrameworkArrayObject(); - } - - // Add the object's name to it - $this->limitArray->append($object->__toString()); - } - - /** - * Add a string directly to the limitation list - * - * @param $str The string we want to add directly - * @return void - */ - private final function addString ($str) { - // Auto-initialization - if (is_null($this->limitArray)) { - // Initialize this array - $this->limitArray = new FrameworkArrayObject(); - } - - // Add the direct string to ArrayObject - $this->limitArray->append($str); - } - - /** - * Getter for limitArray - * - * @return $limitArray The object ArrayObject which holds limitations - */ - public final function getLimitArray () { - return $this->limitArray; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/extended/class_SerializationContainer.php b/ship-simu/inc/classes/main/extended/class_SerializationContainer.php deleted file mode 100644 index b8790ea..0000000 --- a/ship-simu/inc/classes/main/extended/class_SerializationContainer.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 SerializationContainer extends FrameworkArrayObject { - /** - * Public constructor, if you like to have an object of this class... - * - * @return void - */ - public function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Debug message - if ((defined('DEBUG_CONTAINER')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[SerializationContainer:] Konstruktor erreicht.
\n"); - } - - /** - * Create a SerializationContainer object by applying the limitations - * in $limitInstance on $object. The resulting data container will only - * hold the attributed and their values which we have specified in - * the limitation object. - * - * @param $limitInstance The instance to the object ObjectLimits - * @param $object The origin object. We don't touch it here. - * @return $containerInstance An instance of SerializationContainer - * @throws GetterNotFoundException If a getter was not found - */ - public final static function createSerializationContainer (ObjectLimits $limitInstance, $object) { - // Get an instance - $containerInstance = new SerializationContainer(); - - // Iterate through the whole limitation array - for ($idx = $limitInstance->getLimitArray()->getIterator(); $idx->valid(); $idx->next()) { - // Get current item from list - $curr = ucfirst($idx->current()); - - // Is the required method available? - if (method_exists($object, sprintf("get%s", $curr))) { - // Generate a command for getting it - $eval = sprintf("\$value = \$object->get%s();", - $curr - ); - - // Debug eval command - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $limitInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", - $this->__toString(), - htmlentities($eval) - )); - - // Run it - @eval($eval); - - // Add this item to the container list - $containerInstance->append(array( - 'name' => $curr, - 'value' => $value - )); - } else { - // Throw an exception - throw new GetterNotFoundException(array($object, $curr), self::EXCEPTION_GETTER_IS_MISSING); - } - } // END - for - - // Return container instance - return $containerInstance; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/io/.htaccess b/ship-simu/inc/classes/main/io/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/io/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/io/class_FileIOStream.php b/ship-simu/inc/classes/main/io/class_FileIOStream.php deleted file mode 100644 index 0872f91..0000000 --- a/ship-simu/inc/classes/main/io/class_FileIOStream.php +++ /dev/null @@ -1,231 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FileIOStream extends BaseFrameworkSystem implements FileInputStreamer, FileOutputStreamer { - /** - * Private constructor - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set part description - $this->setPartDescr("Universal Datei-Ein-/Ausgabesystem"); - - // Create unique ID - $this->createUniqueID(); - - // Clean-up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); - } - - /** - * Create a file IO stream. This is a class for performing all actions - * on files like creating, deleting and loading them. - * - * @return $ioInstance An instance of FileIOStream - */ - public final static function createFileIOStream () { - // Create new instance - $ioInstance = new FileIOStream(); - - // Return the instance - return $ioInstance; - } - - /** - * Saves data to a given local file - * - * @param $fileName The file name for the to be saved file - * @param $dataArray The data we shall store to the file - * @return void - * @see FileOutputStreamer - */ - public final function saveFile ($fileName, $dataArray) { - // Try it five times - $dirName = ""; $fileInstance = null; - for ($idx = 0; $idx < 5; $idx++) { - // Get a file output pointer - try { - $fileInstance = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fileName, 'w'); - } catch (FilePointerNotOpenedException $e) { - // Create missing directory - $dirName = dirname($fileName); - for ($idx2 = 0; $idx2 < (2 - $idx); $idx2++) { - $dirName = dirname($dirName); - } - // Try to create it - @mkdir($dirName); - } - } - - // Write a header information for validation purposes - $fileInstance->writeToFile(sprintf("@head^%s:%s:%s:%s\n", - $dataArray[0], - time(), - strlen($dataArray[1]), - md5($dataArray[1]) - )); - - // Encode the (maybe) binary stream with Base64 - $b64Stream = base64_encode($dataArray[1]); - - // write the data line by line - $line = str_repeat(" ", 50); $idx = 0; - while (strlen($line) == 50) { - // Get 50 chars or less - $line = substr($b64Stream, $idx, 50); - - // Save it to the stream - $fileInstance->writeToFile(sprintf("@data^%s:%s\n", - $line, - md5($line) - )); - - // Advance to the next 50-chars block - $idx += 50; - } - - // Close the file - $fileInstance->closeFile(); - } - - /** - * Reads from a local file - * - * @param $fqfn The full-qualified file-name which we shall load - * @return $array An array with the element 'header' and 'data' - * @see FileInputStreamer - */ - public final function loadFileContents ($fqfn) { - // Initialize some variables and arrays - $inputBuffer = ""; - $lastBuffer = ""; - $header = array(); - $data = array(); - $readData = ""; // This will contain our read data - - // Get a file input handler - $fileInstance = FrameworkFileInputPointer::createFrameworkFileInputPointer($fqfn); - - // Read all it's contents (we very and transparently decompress it below) - while ($readRawLine = $fileInstance->readFromFile()) { - // Add the read line to the buffer - $inputBuffer .= $readRawLine; - - // Break infinite loop maybe caused by the input handler - if ($lastBuffer == $inputBuffer) break; - - // Remember last read line for avoiding possible infinite loops - $lastBuffer = $inputBuffer; - } - - // Close directory handle - $fileInstance->closeFile(); - - // Convert it into an array - $inputBuffer = explode("\n", $inputBuffer); - - // Now process the read lines and verify it's content - foreach ($inputBuffer as $rawLine) { - // Trim it a little but not the leading spaces/tab-stops - $rawLine = rtrim($rawLine); - - // Analyze this line - if (substr($rawLine, 0, 5) == "@head") { - // Header found, so let's extract it - $header = explode("^", $rawLine); - $header = trim($header[1]); - - // Now we must convert it again into an array - $header = explode(":", $header); - - // Is the header (maybe) valid? - if (count($header) != 4) { - // Throw an exception - throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - } elseif (substr($rawLine, 0, 5) == "@data") { - // Is a data line! - $data = explode("^", $rawLine); - $data = $data[1]; - - // First element is the data, second the MD5 checksum - $data = explode(":", $data); - - // Validate the read line - if (count($data) == 2) { - if (md5($data[0]) != $data[1]) { - // MD5 hash did not match! - throw new InvalidMD5ChecksumException(array($this, md5($data[0]), $data[1]), self::EXCEPTION_MD5_CHECKSUMS_MISMATCH); - } - } else { - // Invalid count! - throw new InvalidArrayCountException(array($this, "data", count($data), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - - // Add this to the readData string - $readData .= $data[0]; - } else { - // Other raw lines than header/data tagged lines and re-add the new-line char - $readData .= $rawLine."\n"; - } - } - - // Was raw lines read and no header/data? - if ((!empty($readData)) && (count($header) == 0) && (count($data) == 0)) { - // Return raw lines back - return $readData; - } - - // Was a header found? - if (count($header) != 4) { - // Throw an exception - throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - - // Decode all from Base64 - $readData = @base64_decode($readData); - - // Does the size match? - if (strlen($readData) != $header[2]) { - // Size did not match - throw new InvalidDataLengthException(array($this, strlen($readData), $header[2]), self::EXCEPTION_UNEXPECTED_STRING_SIZE); - } - - // Validate the decoded data with the final MD5 hash - if (md5($readData) != $header[3]) { - // MD5 hash did not match! - throw new InvalidMD5ChecksumException(array($this, md5($readData), $header[3]), self::EXCEPTION_MD5_CHECKSUMS_MISMATCH); - } - - // Return all in an array - return array( - 'header' => $header, - 'data' => $readData - ); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/io/class_FrameworkDirectoryPointer.php b/ship-simu/inc/classes/main/io/class_FrameworkDirectoryPointer.php deleted file mode 100644 index 796c970..0000000 --- a/ship-simu/inc/classes/main/io/class_FrameworkDirectoryPointer.php +++ /dev/null @@ -1,267 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FrameworkDirectoryPointer extends BaseFrameworkSystem { - /** - * The current path we are working in - */ - private $pathName = ""; - - /** - * The directory pointer - */ - private $dirPointer = null; - - /** - * Private constructor - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set part description - $this->setPartDescr("Verzeichnis-Handler"); - - // Create unique ID - $this->createUniqueID(); - - // Clean-up a little - $this->removeNumberFormaters(); - } - - /** - * Destructor for cleaning purposes, etc - */ - public function __destruct() { - // Is there a resource pointer? Then we have to close the directory here! - if (is_resource($this->getPointer())) { - // Try to close a directory - $this->closeDirectory(); - } - - // Call the parent destructor - parent::__destruct(); - } - - /** - * Create a directory pointer based on the given path. The path will also - * be verified here. - * - * @param $pathName The path name we shall pass - * to opendir() - * @param $inConstructor If we are in de/con-structor - * or from somewhere else - * @throws PathIsEmptyException If the provided path name - * is empty - * @throws InvalidPathStringException If the provided path name is - * not a string - * @throws PathIsNoDirectoryException If the provided path name is - * not valid - * @throws PathReadProtectedException If the provided path name is - * read-protected - * @throws DirPointerNotOpened If opendir() returns not a - * directory resource - * @return $pointerInstance A prepared instance of - * FrameworkDirectoryPointer - */ - public final static function createFrameworkDirectoryPointer ($pathName, $inConstructor = false) { - // Some pre-sanity checks... - if (is_null($pathName)) { - // No pathname given - if ($inConstructor) { - return null; - } else { - throw new PathIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } - } elseif (!is_string($pathName)) { - // Is not a string - if ($inConstructor) { - return null; - } else { - throw new InvalidPathStringException(null, self::EXCEPTION_INVALID_STRING); - } - } elseif (!is_dir($pathName)) { - // Not a directory - if ($inConstructor) { - return null; - } else { - throw new PathIsNoDirectoryException($pathName, self::EXCEPTION_INVALID_PATH_NAME); - } - } elseif (!is_readable($pathName)) { - // Not readable - if ($inConstructor) { - return null; - } else { - throw new PathReadProtectedException($pathName, self::EXCEPTION_READ_PROTECED_PATH); - } - } - - // Try to open a handler - $dirPointer = @opendir($pathName); - if (!is_resource($dirPointer)) { - // Something bad happend - if ($inConstructor) { - return null; - } else { - throw new DirPointerNotOpenedException($pathName, self::EXCEPTION_DIR_POINTER_INVALID); - } - } - - // Create new instance - $pointerInstance = new FrameworkDirectoryPointer(); - - // Set directory pointer and path name - $pointerInstance->setPointer($dirPointer); - $pointerInstance->setPathName($pathName); - - // Return the instance - return $pointerInstance; - } - - /** - * Read raw lines of data from a directory pointer and return the data - * - * @return string Directory and/or file names read from the current - * directory pointer - * @throws NullPointerException If the directory pointer instance - * is not set by setPointer() - * @throws InvalidDirectoryResourceException If there is being set - * an invalid directory resource - */ - public function readRawDirectory () { - if (is_null($this->getPointer())) { - // Pointer not initialized - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_resource($this->getPointer())) { - // Pointer is not a valid resource! - throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - - // Read data from the directory pointer and return it - return readdir($this->getPointer()); - } - - /** - * Read lines from the current directory pointer except some parts - * - * @param $except Some parts of a directory we want to ignore. - * Valid: dirs - * Other values will be silently ignored - * @return string Directory and/or file names read from the current - * directory pointer - */ - public function readDirectoryExcept ($except = "") { - if ((empty($except)) || (!is_array($except)) || (count($except) == 0)) { - // No exception given, so read all data - return $this->readRawDirectory(); - } - - // Read a raw line... - $rawLine = $this->readRawDirectory(); - - // Shall we exclude directories? - if ((!is_null($rawLine)) && ($rawLine !== false) && (in_array($rawLine, $except))) { - // Exclude this part - return $this->readDirectoryExcept($except); - } elseif ((!is_null($rawLine)) && ($rawLine !== false)) { - // Return read data - return $rawLine; - } - - // End pointer reached - return null; - } - - /** - * Close a directory source and set it's instance to null and the path name - * to empty - * - * @return void - * @throws NullPointerException If the directory pointer instance - * is not set by setPointer() - * @throws InvalidDirectoryResourceException If there is being set - */ - public function closeDirectory () { - if (is_null($this->getPointer())) { - // Pointer not initialized - return; - } elseif (!is_resource($this->getPointer())) { - // Pointer is not a valid resource! - throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - - // Close the directory pointer and reset the instance variable - @closedir($this->getPointer()); - $this->setPointer(null); - $this->setPathName(""); - } - - /** - * Setter for the directory pointer - * - * @param $dirPointer The directory resource - * @return void - */ - public final function setPointer ($dirPointer) { - // Sanity-check if the pointer is a valid directory resource - if (is_resource($dirPointer) || is_null($dirPointer)) { - // Is a valid resource - $this->dirPointer = $dirPointer; - } else { - // Throw exception - throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - } - - /** - * Getter for the directory pointer - * - * @return $dirPointer The directory pointer which shall be a valid - * directory resource - */ - public final function getPointer () { - return $this->dirPointer; - } - - /** - * Setter for path name - * - * @param $pathName The new path name - * @return void - */ - public final function setPathName ($pathName) { - $pathName = (string) $pathName; - $this->pathName = $pathName; - } - - /** - * Getter for path name - * - * @return $pathName The current path name - */ - public final function getPathName () { - return $this->pathName; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/io/class_FrameworkFileInputPointer.php b/ship-simu/inc/classes/main/io/class_FrameworkFileInputPointer.php deleted file mode 100644 index 954dffe..0000000 --- a/ship-simu/inc/classes/main/io/class_FrameworkFileInputPointer.php +++ /dev/null @@ -1,218 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FrameworkFileInputPointer extends BaseFrameworkSystem { - /** - * The current file we are working in - */ - private $fileName = ""; - - /** - * The file pointer - */ - private $filePointer = null; - - /** - * Private constructor - */ - private final function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set part description - $this->setPartDescr("Dateiausgabe-Handler"); - - // Create unique ID - $this->createUniqueID(); - - // Clean-up a little - $this->removeNumberFormaters(); - } - - /** - * Destructor for cleaning purposes, etc - */ - public final function __destruct() { - // Is there a resource pointer? Then we have to close the file here! - if (is_resource($this->getPointer())) { - // Try to close a file - $this->closeFile(); - } - - // Call the parent destructor - parent::__destruct(); - } - - /** - * Create a file pointer based on the given file. The file will also - * be verified here. - * - * @param $fileName The file name we shall pass - * to fopen() - * @throws FileIsEmptyException If the provided file name is empty. - * @throws FilePointerNotOpenedException If fopen() returns not a - * file resource - * @return void - */ - public final static function createFrameworkFileInputPointer ($fileName) { - // Some pre-sanity checks... - if (is_null($fileName)) { - // No filename given - throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } - - // Try to open a handler - $filePointer = @fopen($fileName, 'rb'); - if (($filePointer === null) || ($filePointer === false)) { - // Something bad happend - throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); - } - - // Create new instance - $pointerInstance = new FrameworkFileInputPointer(); - - // Set file pointer and file name - $pointerInstance->setPointer($filePointer); - $pointerInstance->setFileName($fileName); - - // Return the instance - return $pointerInstance; - } - - /** - * Read data a file pointer - * - * @return mixed The result of fread() - * @throws NullPointerException If the file pointer instance - * is not set by setPointer() - * @throws InvalidFileResourceException If there is being set - * an invalid file resource - */ - public function readFromFile () { - if (is_null($this->getPointer())) { - // Pointer not initialized - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_resource($this->getPointer())) { - // Pointer is not a valid resource! - throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - - // Read data from the file pointer and return it - return fread($this->getPointer(), 1024); - } - - /** - * Read lines from a file pointer - * - * @return mixed The result of fread() - * @throws NullPointerException If the file pointer instance - * is not set by setPointer() - * @throws InvalidFileResourceException If there is being set - * an invalid file resource - */ - public function readLinesFromFile () { - if (is_null($this->getPointer())) { - // Pointer not initialized - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_resource($this->getPointer())) { - // Pointer is not a valid resource! - throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - - // Read data from the file pointer and return it - return fgets($this->getPointer(), 1024); - } - - /** - * Close a file source and set it's instance to null and the file name - * to empty - * - * @return void - * @throws NullPointerException If the file pointer instance - * is not set by setPointer() - * @throws InvalidFileResourceException If there is being set - */ - public function closeFile () { - if (is_null($this->getPointer())) { - // Pointer not initialized - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_resource($this->getPointer())) { - // Pointer is not a valid resource! - throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - - // Close the file pointer and reset the instance variable - @fclose($this->getPointer()); - $this->setPointer(null); - $this->setFileName(""); - } - - /** - * Setter for the file pointer - * - * @param $filePointer File resource - * @return void - */ - public final function setPointer ($filePointer) { - // Sanity-check if the pointer is a valid file resource - if (is_resource($filePointer) || is_null($filePointer)) { - // Is a valid resource - $this->filePointer = $filePointer; - } else { - // Throw exception - throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - } - - /** - * Getter for the file pointer - * - * @return $filePointer The file pointer which shall be a valid - * file resource - */ - public final function getPointer () { - return $this->filePointer; - } - - /** - * Setter for file name - * - * @param $fileName The new file name - * @return void - */ - public final function setFileName ($fileName) { - $fileName = (string) $fileName; - $this->fileName = $fileName; - } - - /** - * Getter for file name - * - * @return $fileName The current file name - */ - public final function getFileName () { - return $this->fileName; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/io/class_FrameworkFileOutputPointer.php b/ship-simu/inc/classes/main/io/class_FrameworkFileOutputPointer.php deleted file mode 100644 index fba4602..0000000 --- a/ship-simu/inc/classes/main/io/class_FrameworkFileOutputPointer.php +++ /dev/null @@ -1,198 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FrameworkFileOutputPointer extends BaseFrameworkSystem { - /** - * The current file we are working in - */ - private $fileName = ""; - - /** - * The file pointer - */ - private $filePointer = null; - - /** - * Private constructor - */ - private final function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set part description - $this->setPartDescr("Dateiausgabe-Handler"); - - // Create unique ID - $this->createUniqueID(); - - // Clean-up a little - $this->removeNumberFormaters(); - } - - /** - * Destructor for cleaning purposes, etc - */ - public final function __destruct() { - // Is there a resource pointer? Then we have to close the file here! - if (is_resource($this->getPointer())) { - // Try to close a file - $this->closeFile(); - } - - // Call the parent destructor - parent::__destruct(); - } - - /** - * Create a file pointer based on the given file. The file will also - * be verified here. - * - * @param $fileName The file name we shall pass - * to fopen() - * @param $mode The output mode ('w', 'a' are valid) - * @throws FileIsEmptyException If the provided file name is empty. - * @throws FilePointerNotOpened If fopen() returns not a file - * resource - * @return void - */ - public final static function createFrameworkFileOutputPointer ($fileName, $mode) { - // Some pre-sanity checks... - if (is_null($fileName)) { - // No filename given - throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } - - // Try to open a handler - $filePointer = @fopen($fileName, $mode); - if (($filePointer === null) || ($filePointer === false)) { - // Something bad happend - throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID); - } - - // Create new instance - $pointerInstance = new FrameworkFileOutputPointer(); - - // Set file pointer and file name - $pointerInstance->setPointer($filePointer); - $pointerInstance->setFileName($fileName); - - // Return the instance - return $pointerInstance; - } - - /** - * Write data to a file pointer - * - * @param $dataStream The data stream we shall write to the file - * @return mixed The result of fwrite() - * @throws NullPointerException If the file pointer instance - * is not set by setPointer() - * @throws InvalidFileResourceException If there is being set - * an invalid file resource - */ - public function writeToFile ($dataStream) { - if (is_null($this->getPointer())) { - // Pointer not initialized - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_resource($this->getPointer())) { - // Pointer is not a valid resource! - throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - - // Read data from the file pointer and return it - return fwrite($this->getPointer(), $dataStream); - } - - /** - * Close a file source and set it's instance to null and the file name - * to empty - * - * @return void - * @throws NullPointerException If the file pointer instance - * is not set by setPointer() - * @throws InvalidFileResourceException If there is being set - */ - public function closeFile () { - if (is_null($this->getPointer())) { - // Pointer not initialized - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_resource($this->getPointer())) { - // Pointer is not a valid resource! - throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - - // Close the file pointer and reset the instance variable - @fclose($this->getPointer()); - $this->setPointer(null); - $this->setFileName(""); - } - - /** - * Setter for the file pointer - * - * @param $filePointer File resource - * @return void - */ - public final function setPointer ($filePointer) { - // Sanity-check if the pointer is a valid file resource - if (is_resource($filePointer) || is_null($filePointer)) { - // Is a valid resource - $this->filePointer = $filePointer; - } else { - // Throw exception - throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER); - } - } - - /** - * Getter for the file pointer - * - * @return $filePointer The file pointer which shall be a valid - * file resource - */ - public final function getPointer () { - return $this->filePointer; - } - - /** - * Setter for file name - * - * @param $fileName The new file name - * @return void - */ - public final function setFileName ($fileName) { - $fileName = (string) $fileName; - $this->fileName = $fileName; - } - - /** - * Getter for file name - * - * @return $fileName The current file name - */ - public final function getFileName () { - return $this->fileName; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/language/.htaccess b/ship-simu/inc/classes/main/language/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/language/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/language/class_LanguageSystem.php b/ship-simu/inc/classes/main/language/class_LanguageSystem.php deleted file mode 100644 index c9bf64d..0000000 --- a/ship-simu/inc/classes/main/language/class_LanguageSystem.php +++ /dev/null @@ -1,169 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage { - /** - * The full-qualified base path for the language include files - */ - private $basePath = ""; - - /** - * The 2-char language code - */ - private $langCode = "xx"; // This will later be overwritten! - - /** - * The array-object for all language strings - */ - private $langStrings = null; - - /** - * An instance of this class - */ - private static $thisInstance = null; - - /** - * Private constructor - * - * @return void - */ - private final function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set part description - $this->setPartDescr("Sprachsystem"); - - // Create unique ID number - $this->createUniqueID(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); - } - - /** - * Creates an instance of the class LanguageSystem and prepares it for usage - * - * @param $basePath The local base path for all language strings - * @return $langInstance An instance of LanguageSystem - * @throws LanguagePathIsEmptyException If the provided $basePath is empty - * @throws InvalidLanguagePathStringException If $basePath is no string - * @throws LanguagePathIsNoDirectoryException If $basePath is no - * directory or not found - * @throws LanguagePathReadProtectedException If $basePath is - * read-protected - */ - public final static function createLanguageSystem ($basePath) { - // Get a new instance - $langInstance = new LanguageSystem(); - - // Is the base path valid? - if (empty($basePath)) { - // Language path is empty - throw new LanguagePathIsEmptyException($langInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!is_string($basePath)) { - // Is not a string - throw new InvalidLanguagePathStringException(array($langInstance, $basePath), self::EXCEPTION_INVALID_STRING); - } elseif (!is_dir($basePath)) { - // Is not a path - throw new LanguagePathIsNoDirectoryException(array($langInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME); - } elseif (!is_readable($basePath)) { - // Is not readable - throw new LanguagePathReadProtectedException(array($langInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH); - } - - // Set the base path - $langInstance->setBasePath($basePath); - - // Initialize the variable stack - $langInstance->initLanguageStrings(); - - // Set language code from default config - $langInstance->setLanguageCode($langInstance->getConfigInstance()->readConfig("default_lang")); - - // Remember this instance - self::$thisInstance = $langInstance; - - // Return the prepared instance - return $langInstance; - } - - /** - * Singleton getter for this instance - * - * @return $thisInstance An instance of this class - */ - public final static function getInstance () { - return self::$thisInstance; - } - - /** - * Initialize the array-object for all later language strings - * - * @return void - */ - public function initLanguageStrings () { - $this->langStrings = new FrameworkArrayObject(); - } - - /** - * Setter for base path - * - * @param $basePath The local base path for all templates - * @return void - */ - public final function setBasePath ($basePath) { - // Cast it - $basePath = (string) $basePath; - - // And set it - $this->basePath = $basePath; - } - - /** - * Getter for language code - * - * @return $langCode The language code for the current application - */ - public final function getLanguageCode () { - return $this->langCode; - } - - /** - * Setter for language code - * - * @param $langCode The language code for the current application - * @return void - */ - public final function setLanguageCode ($langCode) { - // Cast it - $langCode = (string) $langCode; - - // And set it (only 2 chars) - $this->langCode = substr($langCode, 0, 2); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/output/.htaccess b/ship-simu/inc/classes/main/output/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/output/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/output/class_ConsoleOutput.php b/ship-simu/inc/classes/main/output/class_ConsoleOutput.php deleted file mode 100644 index 26dca78..0000000 --- a/ship-simu/inc/classes/main/output/class_ConsoleOutput.php +++ /dev/null @@ -1,120 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer { - /** - * The instance for the singleton design pattern - */ - private static $consoleInstance = null; - - /** - * Assigned variables - */ - private $vars = array(); - - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Console-Ausgabe-Handler"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Create a new web output system and set the content type - * - * @param $contentType A valid content-type - * @return $debugInstance An instance of this middleware class - */ - public final static function createConsoleOutput ($contentType) { - // Cast the content-type to string - $contentType = (string) $contentType; - $contentType = trim($contentType); - - // Get instance - self::$consoleInstance = new ConsoleOutput(); - - // Set the content type - if (!empty($contentType)) { - @header(sprintf("Content-type: %s", - $contentType - )); - } - - // Return instance - return self::$consoleInstance; - } - - /** - * Getter for an instance of this class - * - * @return $consoleInstance An instance of this class - */ - public final static function getInstance() { - if (is_null(self::$consoleInstance)) { - $contentType = FrameworkConfiguration::getInstance()->readConfig("web_content_type"); - self::$consoleInstance = ConsoleOutput::createConsoleOutput($contentType); - } - return self::$consoleInstance; - } - - /** - * Output the code - * - * @param $outStream Something we shall sent to the console - * @return void - */ - public final function output ($outStream=false) { - if ($outStream === false) { - // Output something here... - foreach ($this->vars as $var=>$value) { - $this->output("var=".$var.", value=".$value.""); - } - } else { - // Output it to the console - printf("%s\n", trim(html_entity_decode(strip_tags($outStream)))); - } - } - - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - public function assignVariable ($var, $value) { - $this->vars[$var] = $value; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/output/class_WebOutput.php b/ship-simu/inc/classes/main/output/class_WebOutput.php deleted file mode 100644 index 8ed1c4f..0000000 --- a/ship-simu/inc/classes/main/output/class_WebOutput.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 WebOutput extends BaseFrameworkSystem implements OutputStreamer { - /** - * The instance for the singleton design pattern - */ - private static $webInstance = null; - - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Web-Ausgabe-Handler"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Create a new web output system and set the content type - * - * @param $contentType A valid content-type - * @return $debugInstance An instance of this middleware class - */ - public final static function createWebOutput ($contentType) { - // Is there no instance? - if (is_null(self::$webInstance)) { - // Cast the content-type to string and trim it - $contentType = (string) $contentType; - $contentType = trim($contentType); - - // Set the content type - if (!empty($contentType)) { - @header(sprintf("Content-type: %s", - $contentType - )); - } - - // Get a new instance and set it - self::$webInstance = new WebOutput(); - } - - // Return instance - return self::$webInstance; - } - - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - public function assignVariable($var, $value) { - // Stub message because we don't have it here - trigger_error(__METHOD__.": Stub!"); - } - - /** - * Output the code - * - * @return void - */ - public final function output ($outStream=false) { - print $outStream; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/template/.htaccess b/ship-simu/inc/classes/main/template/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/main/template/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/template/class_TemplateEngine.php b/ship-simu/inc/classes/main/template/class_TemplateEngine.php deleted file mode 100644 index 62d78cb..0000000 --- a/ship-simu/inc/classes/main/template/class_TemplateEngine.php +++ /dev/null @@ -1,1039 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate { - /** - * The local path name where all templates and sub folders for special - * templates are stored. We will internally determine the language plus - * "html" for web templates or "emails" for email templates - */ - private $basePath = ""; - - /** - * The extension for web and email templates (not compiled templates) - */ - private $templateExtension = ".tpl"; - - /** - * The extension for code templates (not compiled templates) - */ - private $codeExtension = ".ctp"; - - /** - * Path relative to $basePath and language code for compiled code-templates - */ - private $compileOutputPath = "templates/_compiled"; - - /** - * The raw (maybe uncompiled) template - */ - private $rawTemplateData = ""; - - /** - * Template data with compiled-in variables - */ - private $compiledData = ""; - - /** - * The last loaded template's FQFN for debugging the engine - */ - private $lastTemplate = ""; - - /** - * The variable stack for the templates. This must be initialized and - * shall become an instance of FrameworkArrayObject. - */ - private $varStack = null; - - /** - * Configuration variables in a simple array - */ - private $configVariables = array(); - - /** - * The language instance which should link to an object of LanguageSystem - */ - private $langInstance = null; - - /** - * Loaded templates for recursive protection and detection - */ - private $loadedTemplates = array(); - - /** - * Compiled templates for recursive protection and detection - */ - private $compiledTemplates = array(); - - /** - * Loaded raw template data - */ - private $loadedRawData = null; - - /** - * Raw templates which are linked in code templates - */ - private $rawTemplates = null; - - /** - * A regular expression for variable=value pairs - */ - private $regExpVarValue = '/([\w_]+)(="([^"]*)"|=([\w_]+))?/'; - - /** - * A regular expression for filtering out code tags - * - * E.g.: {?template:variable=value;var2=value2;[...]?} - */ - private $regExpCodeTags = '/\{\?([a-z_]+)(:("[^"]+"|[^?}]+)+)?\?\}/'; - - // Exception codes for the template engine - const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0xa00; - const TEMPLATE_CONTAINS_INVALID_VAR_EXCEPTION = 0xa01; - - /** - * Private constructor - * - * @return void - */ - private final function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set part description - $this->setPartDescr("Template-Engine"); - - // Create unique ID number - $this->createUniqueID(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); - } - - /** - * Creates an instance of the class TemplateEngine and prepares it for usage - * - * @param $basePath The local base path for all templates - * @param $langInstance An instance of LanguageSystem (default) - * @param $ioInstance An instance of FileIOHandler (default, middleware!) - * @return $tplInstance An instance of TemplateEngine - * @throws BasePathIsEmptyException If the provided $basePath is empty - * @throws InvalidBasePathStringException If $basePath is no string - * @throws BasePathIsNoDirectoryException If $basePath is no - * directory or not found - * @throws BasePathReadProtectedException If $basePath is - * read-protected - */ - public final static function createTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIOHandler $fileIOInstance) { - // Get a new instance - $tplInstance = new TemplateEngine(); - - // Is the base path valid? - if (empty($basePath)) { - // Base path is empty - throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!is_string($basePath)) { - // Is not a string - throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING); - } elseif (!is_dir($basePath)) { - // Is not a path - throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME); - } elseif (!is_readable($basePath)) { - // Is not readable - throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH); - } - - // Get configuration instance - $cfgInstance = $tplInstance->getConfigInstance(); - - // Set the base path - $tplInstance->setBasePath($basePath); - - // Initialize the variable stack - $tplInstance->initVariableStack(); - - // Set the language and IO instances - $tplInstance->setLanguageInstance($langInstance); - $tplInstance->setIOInstance($fileIOInstance); - - // Set template extensions - $tplInstance->setRawTemplateExtension($cfgInstance->readConfig("raw_template_extension")); - $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig("code_template_extension")); - - // Absolute output path for compiled templates - $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig("compile_output_path")); - - // Return the prepared instance - return $tplInstance; - } - - /** - * Search for a variable in the stack - * - * @param $var The variable we are looking for - * @return $idx FALSE means not found, > 0 means found on a specific index - */ - private function isVariableAlreadySet ($var) { - // First everything is not found - $found = false; - - // Now search for it - for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { - // Get current item - $currEntry = $idx->current(); - - // Is the entry found? - if ($currEntry['name'] == $var) { - // Found! - $found = $idx->key(); - break; - } - } - - // Return the current position - return $found; - } - - /** - * Add a variable to the stack - * - * @param $var The variable we are looking for - * @param $value The value we want to store in the variable - * @return void - */ - private function addVariable ($var, $value) { - // Add it to the stack - $this->varStack->append(array( - 'name' => $var, - 'value' => $value - )); - } - - /** - * Modify an entry on the stack - * - * @param $var The variable we are looking for - * @param $value The value we want to store in the variable - * @return void - */ - private function modifyVariable ($var, $value) { - // It should be there so let's look again... - for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { - // Get current entry - $currEntry = $idx->current(); - - // Is this the requested variable? - if ($currEntry['name'] == $var) { - // Change it to the other value - $this->varStack->offsetSet($idx->key(), array( - 'name' => $var, - 'value' => $value - )); - } - } - } - - /** - * Initialize the variable stack. This holds all variables for later - * compilation. - * - * @return void - */ - public final function initVariableStack () { - $this->varStack = new FrameworkArrayObject(); - } - - /** - * Setter for language instance which should be LanguageSystem - * - * @param $langInstance The language instance - * @return void - */ - public final function setLanguageInstance (ManageableLanguage $langInstance) { - $this->langInstance = $langInstance; - } - - /** - * Setter for file I/O instance which should be FileIOHandler - * - * @param $ioInstance The file I/O instance - * @return void - */ - public final function setIOInstance (FileIOHandler $ioInstance) { - $this->ioInstance = $ioInstance; - } - - /** - * Getter for file I/O instance which should be FileIOHandler - * - * @return $ioInstance The file I/O instance - */ - public final function getIOInstance () { - return $this->ioInstance; - } - - /** - * Setter for base path - * - * @param $basePath The local base path for all templates - * @return void - */ - public final function setBasePath ($basePath) { - // Cast it - $basePath = (string) $basePath; - - // And set it - $this->basePath = $basePath; - } - - /** - * Getter for base path - * - * @return $basePath The local base path for all templates - */ - public final function getBasePath () { - // And set it - return $this->basePath; - } - - /** - * Setter for template extension - * - * @param $templateExtension The file extension for all uncompiled - * templates - * @return void - */ - public final function setRawTemplateExtension ($templateExtension) { - // Cast it - $templateExtension = (string) $templateExtension; - - // And set it - $this->templateExtension = $templateExtension; - } - - /** - * Setter for code template extension - * - * @param $codeExtension The file extension for all uncompiled - * templates - * @return void - */ - public final function setCodeTemplateExtension ($codeExtension) { - // Cast it - $codeExtension = (string) $codeExtension; - - // And set it - $this->codeExtension = $codeExtension; - } - - /** - * Getter for template extension - * - * @return $templateExtension The file extension for all uncompiled - * templates - */ - public final function getRawTemplateExtension () { - // And set it - return $this->templateExtension; - } - - /** - * Getter for code-template extension - * - * @return $codeExtension The file extension for all code- - * templates - */ - public final function getCodeTemplateExtension () { - // And set it - return $this->codeExtension; - } - - /** - * Setter for path of compiled templates - * - * @param $compileOutputPath The local base path for all - * compiled templates - * @return void - */ - public final function setCompileOutputPath ($compileOutputPath) { - // Cast it - $compileOutputPath = (string) $compileOutputPath; - - // And set it - $this->compileOutputPath = $compileOutputPath; - } - - /** - * Setter for template type. Only "html", "emails" and "compiled" should - * be sent here - * - * @param $templateType The current template's type - * @return void - */ - private final function setTemplateType ($templateType) { - // Cast it - $templateType = (string) $templateType; - - // And set it (only 2 letters) - $this->templateType = $templateType; - } - - /** - * Getter for template type - * - * @return $templateType The current template's type - */ - public final function getTemplateType () { - return $this->templateType; - } - - /** - * Setter for the last loaded template's FQFN - * - * @param $template The last loaded template - * @return void - */ - private final function setLastTemplate ($template) { - // Cast it to string - $template = (string) $template; - $this->lastTemplate = $template; - } - - /** - * Getter for the last loaded template's FQFN - * - * @return $template The last loaded template - */ - private final function getLastTemplate () { - return $this->lastTemplate; - } - - /** - * Assign (add) a given variable with a value - * - * @param $var The variable we are looking for - * @param $value The value we want to store in the variable - * @return void - */ - public final function assignVariable ($var, $value) { - // First search for the variable if it was already added - $idx = $this->isVariableAlreadySet($var); - - // Was it found? - if ($idx === false) { - // Add it to the stack - $this->addVariable($var, $value); - } elseif (!empty($value)) { - // Modify the stack entry - $this->modifyVariable($var, $value); - } - } - - /** - * Assign a given congfiguration variable with a value - * - * @param $var The configuration variable we are looking for - * @param $value The value we want to store in the variable - * @return void - */ - public final function assignConfigVariable ($var, $value) { - // Sweet and simple... - $this->configVariables[$var] = $value; - } - - /** - * Removes a given variable - * - * @param $var The variable we are looking for - * @return void - */ - public final function removeVariable ($var) { - // First search for the variable if it was already added - $idx = $this->isVariableAlreadySet($var); - - // Was it found? - if ($idx !== false) { - // Remove this variable - $this->varStack->offsetUnset($idx); - } - } - - /** - * Private setter for raw template data - * - * @param $rawTemplateData The raw data from the template - * @return void - */ - private final function setRawTemplateData ($rawTemplateData) { - // Cast it to string - $rawTemplateData = (string) $rawTemplateData; - - // And store it in this class - $this->rawTemplateData = $rawTemplateData; - } - - /** - * Private setter for compiled templates - */ - private final function setCompiledData ($compiledData) { - // Cast it to string - $compiledData = (string) $compiledData; - - // And store it in this class - $this->compiledData = $compiledData; - } - - /** - * Private loader for all template types - * - * @param $template The template we shall load - * @return void - */ - private final function loadTemplate ($template) { - // Cast it to string - $template = (string) $template; - - // Get extension for the template - $ext = $this->getRawTemplateExtension(); - - // If we shall load a code-template we need to switch the file extension - if ($this->getTemplateType() == $this->getConfigInstance()->readConfig("code_template_type")) { - // Switch over to the code-template extension - $ext = $this->getCodeTemplateExtension(); - } - - // Construct the FQFN for the template by honoring the current language - $fqfn = sprintf("%s%s/%s/%s%s", - $this->getBasePath(), - $this->langInstance->getLanguageCode(), - $this->getTemplateType(), - $template, - $ext - ); - - // Load the raw template data - $this->loadRawTemplateData($fqfn); - } - - /** - * A private loader for raw template names - * - * @param $fqfn The full-qualified file name for a template - * @return void - * @throws NullPointerException If $inputInstance is null - * @throws NoObjectException If $inputInstance is not an object - * @throws MissingMethodException If $inputInstance is missing a - * required method - */ - private function loadRawTemplateData ($fqfn) { - // Debug message - if ((defined('DEBUG_TEMPLATE')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Template %s vom Typ %s wird geladen.
\n", - $this->__toString(), - $template, - $this->getTemplateType() - )); - - // Get a input/output instance from the middleware - $ioInstance = $this->getIOInstance(); - - // Validate the instance - if (is_null($ioInstance)) { - // Throw exception - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($ioInstance)) { - // Throw another exception - throw new NoObjectException($ioInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($ioInstance, 'loadFileContents')) { - // Throw yet another exception - throw new MissingMethodException(array($ioInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD); - } - - // Load the raw template - $rawTemplateData = $ioInstance->loadFileContents($fqfn); - - // Debug message - if ((defined('DEBUG_TEMPLATE')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] %s Byte Rohdaten geladen.
\n", - $this->__toString(), - strlen($rawTemplateData) - )); - - // Store the template's contents into this class - $this->setRawTemplateData($rawTemplateData); - - // Remember the template's FQFN - $this->setLastTemplate($fqfn); - } - - /** - * Try to assign an extracted template variable as a "content" or "config" - * variable. - * - * @param $varName The variable's name (shall be content or - * config) by default - * @param $var The variable we want to assign - */ - private function assignTemplateVariable ($varName, $var) { - // Is it not a config variable? - if ($varName != "config") { - // Regular template variables - $this->assignVariable($var, ""); - } else { - // Configuration variables - $this->assignConfigVariable($var, $this->getConfigInstance()->readConfig($var)); - } - } - - /** - * Extract variables from a given raw data stream - * - * @param $rawData The raw template data we shall analyze - * @return void - * @throws InvalidTemplateVariableNameException If a variable name - * in a template is - * invalid - */ - private function extractVariablesFromRawData ($rawData) { - // Cast to string - $rawData = (string) $rawData; - - // Search for variables - @preg_match_all('/\$(\w+)(\[(\w+)\])?/', $rawData, $variableMatches); - - // Did we find some variables? - if ((is_array($variableMatches)) && (count($variableMatches) == 4) && (count($variableMatches[0]) > 0)) { - // Initialize all missing variables - foreach ($variableMatches[3] as $key=>$var) { - // Is the variable name valid? - if (($variableMatches[1][$key] != $this->getConfigInstance()->readConfig("tpl_valid_var")) && ($variableMatches[1][$key] != "config")) { - // Invalid variable name - throw new InvalidTemplateVariableNameException(array($this, $this->getLastTemplate(), $variableMatches[1][$key], $this->getConfigInstance()), self::TEMPLATE_CONTAINS_INVALID_VAR_EXCEPTION); - } - - // Try to assign it, empty strings are being ignored - $this->assignTemplateVariable($variableMatches[1][$key], $var); - } - } - } - - /** - * Main analysis of the loaded template - * - * @param $templateMatches Found template place-holders, see below - * @return void - * - *--------------------------------- - * Structure of $templateMatches: - *--------------------------------- - * [0] => Array - An array with all full matches - * [1] => Array - An array with left part (before the ":") of a match - * [2] => Array - An array with right part of a match including ":" - * [3] => Array - An array with right part of a match excluding ":" - */ - private function analyzeTemplate ($templateMatches) { - // Backup raw template data - $backup = $this->getRawTemplateData(); - - // Initialize some arrays - if (is_null($this->loadedRawData)) { $this->loadedRawData = array(); $this->rawTemplates = array(); } - - // Load all requested templates - foreach ($templateMatches[1] as $template) { - - // Load and compile only templates which we have not yet loaded - // RECURSIVE PROTECTION! BE CAREFUL HERE! - if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) { - - // Then try to search for code-templates first - try { - // Load the code template and remember it's contents - $this->loadCodeTemplate($template); - $this->loadedRawData[$template] = $this->getRawTemplateData(); - - // Remember this template for recursion detection - // RECURSIVE PROTECTION! - $this->loadedTemplates[] = $template; - } catch (FilePointerNotOpenedException $e) { - // Template not found! - $this->rawTemplates[] = $template; - } - - } // if ((!isset( ... - - } // for ($templateMatches ... - - // Restore the raw template data - $this->setRawTemplateData($backup); - } - - /** - * Compile a given raw template code and remember it for later usage - * - * @param $code The raw template code - * @param $template The template's name - * @return void - */ - private function compileCode ($code, $template) { - // Is this template already compiled? - if (in_array($template, $this->compiledTemplates)) { - // Abort here... - return; - } - - // Remember this template being compiled - $this->compiledTemplates[] = $template; - - // Compile the loaded code in five steps: - // - // 1. Backup current template data - $backup = $this->getRawTemplateData(); - - // 2. Set the current template's raw data as the new content - $this->setRawTemplateData($code); - - // 3. Compile the template data - $this->compileTemplate(); - - // 4. Remember it's contents - $this->loadedRawData[$template] = $this->getRawTemplateData(); - - // 5. Restore the previous raw content from backup variable - $this->setRawTemplateData($backup); - } - - /** - * Insert all given and loaded templates by running through all loaded - * codes and searching for their place-holder in the main template - * - * @param $templateMatches See method analyzeTemplate() - * @return void - */ - private function insertAllTemplates ($templateMatches) { - // Run through all loaded codes - foreach ($this->loadedRawData as $template => $code) { - - // Search for the template - $foundIndex = array_search($template, $templateMatches[1]); - - // Lookup the matching template replacement - if (isset($templateMatches[0][$foundIndex])) { - - // Get the current raw template - $rawData = $this->getRawTemplateData(); - - // Replace the space holder with the template code - $rawData = str_replace($templateMatches[0][$foundIndex], $code, $rawData); - - // Set the new raw data - $this->setRawTemplateData($rawData); - } - } - } - - /** - * Load all extra raw templates - * - * @return void - */ - private function loadExtraRawTemplates () { - // Are there some raw templates we need to load? - if (count($this->rawTemplates) > 0) { - // Try to load all raw templates - foreach ($this->rawTemplates as $key => $template) { - try { - // Load the template - $this->loadWebTemplate($template); - - // Remember it's contents - $this->rawTemplates[$template] = $this->getRawTemplateData(); - - // Remove it from the loader list - unset($this->rawTemplates[$key]); - - // Remember this template for recursion detection - // RECURSIVE PROTECTION! - $this->loadedTemplates[] = $template; - } catch (FilePointerNotOpenedException $e) { - // This template was never found. We silently ignore it - unset($this->rawTemplates[$key]); - } - } - } - } - - /** - * Assign all found template variables - * - * @param $varMatches An array full of variable/value pairs. - * @return void - */ - private function assignAllVariables ($varMatches) { - // Search for all variables - foreach ($varMatches[1] as $key=>$var) { - - // Detect leading equals - if (substr($varMatches[2][$key], 0, 1) == "=") { - // Remove and cast it - $varMatches[2][$key] = (string) substr($varMatches[2][$key], 1); - } - - // Do we have some quotes left and right side? Then it is free text - if ((substr($varMatches[2][$key], 0, 1) == "\"") && (substr($varMatches[2][$key], -1, 1) == "\"")) { - // Free string detected! Which we can assign directly - $this->assignVariable($var, $varMatches[3][$key]); - } else { - // Non-string found so we need some deeper analysis... - die("Deeper analysis not yet implemented!"); - } - - } // for ($varMatches ... - } - /** - * Compiles all loaded raw templates - * - * @param $templateMatches See method analyzeTemplate() for details - * @return void - */ - private function compileRawTemplateData ($templateMatches) { - // Are some code-templates found which we need to compile? - if (count($this->loadedRawData) > 0) { - - // Then compile all! - foreach ($this->loadedRawData as $template => $code) { - - // Search for the template - $foundIndex = array_search($template, $templateMatches[1]); - - // Lookup the matching variable data - if (isset($templateMatches[3][$foundIndex])) { - - // Split it up with another reg. exp. into variable=value pairs - @preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches); - - // Assign all variables - $this->assignAllVariables($varMatches); - - } // END - if (isset($templateMatches ... - - // Compile the loaded template - $this->compileCode($code, $template); - - } // END - foreach ($this->loadedRawData ... - - // Insert all templates - $this->insertAllTemplates($templateMatches); - - } // END - if (count($this->loadedRawData) ... - } - - /** - * Getter for raw template data - * - * @return $rawTemplateData The raw data from the template - */ - public final function getRawTemplateData () { - return $this->rawTemplateData; - } - - /** - * Getter for compiled templates - */ - public final function getCompiledData () { - return $this->compiledData; - } - - /** - * Load a specified web template into the engine - * - * @param $template The web template we shall load which is - * located in "html" by default - * @return void - */ - public final function loadWebTemplate ($template) { - // Set template type - $this->setTemplateType($this->getConfigInstance()->readConfig("web_template_type")); - - // Load the special template - $this->loadTemplate($template); - } - - /** - * Load a specified email template into the engine - * - * @param $template The email template we shall load which is - * located in "emails" by default - * @return void - */ - public final function loadEmailTemplate ($template) { - // Set template type - $this->setTemplateType($this->getConfigInstance()->readConfig("email_template_type")); - - // Load the special template - $this->loadTemplate($template); - } - - /** - * Load a specified code template into the engine - * - * @param $template The code template we shall load which is - * located in "code" by default - * @return void - */ - public final function loadCodeTemplate ($template) { - // Set template type - $this->setTemplateType($this->getConfigInstance()->readConfig("code_template_type")); - - // Load the special template - $this->loadTemplate($template); - } - - /** - * Compile all variables by inserting their respective values - * - * @return void - */ - public final function compileVariables () { - // Initialize the $content array - $validVar = $this->getConfigInstance()->readConfig("tpl_valid_var"); - $dummy = array(); - - // Iterate through all variables - for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { - // Get current variable from the stack - $currVariable = $idx->current(); - - // Transfer it's name/value combination to the $content array - $dummy[$currVariable['name']] = $currVariable['value']; - } - $$validVar = $dummy; - - // Prepare all configuration variables - $config = $this->configVariables; - - // Remove some variables - unset($idx); - unset($currVariable); - - // Prepare the eval() command for comiling the template - $eval = sprintf("\$this->setCompiledData(\"%s\");", - addslashes($this->getRawTemplateData()) - ); - - // Debug message - if (((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", - $this->__toString(), - htmlentities($eval) - )); - - // Run the constructed command. This will "compile" all variables in - eval($eval); - } - - /** - * Compile all required templates into the current loaded one - * - * @return void - * @throws UnexpectedTemplateTypeException If the template type is - * not "code" - * @throws InvalidArrayCountException If an unexpected array - * count has been found - */ - public final function compileTemplate () { - // We will only work with template type "code" from configuration - if ($this->getTemplateType() != $this->getConfigInstance()->readConfig("code_template_type")) { - // Abort here - throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->readConfig("code_template_type")), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED); - } - - // Get the raw data. Thanks to Flobee(R) for given me a hint using the - // modifier "m" in regular expressions. I had implemented a regex here - // like this: (\n|\r) - $rawData = $this->getRawTemplateData(); - - // Remove double spaces and trim leading/trailing spaces - $rawData = trim(str_replace(" ", " ", $rawData)); - - // Search for raw variables - $this->extractVariablesFromRawData($rawData); - - // Search for code-tags which are {? ?} - @preg_match_all($this->regExpCodeTags, $rawData, $templateMatches); - - // Analyze the matches array - if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) { - // Entries are found: - // - // The main analysis - $this->analyzeTemplate($templateMatches); - - // Compile raw template data - $this->compileRawTemplateData($templateMatches); - - // Are there some raw templates left for loading? - $this->loadExtraRawTemplates(); - - // Are some raw templates found and loaded? - if (count($this->rawTemplates) > 0) { - die("NOT YET IMPLEMENTED"); - } - } // END - if($templateMatches ... - } - - /** - * Output the compiled page to the outside world. In case of web templates - * this would be vaild (X)HTML code. And in case of email templates this - * would store a prepared email body inside the template engine. - * - * @return void - */ - public final function output () { - // Check which type of template we have - switch ($this->getTemplateType()) { - case "html": // Raw HTML templates can be send to the output buffer - // Quick-N-Dirty: - $this->getWebOutputInstance()->output($this->getCompiledData()); - break; - - default: // Unknown type found - if ((is_object($this->getDebugInstance())) && (method_exists($this->getDebugInstance(), 'output'))) { - // Use debug output handler - $this->getDebugInstance()->output(sprintf("[%s:] Unbekannter Template-Typ %s erkannt.", - $this->__toString(), - $this->getTemplateType() - )); - die(); - } else { - // Put directly out - // DO NOT REWRITE THIS TO app_die() !!! - die(sprintf("[%s:] Unbekannter Template-Typ %s erkannt.", - $this->__toString(), - $this->getTemplateType() - )); - } - break; - } - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/middleware/.htaccess b/ship-simu/inc/classes/middleware/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/middleware/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/middleware/class_BaseMiddleware.php b/ship-simu/inc/classes/middleware/class_BaseMiddleware.php deleted file mode 100644 index e0a8b6b..0000000 --- a/ship-simu/inc/classes/middleware/class_BaseMiddleware.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 BaseMiddleware extends BaseFrameworkSystem { - /** - * Private constructor - * - * @return void - */ - private function __construct ($class) { - // Call parent constructor - parent::constructor($class); - - // Clean up a little - $this->removeNumberFormaters(); - } - - /** - * Public constructor - * - * @return void - */ - public function constructor ($class) { - // Just call the private constructor - $this->__construct($class); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/middleware/compressor/.htaccess b/ship-simu/inc/classes/middleware/compressor/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/middleware/compressor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/middleware/compressor/class_CompressorChannel.php b/ship-simu/inc/classes/middleware/compressor/class_CompressorChannel.php deleted file mode 100644 index 05fbad0..0000000 --- a/ship-simu/inc/classes/middleware/compressor/class_CompressorChannel.php +++ /dev/null @@ -1,138 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 CompressorChannel extends BaseMiddleware { - // Output handler instance - private $compressor = null; - - // Public constructor - private function __construct () { - // Call parent constructor! - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Komprimierungshandler"); - - // Create an unique ID - $this->createUniqueID(); - } - - // Create a new compressor channel based a given compression handler - public final static function createCompressorChannel ($baseDir) { - // Get new instance - $cInstance = new CompressorChannel(); - - // Is the compressor handler set? - if ( - (is_null($cInstance->getCompressor())) - || (!is_object($cInstance->getCompressor())) - || (!method_exists($cInstance->getCompressor(), 'compressStream')) - || (!method_exists($cInstance->getCompressor(), 'decompressStream')) - ) { - // Get a directory pointer - $dirPointer = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($baseDir); - - // Read all directories but no sub directories - while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess"))) { - // Is this a class file? - if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == $cInstance->getConfigInstance()->readConfig("php_extension"))) { - // Get the compressor's name. That's why you must name - // your files like your classes and also that's why you - // must keep on class in one file. - $class = substr($dir, 6, -4); - - // Create eval command - $eval = sprintf("\$tempInstance = %s::create%s();", - $class, - $class - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", - $cInstance->__toString(), - htmlentities($eval) - )); - - // Run it. This will create an instance to the current class - eval($eval); - - // Is the instance valid? We have the stream handler here - if ((!is_null($tempInstance)) && (method_exists($tempInstance, 'compressStream')) && (method_exists($tempInstance, 'decompressStream'))) { - // Okay, this handler is valid - $cInstance->setCompressor($tempInstance); - - // No more searches required because we have found a valid compressor stream - break; - } - } - } - - // Close the directory - $dirPointer->closeDirectory(); - } - - // Check again if there is a compressor - if ( - (is_null($cInstance->getCompressor())) - || (!is_object($cInstance->getCompressor())) - || (!method_exists($cInstance->getCompressor(), 'compressStream')) - || (!method_exists($cInstance->getCompressor(), 'decompressStream')) - ) { - // Set the null compressor handler - $cInstance->setCompressor(NullCompressor::createNullCompressor()); - } - - // Return the compressor instance - return $cInstance; - } - - /** - * Getter for compressor instance - * - * @return $compressor The compressor instance - */ - public final function getCompressor () { - return $this->compressor; - } - - /** - * Setter for compressor - * - * @param $compressorInstance The compressor instance we shall use - * @return void - */ - public final function setCompressor (Compressor $compressorInstance) { - $this->compressor = $compressorInstance; - } - - /** - * Getter for the file extension of the current compressor - */ - public final function getCompressorExtension () { - // Get compressor extension from current compressor - return $this->getCompressor()->getCompressorExtension(); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/middleware/database/.htaccess b/ship-simu/inc/classes/middleware/database/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/middleware/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/middleware/database/class_DatabaseConnection.php b/ship-simu/inc/classes/middleware/database/class_DatabaseConnection.php deleted file mode 100644 index 8499c0f..0000000 --- a/ship-simu/inc/classes/middleware/database/class_DatabaseConnection.php +++ /dev/null @@ -1,213 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DatabaseConnection extends BaseMiddleware implements DatabaseConnector, LimitableObject { - // Array for connection data - private $connectData = array(); - - // The real database layer - private $dbLayer = null; - - // An instance of this class - private static $thisInstance = null; - - // Private constructor - private final function __construct() { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Datenbank-Mittelschicht"); - - // Create an unique ID - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - // Create new database connection layer - public final static function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseFrontendInterface $dbLayer) { - // Get instance - $dbInstance = new DatabaseConnection(); - - // Set debug output handler - $dbInstance->setDebugInstance($debugInstance); - - // Set database layer - $dbInstance->setDatabaseLayer($dbLayer); - - // Set db instance - self::$thisInstance = $dbInstance; - - // Return instance - return $dbInstance; - } - - // Get an instance of this class - public final static function getInstance () { - return self::$thisInstance; - } - - // Public setter for database connection - public final function setConnectionData ($login, $pass, $dbase, $host) { - // Transfer connection data - $this->connectData['login'] = (string) $login; - $this->connectData['pass'] = (string) $pass; - $this->connectData['dbase'] = (string) $dbase; - $this->connectData['host'] = (string) $host; - } - - /** - * Save a whole object or parts of it to the database or local file - * - * @param $object The object we shall save - * @return void - * @throws NullPointerException If $limitInstance is null - * @throws NoObjectException If $limitInstance is not an object - * @throws MissingMethodException If the required method - * saveObject() was not found - */ - public final function saveObject ($object) { - // Some sanity checks - if (is_null($this->dbLayer)) { - // Is null - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($this->dbLayer)) { - // Is not an object - throw new NoObjectException($this->dbLayer, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($this->dbLayer, 'saveObject')) { - // Does not have the required instance - throw new MissingMethodException(array($this->dbLayer, 'saveObject'), self::EXCEPTION_MISSING_METHOD); - } - - // For now just pipe it through to the database layer - $this->dbLayer->saveObject($object); - } - - /** - * Set a limitation for the saving process. This shall be done before - * saveObject() is called else saveObject() shall save the whole object. - * - * @param $limitInstance An instance of ObjectLimits which contains - * elements we shall exclusivly include in - * saving process - * @return void - * @throws NullPointerException If $limitInstance is null - * @throws NoObjectException If $limitInstance is not an object - * @throws MissingMethodException If the required method - * limitObject() was not found - */ - public final function limitObject (ObjectLimits $limitInstance) { - // Get real database connection - $this->dbLayer = $this->getDatabaseInstance(); - - // Some sanity checks - if (is_null($this->dbLayer)) { - // Is null - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($this->dbLayer)) { - // Is not an object - throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($this->dbLayer, 'limitObject')) { - // Does not have the required instance - throw new MissingMethodException(array($this->dbLayer, 'limitObject'), self::EXCEPTION_MISSING_METHOD); - } - - // For now we pipe this through to the real database instance - $this->dbLayer->limitObject($limitInstance); - } - - /** - * Analyses if a unique ID has already been used or not. This method does - * only pass the given ID through to the "real" database layer. - * - * @param $uniqueID A unique ID number which shall be checked - * before it will be used - * @param $inConstructor If called from a constructor 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 NullPointerException If $this->dbLayer is null - * @throws NoObjectException If $this->dbLayer is not an object - * @throws MissingMethodException If the required method - * isUniqueIdUsed() was not found - */ - public final function isUniqueIdUsed ($uniqueID, $inConstructor = false) { - // Some sanity checks - if (is_null($this->dbLayer)) { - // Is null - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($this->dbLayer)) { - // Is not an object - throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($this->dbLayer, 'isUniqueIdUsed')) { - // Does not have the required instance - throw new MissingMethodException(array($this->dbLayer, 'isUniqueIdUsed'), self::EXCEPTION_MISSING_METHOD); - } - - // Pass the returning result through - return $this->dbLayer->isUniqueIdUsed($uniqueID, $inConstructor); - } - - /** - * Gets cached data from the database layer and if not found fetch it from - * the database again. This method does not return the header stuff because - * The underlaying database class will return only the requested content. - * - * @param $idNumber The ID number which we need for looking up - * the requested data - * @return $cachedArray The maybe cached data from the database - * @throws NullPointerException If $this->dbLayer is null - * @throws NoObjectException If $this->dbLayer is not an object - * @throws MissingMethodException If the required method - * isUniqueIdUsed() was not found - */ - public final function getObjectFromCachedData ($idNumber) { - // Some sanity checks - if (is_null($this->dbLayer)) { - // Is null - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($this->dbLayer)) { - // Is not an object - throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($this->dbLayer, 'getObjectFromCachedData')) { - // Does not have the required instance - throw new MissingMethodException(array($this->dbLayer, 'getObjectFromCachedData'), self::EXCEPTION_MISSING_METHOD); - } - - // Pass the returning result through - return $this->dbLayer->getObjectFromCachedData($idNumber); - } - - /** - * Setter for the real database layer - * @param $dbLayer An instance of the real database layer - * @return void - */ - public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) { - $this->dbLayer = $dbLayer; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/middleware/debug/.htaccess b/ship-simu/inc/classes/middleware/debug/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/middleware/debug/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/middleware/debug/class_DebugMiddleware.php b/ship-simu/inc/classes/middleware/debug/class_DebugMiddleware.php deleted file mode 100644 index e43ce8b..0000000 --- a/ship-simu/inc/classes/middleware/debug/class_DebugMiddleware.php +++ /dev/null @@ -1,146 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 DebugMiddleware extends BaseMiddleware { - /** - * The concrete output instance - */ - private $outputHandler = null; - - /** - * An instance of this class - */ - private static $thisInstance = null; - - /** - * Private constructor - * - * @return void - */ - private final function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Debug-Ausgabe-Handler"); - - // Create an unique ID - $this->createUniqueID(); - - // Set own instance - self::$thisInstance = $this; - } - - /** - * Create a new debug output system. - * If no output is given this class is currently being used for back-fall. - * This fall-back mechanism will become deprecated very soon. - * - * @param $debuggerClass The class name which we shall use for - * registering the *real* debug output - * @return $debugInstance An instance of this middleware class - */ - public final static function createDebugMiddleware ($debuggerClass) { - // Create an instance if this middleware - $debugInstance = new DebugMiddleware(); - - // Is there a valid output handler provided? - if ((!is_null($debuggerClass)) && (is_object($debuggerClass)) && (method_exists($debuggerClass, 'outputStream'))) { - // Use the given output system - $debugInstance->setOutputHandler($debuggerClass); - } elseif ((!is_null($debuggerClass)) && (is_string($debuggerClass)) && (class_exists($debuggerClass))) { - // A name for a debug output class has been provided so we try to get it - $eval = sprintf("\$debuggerClass = %s::create%s();", - $debuggerClass, - $debuggerClass - ); - - // Run the constructed name - @eval($eval); - - // Was this successfull? - if ((is_object($debuggerClass)) && (method_exists($debuggerClass, "outputStream"))) { - // Set this as output class - $debugInstance->setOutputHandler($debuggerClass); - } else { - // No object or method is missing use fall-back - throw new MissingMethodException(array($debuggerClass, 'outputStream'), self::EXCEPTION_MISSING_METHOD); - } - } - - // Return instance - return $debugInstance; - } - - /** - * Getter for an instance of this class - * - * @return $thisInstance An instance of this class - */ - public final static function getInstance() { - return self::$thisInstance; - } - - /** - * Setter for output handler - * - * @return void - */ - public final function setOutputHandler ($outputHandler) { - $this->outputHandler = $outputHandler; - } - - /** - * This method shall send debug output which can be HTML code for the - * browser or debug lines for a log file, etc. to the registered debug - * output handler. - * - * @return void - */ - public final function output ($outStream) { - // Check if the output handler is valid - if (is_null($this->outputHandler)) { - // Debug output handler was not set - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($this->outputHandler)) { - // The debug output handler is not an object - throw new NoObjectException($this->ouputHandler, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($this->outputHandler, 'outputStream')) { - // The required method outputStream() is missing - throw new MissingMethodException(array($this->outputHandler, 'outputStream'), self::EXCEPTION_MISSING_METHOD); - } - - // Is the output stream set - if (empty($outStream)) { - // Initialization phase - return; - } - - // Use the output handler - $this->outputHandler->outputStream($outStream); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/middleware/io/.htaccess b/ship-simu/inc/classes/middleware/io/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/classes/middleware/io/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/middleware/io/class_FileIOHandler.php b/ship-simu/inc/classes/middleware/io/class_FileIOHandler.php deleted file mode 100644 index 40b2b35..0000000 --- a/ship-simu/inc/classes/middleware/io/class_FileIOHandler.php +++ /dev/null @@ -1,180 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FileIOHandler extends BaseMiddleware { - /** - * The *real* file input class we shall use for reading data - */ - private $inputStream = null; - - /** - * The *real* file output class we shall use for reading data - */ - private $outputStream = null; - - /** - * An instance of this class - */ - private static $thisInstance = null; - - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Datei-Ein-/Ausgabe-Handler"); - - // Create an unique ID - $this->createUniqueID(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); - - // Set own instance - self::$thisInstance = $this; - } - - /** - * Creates an instance of this class and prepares the IO system. This is - * being done by setting the default file IO class - * - * @return $ioInstance A prepared instance of FilIOHandler - */ - public final static function createFileIOHandler () { - // Get instance - $ioHandler = new FileIOHandler(); - - // Set the *real* file IO instances (both the same) - $ioHandler->setInputStream(FileIOStream::createFileIOStream()); - $ioHandler->setOutputStream(FileIOStream::createFileIOStream()); - - // Return instance - return $ioHandler; - } - - /** - * Getter for an instance of this class - * - * @return $thisInstance An instance of this class - */ - public final static function getInstance () { - return self::$thisInstance; - } - - /** - * Setter for the *real* file input instance - * - * @param $inputStream The *real* file-input class - */ - public final function setInputStream (FileInputStreamer $inputStream) { - $this->inputStream = $inputStream; - } - - /** - * Getter for the *real* file input instance - * - * @return $inputStream The *real* file-input class - */ - public final function getInputStream () { - return $this->inputStream; - } - - /** - * Setter for the *real* file output instance - * - * @param $outputStream The *real* file-output class - */ - public final function setOutputStream (FileOutputStreamer $outputStream) { - $this->outputStream = $outputStream; - } - - /** - * Getter for the *real* file output instance - * - * @return $outputStream The *real* file-output class - */ - public final function getOutputStream () { - return $this->outputStream; - } - - /** - * Saves a file with data by using the current output stream - * - * @see FileOutputStreamer - */ - public function saveFile ($fileName, $dataArray) { - // Get output stream - $outInstance = $this->getOutputStream(); - - // Is it a valid stream? - if (is_null($outInstance)) { - // No class returned - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($outInstance)) { - // Not an object! ;-( - throw new NoObjectException($outInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($outInstance, 'saveFile')) { - // Nope, so throw exception - throw new MissingMethodException(array($outInstance, 'saveFile'), self::EXCEPTION_MISSING_METHOD); - } - - // Send the fileName and dataArray to the output handler - $outInstance->saveFile($fileName, $dataArray); - } - - /** Loads data from a file over the input handler - * - * @see FileInputStreamer - */ - public function loadFileContents ($fqfn) { - // Initialize the array - $array = array(); - - // Get output stream - $inInstance = $this->getInputStream(); - - // Is it a valid stream? - if (is_null($inInstance)) { - // No class returned - throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($inInstance)) { - // Not an object! ;-( - throw new NoObjectException($inInstance, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($inInstance, 'loadFileContents')) { - // Nope, so throw exception - throw new MissingMethodException(array($inInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD); - } - - // Read from the input handler - return $inInstance->loadFileContents($fqfn); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/config.php b/ship-simu/inc/config.php deleted file mode 100644 index 62134c1..0000000 --- a/ship-simu/inc/config.php +++ /dev/null @@ -1,155 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ - -// Load the class from inc/config direktory -@require_once(dirname(__FILE__) . "/config/class_FrameworkConfiguration.php"); - -// Get a new configuration instance -$cfg = FrameworkConfiguration::createFrameworkConfiguration(); - -// CFG: SERVER-PATH -$cfg->definePath(dirname(dirname(__FILE__)) . "/"); // DON'T MISS THE TRAILING SLASH!!! - -// CFG: DATABASE-TYPE -$cfg->defineDatabaseType("local"); - -// CFG: TIME-ZONE -$cfg->setDefaultTimezone("Europe/Berlin"); - -// CFG: MAGIC-QUOTES-RUNTIME -$cfg->setMagicQuotesRuntime(false); - -// CFG: PHP-SCRIPT-EXTENSION -$cfg->setConfigEntry("php_extension", ".php"); - -// CFG: CLASS-PREFIX -$cfg->setConfigEntry("class_prefix", "class_"); - -// CFG: CLASS-SUFFIX -$cfg->setConfigEntry("class_suffix", ".php"); - -// CFG: RAW-TEMPLATE-EXTENSION -$cfg->setConfigEntry("raw_template_extension", ".tpl"); - -// CFG: CODE-TEMPLATE-EXTENSION -$cfg->setConfigEntry("code_template_extension", ".ctp"); - -// CFG: SELECTOR-GET -$cfg->setConfigEntry("app_selector_get", "app"); - -// CFG: APPLICATION-HELPER -$cfg->setConfigEntry("app_helper_class", "ApplicationHelper"); - -// CFG: SELECTOR-PATH -$cfg->setConfigEntry("selector_path", "selector"); - -// CFG: TEMPLATE-BASE-PATH -$cfg->setConfigEntry("tpl_base_path", "templates/"); // DON'T MISS THE TRAILING SLASH! - -// CFG: LANGUAGE-BASE-PATH -$cfg->setConfigEntry("lang_base_path", "inc/language/"); // DON'T MISS THE TRAILING SLASH! - -// CFG: COMPRESSOR-BASE-PATH -$cfg->setConfigEntry("compressor_base_path", "inc/classes/main/compressor/"); // DON'T MISS THE TRAILING SLASH! - -// CFG: APPLICATION-PATH -$cfg->setConfigEntry("application_path", "application"); - -// CFG: COMPILE-OUTPUT-PATH -$cfg->setConfigEntry("compile_output_path", "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH! - -// CFG: TEMPLATE-ENGINE -$cfg->setConfigEntry("tpl_engine", "TemplateEngine"); - -// CFG: DEBUG-ENGINE -$cfg->setConfigEntry("debug_engine", "DebugWebOutput"); - -// CFG: DEFAULT-LANGUAGE -$cfg->setConfigEntry("default_lang", "de"); // A two-char language string: de for german, en for english and so on - -// CFG: WEB-TEMPLATE-TYPE -$cfg->setConfigEntry("web_template_type", "html"); - -// CFG: EMAIL-TEMPLATE-TYPE -$cfg->setConfigEntry("email_template_type", "emails"); - -// CFG: CODE-TEMPLATE-TYPE -$cfg->setConfigEntry("code_template_type", "code"); - -// CFG: WEB-ENGINE -$cfg->setConfigEntry("web_engine", "WebOutput"); - -// CFG: SELECTOR-TEMPLATE-PREFIX -$cfg->setConfigEntry("tpl_selector_prefix", "selector"); - -// CFG: WEB-CONTENT-TYPE -$cfg->setConfigEntry("web_content_type", "text/html"); - -// CFG: VALID-TEMPLATE-VARIABLE -$cfg->setConfigEntry("tpl_valid_var", "content"); - -// CFG: META-AUTHOR -$cfg->setConfigEntry("meta_author", "Roland Häder"); - -// CFG: META-PUBLISHER -$cfg->setConfigEntry("meta_publisher", "Roland Häder"); - -// CFG: META-KEYWORDS -$cfg->setConfigEntry("meta_keywords", "test,test,test"); - -// CFG: META-DESCRIPTION -$cfg->setConfigEntry("meta_description", "A lame description for an application framework"); - -// CFG: LAUNCH-METHOD -$cfg->setConfigEntry("entry_method", "entryPoint"); - -// CFG: SELECTOR-MAIN-TEMPLATE -$cfg->setConfigEntry("selector_main_tpl", "selector_main"); - -// CFG: SELECTOR-APPS-TEMPLATE -$cfg->setConfigEntry("selector_apps_tpl", "selector_apps"); - -// CFG: SELECTOR-NAME -$cfg->setConfigEntry("selector_name", "selector"); - -// CFG: DEFAULT-APPLICATION -$cfg->setConfigEntry("default_application", "selector"); - -// CFG: VERBOSE-LEVEL -$cfg->setConfigEntry("verbose_level", 0); - -// Shall we include config-local.php where you can configure some things? Then -// We need to do some things: -// -// First generate FQFN -$localConfig = sprintf("%sinc/config-local%s", PATH, $cfg->readConfig("php_extension")); - -// Second is the file there and readable? -if ((file_exists($localConfig)) && (is_readable($localConfig))) { - // The third step to load it - require_once($localConfig); -} - -// [EOF] -?> diff --git a/ship-simu/inc/config/.htaccess b/ship-simu/inc/config/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/config/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/config/class_FrameworkConfiguration.php b/ship-simu/inc/config/class_FrameworkConfiguration.php deleted file mode 100644 index 03237c0..0000000 --- a/ship-simu/inc/config/class_FrameworkConfiguration.php +++ /dev/null @@ -1,295 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 FrameworkConfiguration { - /** - * Include files which shall be included before the main loader. - */ - private $moreIncPre = null; - - /** - * Include files which shall be included after the main loader. - */ - private $moreIncPost = null; - - /** - * The framework's main configuration array which will be initialized with - * hard-coded configuration data and might be overwritten/extended by - * config data from the database. - */ - private $config = array(); - - /** - * The configuration instance itself - */ - private static $cfgInstance = null; - - // Some constants for the configuration system - const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0xc00; - const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0xc01; - - /** - * Private constructor - */ - private function __construct () { - // Initialize both include lists - $this->moreIncPre = new ArrayObject(); - $this->moreIncPost = new ArrayObject(); - } - - /** - * "Create" a configuration instance - */ - public final static function createFrameworkConfiguration ($enableDebug = false) { - /** - * For singleton design pattern because we only need a one-time-run - * through the initial configuration. - */ - if (is_null(self::$cfgInstance)) { - // CFG: DEBUG-LEVEL - @error_reporting(E_ALL | E_STRICT); - - /** - * Shall we enable the debug mode? - */ - if ($enableDebug) { - define('DEBUG_MODE', true); - } - - /** - * Crate a config instance - */ - self::$cfgInstance = new FrameworkConfiguration(); - } - - /** - * Return the instance - */ - return self::$cfgInstance; - } - - /** - * Getter for an instance of this class - * - * @return $cfgInstance An instance of this class - */ - public final static function getInstance () { - return self::$cfgInstance; - } - - /** - * Setter for default time zone (must be correct!) - * - * @param $zone The time-zone string (e.g. Europe/Berlin) - * @return void - */ - public final function setDefaultTimezone ($zone) { - // At least 5.1.0 is required for this! - if (version_compare(phpversion(), "5.1.0")) { - @date_default_timezone_set($zone); - } - } - - /** - * Setter for runtime magic quotes - */ - public final function setMagicQuotesRuntime ($enableQuotes) { - // Cast it to boolean - $enableQuotes = (boolean) $enableQuotes; - - // Set it - @set_magic_quotes_runtime($enableQuotes); - } - - /** - * A private include loader - * - * @param $arrayObject The array object with all include files - * @return void - */ - private function loadIncludes (ArrayObject $arrayObject) { - // Load only if there are includes defined - if (!is_null($arrayObject)) { - for ($idx = $arrayObject->getIterator(); $idx->valid(); $idx->next()) { - // Get include file - $inc = $idx->current(); - - // Is the file name really set? - if (!empty($inc)) { - // Base path added? (Uni* / Windows) - if ((substr($inc, 0, 1) != "/") && (substr($inc, 1, 1) != ":")) { - // Generate FQFN - $fqfn = sprintf("%s/inc/extra/%s", PATH, $inc); - } else { - // Base path is already added - $fqfn = $inc; - } - } - - // Include them all here - require($fqfn); - } - } - } - - /** - * Load all includes before main loader and clears the array after usage - * - * @return void - */ - public function loadPreIncludes () { - $this->loadIncludes($this->moreIncPre); - unset($this->moreIncPre); - } - - /** - * Load all includes after main loader and clears the array after usage - * - * @return void - */ - public function loadPostIncludes () { - $this->loadIncludes($this->moreIncPost); - unset($this->moreIncPost); - } - - /** - * Define the database type which must be valid and will not be verified. - * - * @param $type The database type. See path inc/database/. - * @return void - */ - public function defineDatabaseType ($type) { - // Is it defined or not? - if (!defined('_DB_TYPE')) { - // Cast to string - $type = (string) $type; - - // Set the constant - define('_DB_TYPE', $type); - } else { - // Already defined! But we cannot throw an exception here... :( - ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the database type only once in your application!", - __CLASS__ - )); - } - } - - /** - * Define the local file path - * - * @param $path The database type. See path inc/database/. - * @return void - */ - public function definePath ($path) { - // Cast to string - $path = (string) $path; - - // Is it defined or not? - if (!is_dir($path)) { - // Is not a valid path - ApplicationEntryPoint::app_die(sprintf("[%s:] Invalid path (not found) specified. Please make sure it is created.", - __CLASS__ - )); - } elseif (!defined('PATH')) { - // Set the constant - define('PATH', $path); - } else { - // Already defined! But we cannot throw an exception here... :( - ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the local file path only once in your application.", - __CLASS__ - )); - } - } - - /** - * Read a configuration element. - * - * @param $cfgEntry The configuration element - * @return $cfgValue The fetched configuration value - * @throws ConfigEntryIsEmptyException If $cfgEntry is empty - * @throws ConfigEntryNotFoundException If a configuration element - * was not found - */ - public function readConfig ($cfgEntry) { - // Cast to string - $cfgEntry = (string) $cfgEntry; - - // Is a valid configuration entry provided? - if (empty($cfgEntry)) { - // Entry is empty - throw new ConfigEntryIsEmptyException(__CLASS__, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY); - } elseif (!isset($this->config[$cfgEntry])) { - // Entry was not found! - throw new ConfigEntryNotFoundException(array(__CLASS__, $cfgEntry), self::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND); - } - - // Debug message - if ((defined('DEBUG_CONFIG')) || (defined('DEBUG_ALL'))) { - echo "[".__METHOD__."] Configuration entry ".$cfgEntry." requested.
\n"; - } - - // Return the requested value - return $this->config[$cfgEntry]; - } - - /** - * Set a configuration entry. - * - * @param $cfgEntry The configuration entry we want to add/change - * @param $cfgValue The configuration value we want to set - * @return void - * @throws ConfigEntryIsEmptyException If $cfgEntry is empty - */ - public final function setConfigEntry ($cfgEntry, $cfgValue) { - // Cast to string - $cfgEntry = (string) $cfgEntry; - $cfgValue = (string) $cfgValue; - - // Is a valid configuration entry provided? - if (empty($cfgEntry)) { - // Entry is empty - throw new ConfigEntryIsEmptyException(__CLASS__, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY); - } - - // Set the configuration value - $this->config[$cfgEntry] = $cfgValue; - - // Resort the array - ksort($this->config); - } - - /** - * Compatiblity method to return this class' name - * - * @return __CLASS__ This class' name - */ - public function __toString () { - return get_class($this); - } -} // END - class - -// [EOF] -?> diff --git a/ship-simu/inc/database.php b/ship-simu/inc/database.php deleted file mode 100644 index b429a39..0000000 --- a/ship-simu/inc/database.php +++ /dev/null @@ -1,90 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ - -// Initialize the layer -$layer = null; - -// Is the type defined? -if (!defined('_DB_TYPE')) { - // Abort here - ApplicationEntryPoint::app_die("[Main:] Please define a database type first!
-E.g.:
$GLOBALS['cfg']->defineDatabaseType("local");
-This will choose the local-file-based database type (layer)"); -} - -// Generate FQFN for the database layer -$INC = sprintf("%sinc/database/lib-%s%s", PATH, _DB_TYPE, FrameworkConfiguration::getInstance()->readConfig("php_extension")); - -// Load the database layer include -if ((file_exists($INC)) && (is_file($INC)) && (is_readable($INC))) { - // Load the layer - require_once($INC); -} else { - // Layer is missing! - ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer is missing! (%s) -> R.I.P.", - _DB_TYPE - )); -} - -// Clean it up -unset($INC); - -// Prepare database instance -try { - $db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layer); -} catch (NullPointerException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", - $e->getMessage() - )); -} catch (InvalidDirectoryResourceException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", - $e->getMessage() - )); -} catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", - $e->getMessage() - )); -} catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", - $e->getMessage() - )); -} catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", - $e->getMessage() - )); -} catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", - $e->getMessage() - )); -} - -// Datenbankobjekt debuggen -if (defined('DEBUG_DATABASE_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Die Datenbank-Schicht sieht wie folgt aus:
-
%s
\n", - print_r($db, true) - )); -} - -// [EOF] -?> diff --git a/ship-simu/inc/database/.htaccess b/ship-simu/inc/database/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/database/lib-local.php b/ship-simu/inc/database/lib-local.php deleted file mode 100644 index 18d5910..0000000 --- a/ship-simu/inc/database/lib-local.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ -try { - $layer = LocalFileDatabase::createLocalFileDatabase(PATH . "db/", FileIOHandler::getInstance()); -} catch (SavePathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", - $e->getMessage() - )); -} catch (SavePathNotFoundException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", - $e->getMessage() - )); -} catch (SavePathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", - $e->getMessage() - )); -} catch (SavePathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", - $e->getMessage() - )); -} catch (SavePathWriteProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", - $e->getMessage() - )); -} - -// [EOF] -?> diff --git a/ship-simu/inc/file_io.php b/ship-simu/inc/file_io.php deleted file mode 100644 index d63a9a3..0000000 --- a/ship-simu/inc/file_io.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ -$io = FileIOHandler::createFileIOHandler(); - -// [EOF] -?> diff --git a/ship-simu/inc/includes.php b/ship-simu/inc/includes.php deleted file mode 100644 index 28a5610..0000000 --- a/ship-simu/inc/includes.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ - -// Load the class loader first -require(sprintf("%sinc/loader/class_ClassLoader%s", - PATH, - FrameworkConfiguration::getInstance()->readConfig("php_extension")) -); - -/** - * Is the devel package included? - */ -if (is_dir(sprintf("%sdevel", PATH))) { - /** - * Load all development includes - */ - ClassLoader::getInstance()->loadClasses("devel"); -} - -/** - * Load additional include files before main load - */ -FrameworkConfiguration::getInstance()->loadPreIncludes(); - -/** - * Load all main include files - * - * +++ MAIN LOADER! +++ - * - */ - -/////////////////////////////////////////////////// -// Maybe we need this place for future releases? // -/////////////////////////////////////////////////// - -/** - * Load additional include files after main load - */ -FrameworkConfiguration::getInstance()->loadPostIncludes(); - -// [EOF] -?> diff --git a/ship-simu/inc/language.php b/ship-simu/inc/language.php deleted file mode 100644 index e9132cf..0000000 --- a/ship-simu/inc/language.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ - -// Try it here... -try { - $lang = LanguageSystem::createLanguageSystem(sprintf("%s%s", - PATH, - FrameworkConfiguration::getInstance()->readConfig("lang_base_path") - )); -} catch (LanguagePathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", - $e->getMessage() - )); -} catch (InvalidLanguagePathStringException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", - $e->getMessage() - )); -} catch (LanguagePathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", - $e->getMessage() - )); -} catch (LanguagePathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", - $e->getMessage() - )); -} - -// [EOF] -?> diff --git a/ship-simu/inc/language/.htaccess b/ship-simu/inc/language/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/language/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/loader/.htaccess b/ship-simu/inc/loader/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/inc/loader/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/loader/class_ClassLoader.php b/ship-simu/inc/loader/class_ClassLoader.php deleted file mode 100644 index 38bfcd4..0000000 --- a/ship-simu/inc/loader/class_ClassLoader.php +++ /dev/null @@ -1,275 +0,0 @@ - - * @version 1.1 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ClassLoader { - /** - * Configuration array - */ - private $cfg = array(); - - /** - * An ArrayObject for found classes - */ - private $classes = null; - - /** - * Suffix with extension for all class files - */ - private $prefix = "class_"; - - /** - * Suffix with extension for all class files - */ - private $suffix = ".php"; - - /** - * Length of the suffix. Will be overwritten later. - */ - private $sufLen = 0; - - /** - * Length of the prefix. Will be overwritten later. - */ - private $preLen = 0; - - /** - * A list for directory names (no leading/trailing slashes!) which not be scanned by the path scanner - * @see scanLocalPath - */ - private $ignoreList = array(); - - /** - * An ArrayList object for include directories - */ - private $dirList = null; - - /** - * Debug this class loader? (true = yes, false = no) - */ - private $debug = false; - - /** - * Counter for scanned directories (debug output) - */ - private $dirCnt = 0; - - /** - * Counter for loaded classes (debug output) - */ - private $classCnt = 0; - - /** - * Instance of this class - */ - private static $thisInstance = null; - - /** - * The *public* constructor - * - * @param $cfgInstance Configuration class instance - * @return void - */ - public function __construct (FrameworkConfiguration $cfgInstance) { - // Init the array list - $this->dirList = new ArrayObject(); - - // Set suffix and prefix from configuration - $this->suffix = $cfgInstance->readConfig("class_suffix"); - $this->prefix = $cfgInstance->readConfig("class_prefix"); - - // Estimate length of prefix and suffix for substr() function (cache) - $this->sufLen = strlen($this->suffix); - $this->preLen = strlen($this->prefix); - - // Set configuration instance - $this->cfgInstance = $cfgInstance; - - // Initialize the classes list - $this->classes = new ArrayObject(); - - // Set own instance - self::$thisInstance = $this; - } - - /** - * Getter for an instance of this class - * - * @return $thisInstance An instance of this class - */ - public final static function getInstance () { - return self::$thisInstance; - } - - /** - * Scans recursively a local path for class files which must have a prefix and a suffix as given by $this->suffix and $this->prefix - * - * @param $basePath The relative base path to PATH constant for all classes - * @param $ignoreList An optional list (array or string) of directory names which shall be ignored - * @return void - */ - public function loadClasses ($basePath, $ignoreList = array() ) { - // Convert string to array - if (!is_array($ignoreList)) $ignoreList = array($ignoreList); - - // Directories which our class loader ignores by default while - // deep-scanning the directory structure. See scanLocalPath() for - // details. - $ignoreList[] = "."; - $ignoreList[] = ".."; - $ignoreList[] = ".htaccess"; - - // Keep it in class for later usage - $this->ignoreList = $ignoreList; - - // Set base directory which holds all our classes, we should use an - // absolute path here so is_dir(), is_file() and so on will always - // find the correct files and dirs. - $basePath2 = realpath($basePath); - - // If the basePath is false it is invalid - if ($basePath2 === false) { - // TODO: Do not die here. - die("Cannot read {$basePath} !"); - } else { - // Set base path - $basePath = $basePath2; - } - - // Load all super classes (backward, why ever this name... :-? ) - // We don't support sub directories here... - $this->scanLocalPath($basePath); - - // While there are directories in our list scan them for classes - $cnt = 0; - while ($cnt != $this->dirList->count()) { - for ($idx = $this->dirList->getIterator(); $idx->valid(); $idx->next()) { - // Get current path - $currPath = $idx->current(); - - // Remove the current entry or else this will lead into a infinite loop - $this->dirList->offsetSet($idx->key(), ""); - - // Scan the directory - $this->scanLocalPath($currPath); - } - - // Check if we can leave - $cnt = 0; - for ($idx = $this->dirList->getIterator(); $idx->valid(); $idx->next()) { - if ($idx->current() == "") $cnt++; - } - } - } - - /** - * The local path scanner. A found class will be loaded immediately - * @param $localPath The local path which shall be recursively scanned for include files - * @return void - */ - private function scanLocalPath ($localPath) { - // Empty path names will be silently ignored - if (empty($localPath)) return; - - // TODO: No dies here, mayybe this should be rewritten to throw an exception? - $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($localPath); - while ($dirClass = $dirInstance->readDirectoryExcept($this->ignoreList)) { - // We need the relative dir name as an array index some lines below - $dirClass2 = $dirClass; - - // A nice replacement for a simple dot ;) - $dirClass = sprintf("%s/%s", $localPath, $dirClass); - - // Is a readable file with configured prefix and suffix? All other - // files will silently be ignored! - //* DEBUG: */ print "Prefix=".$this->prefix."(".substr($dirClass2, 0 , $this->preLen).")\n"; - //* DEBUG: */ print "Suffix=".$this->suffix."(".substr($dirClass2, -$this->sufLen, $this->sufLen).")\n"; - //* DEBUG: */ print "ENTRY={$dirClass}\n"; - if ( - (is_file($dirClass)) - && (is_readable($dirClass)) - && (substr($dirClass2, 0 , $this->preLen) == $this->prefix) - && (substr($dirClass2, -$this->sufLen, $this->sufLen) == $this->suffix) - ) { - // Class found so load it instantly - //* DEBUG: */ print "CLASS={$dirClass}\n"; - $this->classes->append($dirClass); - $this->classCnt++; - } elseif (is_dir($dirClass) && !in_array($dirClass2, $this->ignoreList)) { - // Directory found and added to list - //* DEBUG: */ print "DIR={$dirClass}\n"; - if ($dirClass2 == "interfaces") { - $this->scanLocalPath($dirClass); - } else { - $this->dirList->append($dirClass); - } - $this->dirCnt++; - } - //* DEBUG: */ print "LOOP!\n"; - } // END - while - - // Close directory handler - $dirInstance->closeDirectory(); - - // Output counter in debug mode - if (defined('DEBUG_MODE')) print(sprintf("[%s:] %d Klassendateien in %d Verzeichnissen gefunden und geladen.
\n", - __CLASS__, - $this->classCnt, - $this->dirCnt - )); - } - - /** - * Includes all found classes - * @return void - */ - public function includeAllClasses () { - if (is_object($this->classes)) { - // Load all classes - for ($idx = $this->classes->getIterator(); $idx->valid(); $idx->next()) { - // Load current class - //* DEBUG: */ print "Class=".$idx->current()."\n"; - require_once($idx->current()); - } - - // Re-initialize the classes list - $this->classes = new ArrayObject(); - } - } -} - -// Initial load of core classes and the FrameworkDirectoryPointer class -require_once(sprintf("%sinc/classes/interfaces/class_FrameworkInterface%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); -require_once(sprintf("%sinc/classes/main/class_BaseFrameworkSystem%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); -require_once(sprintf("%sinc/classes/main/io/class_FrameworkDirectoryPointer%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); - -// Initialize the class loader -$loader = new ClassLoader(FrameworkConfiguration::getInstance()); - -// [EOF] -?> diff --git a/ship-simu/inc/output.php b/ship-simu/inc/output.php deleted file mode 100644 index f2dfcbe..0000000 --- a/ship-simu/inc/output.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ - -// Prepare debug outout middleware -$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig("debug_engine")); - -// Leere Strings werden ignoriert und sollten zum Testen der Middleware genommen werden -DebugMiddleware::getInstance()->output(""); - -// [EOF] -?> diff --git a/ship-simu/inc/selector.php b/ship-simu/inc/selector.php deleted file mode 100644 index 62f0e68..0000000 --- a/ship-simu/inc/selector.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 . - */ - -// Does the user has an application specified? -if (!empty($_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")])) { - // Set the application from string - $application = (string) $_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")]; -} elseif (!empty($_SERVER['argv'][1])) { - // Set the application from string - $application = (string) $_SERVER['argv'][1]; - $app = explode("=", trim($application)); - if ($app[0] == FrameworkConfiguration::getInstance()->readConfig("app_selector_get")) { - // Application is valid! - $application = trim($app[1]); - } else { - // Invalid entry found, first must be "app"! - $application = FrameworkConfiguration::getInstance()->readConfig("default_application"); - } -} else { - // Set the "application selector" application - $application = FrameworkConfiguration::getInstance()->readConfig("default_application"); -} - -// Secure it, by keeping out tags -$application = htmlentities(strip_tags($application), ENT_QUOTES); - -// Secure it a little more with a reg.exp. -$application = preg_replace('/([^a-z_-])+/i', "", $application); - -// Try to load these includes in the given order -$configAppIncludes = array( - sprintf("class_%s", FrameworkConfiguration::getInstance()->readConfig("app_helper_class")), // The ApplicationHelper class - "config", // The application's own configuration - "init", // The application initializer - "loader", // The application's class loader - "debug", // Some debugging stuff - "exceptions", // The application's own exception handler - "starter", // The application starter (calls entryPoint(), etc.) -); - -// Load them all (try only) -foreach ($configAppIncludes as $inc) { - // Skip starter in test mode - if (($inc == "starter") && (defined('TEST'))) { - // Skip it here - continue; - } - - // Generate a FQFN for the helper class - $fqfn = sprintf("%s%s/%s/%s%s", - PATH, - FrameworkConfiguration::getInstance()->readConfig("application_path"), - $application, - $inc, - FrameworkConfiguration::getInstance()->readConfig("php_extension") - ); - - // Does the include file exists? - if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) { - // Load it - require_once($fqfn); - } elseif (FrameworkConfiguration::getInstance()->readConfig("verbose_level") > 0) { - // File is missing - trigger_error(sprintf("Cannot load application script %s! File is missing or read-protected.", - $inc . FrameworkConfiguration::getInstance()->readConfig("php_extension") - )); - } -} - -// [EOF] -?> diff --git a/ship-simu/index.php b/ship-simu/index.php deleted file mode 100644 index 2671e2a..0000000 --- a/ship-simu/index.php +++ /dev/null @@ -1,149 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * 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 ApplicationEntryPoint { - /** - * The instances we want to remove after all is done - * - * @return void - */ - private static $instances = array ( - 'cfg', // The configuration system - 'loader', // The class loader system - 'debug', // Debug output - 'db', // Database layer - 'io', // Base I/O system (local file [or network]) - 'engine', // Template engine ( for ApplicationEntryPoint::app_die() ) - 'lang', // Language sub-system - 'app', // The ApplicationHelper instance - ); - - /** - * The application's emergency exit - * - * @param $message The optional message we shall output on exit - * @return void - */ - public static function app_die ($message = "") { - // Is a message set? - if (empty($message)) { - // No message provided - $message = "No message provided!"; - } - - // Get some instances - $tpl = FrameworkConfiguration::getInstance()->readConfig("tpl_engine"); - $lang = LanguageSystem::getInstance(); - $io = FileIOHandler::getInstance(); - - // Is the template engine loaded? - if ((class_exists($tpl)) && (is_object($lang)) && (is_object($io))) { - // Use the template engine for putting out (nicer look) the message - try { - $eval = sprintf("$tplEngine = %s::create%s(\"%s%s\", LanguageSystem::getInstance(), FileIOHandler::getInstance());", - FrameworkConfiguration::getInstance()->readConfig("tpl_engine"), - FrameworkConfiguration::getInstance()->readConfig("tpl_engine"), - PATH, - FrameworkConfiguration::getInstance()->readConfig("tpl_base_path") - ); - eval($eval); - } catch (BasePathIsEmptyException $e) { - die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", - $e->getMessage() - )); - } catch (InvalidBasePathStringException $e) { - die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", - $e->getMessage() - )); - } catch (BasePathIsNoDirectoryException $e) { - die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", - $e->getMessage() - )); - } catch (BasePathReadProtectedException $e) { - die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", - $e->getMessage() - )); - } - - // Assign message - $tplEngine->assignVariable("message", $message); - - // Load the template - $tplEngine->loadCodeTemplate("emergency_exit"); - - // Compile the template - $tplEngine->compileTemplate(); - - // Compile all variables - $tplEngine->compileVariables(); - - // Output all - $tplEngine->output(); - - // Good bye... - exit(); - } else { - // Output message and die - die(sprintf("[Main:] Emergency exit reached: %s", - $message - )); - } - } - - /** - * The application's main entry point. This class isolates some local - * variables which shall not become visible to outside because of security - * concerns. We are doing this here to "emulate" the well-known entry - * point in Java(tm). - * - * @return void - */ - public static function main () { - // Some non-global common arrays we need... - global $_SERVER; - - // Load config file - require(dirname(__FILE__) . "/inc/config.php"); - - // Load all include files - require(PATH . "inc/includes.php"); - - // Load all framework classes - require(PATH . "inc/classes.php"); - - // Include the application selector - require(PATH . "inc/selector.php"); - - } // END - main() - -} // END - class - -// Do not remove the following line: -ApplicationEntryPoint::main(); - -// [EOF] -?> diff --git a/ship-simu/rebuild_doc.sh b/ship-simu/rebuild_doc.sh deleted file mode 100755 index 697ed08..0000000 --- a/ship-simu/rebuild_doc.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -echo "$0: Cleaning up..." -find docs/html/ -type f -exec rm -f {} \; -rm -f docs/*.log -echo "$0: Done." - -doxygen Doxyfile diff --git a/ship-simu/templates/.htaccess b/ship-simu/templates/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/templates/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/templates/_compiled/.htaccess b/ship-simu/templates/_compiled/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/templates/_compiled/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/templates/de/.htaccess b/ship-simu/templates/de/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/templates/de/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/templates/de/code/.htaccess b/ship-simu/templates/de/code/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/templates/de/code/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/templates/de/code/emergency_exit.ctp b/ship-simu/templates/de/code/emergency_exit.ctp deleted file mode 100644 index a16e1cd..0000000 --- a/ship-simu/templates/de/code/emergency_exit.ctp +++ /dev/null @@ -1,11 +0,0 @@ - - -{?header:title="Problem in application framework detected!"?} - -{?navigation:nav_row=home;imprint;contact?} - -
- $content[message] -
- -{?footer_msg:footer_msg="Please contact the support and supply the full above message, if you think you are not qualified to fix this problem."?} diff --git a/ship-simu/templates/de/code/footer_msg.ctp b/ship-simu/templates/de/code/footer_msg.ctp deleted file mode 100644 index 309a0fd..0000000 --- a/ship-simu/templates/de/code/footer_msg.ctp +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/ship-simu/templates/de/code/header.ctp b/ship-simu/templates/de/code/header.ctp deleted file mode 100644 index 1faab5b..0000000 --- a/ship-simu/templates/de/code/header.ctp +++ /dev/null @@ -1,20 +0,0 @@ - - - - - $content[title] - - - - - - - - - - - - - - -
diff --git a/ship-simu/templates/de/html/.htaccess b/ship-simu/templates/de/html/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/ship-simu/templates/de/html/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/tests/contract-test.php b/ship-simu/tests/contract-test.php deleted file mode 100644 index 326d104..0000000 --- a/ship-simu/tests/contract-test.php +++ /dev/null @@ -1,601 +0,0 @@ -%s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (FileIsEmptyException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (FilePointerNotOpenedException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidMD5ChecksumException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidDataLengthException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidSimulatorIDException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (MismatchingCompressorsException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNullException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNoArrayException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerMaybeDamagedException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} - -// Personal-Objekt debuggen -if (defined('DEBUG_PERSONELL_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:
-
%s
\n", - print_r($personell, true) - )); -} - -// Hafen bauen -$harbor = Harbor::createHarbor("Hamburger Hafen"); - -// Name ausgeben -DebugMiddleware::getInstance()->output(sprintf("Der %s ist gegründet worden.
\n", - $harbor->getHarborName() -)); - -// Hafen-Objekt debuggen -if (defined('DEBUG_HARBOR_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Der %s sieht wie folgt aus:
-
%s
\n", - $harbor->getHarborName(), - print_r($harbor, true) - )); -} - -// Haendler gruenden -$merchant = Merchant::createMerchant("Namenlos", $harbor); - -// Array mit Einbauten erstellen -$einbauten = array( - 'parts' => array( // *** Die zu einbauenden Schiffsteile *** - 'Motor' => array( // --- Maschinenraum mit Motor --- - "Ocean-Power 2000", // Bezeichnung - 20000, // Pferdestaerken - 6, // Anzahl Nocken - 2.5, 2, 3.5 // Abmasse (Breite/Hoehe/Laenge) - ), - 'Bridge' => array( // --- Kommandobruecke --- - 26, 2.5, 15 // Abmasse (Breite/Hoehe/Laenge) - ), - 'CarDeck' => array( // --- Autodecks --- - 'amount' => 8, // Anzahl Autodecks (einige liegen hintereinander im selben Deck!) - 'dim' => array( // Abmessung (Breite/Hoehe/Laenge) - 6, 3, 16 - ) - ), - 'TruckDeck' => array( // --- Decks fuer LKW/Busse haben vielleicht ein anderes Belueftgungssystem, etc. --- - 'amount' => 1, // Anzahl der Decks - 'dim' => array( // Abmessung (Breite/Hoehe/Laenge) - 8, 5, 195 // Geht durchs gesamte Schiff! - ) - ), - 'TrainDeck' => array( // --- Decks fuer Zuege haben Schienen... --- - 'amount' => 1, // Anzahl der Decks - 'dim' => array( // Abmessung (Breite/Hoehe/Laenge) - 8, 4, 195 // Geht durchs gesamte Schiff! - ) - ), - 'LuxuryCabin' => array( // --- Luxuskabinen --- - 'amount' => 20, // Anzahl Luxuskabinen im Schiff - 'rooms' => 4, // Raeume: 2 Schlafzimmer, 1 Auffenthaltszimmer, 1 Bad mit Dusche/Toilette/Waschbecken - 'bed' => 3, // Anzahl Betten (1 Doppelbett 2 Einzelbetten, Doppel-/Einzelbetten in getrennte Raeume) - 'dim' => array( // Abmessung der Luxuskabine (Breite/Hoehe/Laenge) - 4, 3, 5 - ), - ), - 'PremierCabin' => array( // --- Mittlere Kabinen --- - 'amount' => 40, // Anzahl - 'rooms' => 2, // Raeume: Schlafzimmer, Bad mit Toilette/Waschbecken - 'bed' => 2, // Anzahl Betten (1 Doppelbett, 1 Einzelbett; gemeinsamer Raum) - 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge) - 4, 2.5, 4 - ) - ), - 'LowCabin' => array( // --- Untere Kabinen (befinden sich in den Unterbauten) --- - 'amount' => 90, // Anzahl - 'rooms' => 1, // Raeume: Schlafzimmer, Waschbecken - 'bed' => 2, // Anzahl Betten (2 Etagenbetten) - 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge) - 3, 2.5, 4 - ) - ), - 'EconomyCabin' => array( // --- Unterste Kabinen (befinden sich tief unten im Schiffsbauch) --- - 'amount' => 140, // Anzahl - 'rooms' => 1, // Raeume: Schlafzimmer, Waschbecken - 'bed' => 1, // Anzahl Betten (1 Etagenbett) - 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge) - 2, 2.5, 2 - ) - ) - ), - 'builds' => array( // *** Welche Oberklasse verwendet werden sollen *** - 'Motor' => "MaschineRoom", - 'Bridge' => "BaseUpperStructure", - 'LuxuryCabin' => "BaseCabin", - 'PremierCabin' => "BaseCabin", - 'LowCabin' => "BaseCabin", - 'EconomyCabin' => "BaseCabin", - 'CarDeck' => "BaseDeck", - 'TrainDeck' => "BaseDeck", - 'TruckDeck' => "BaseDeck" - ) -); - -// Preisliste auffuellen -foreach ($einbauten['parts'] as $key=>$part) { - // Create item array string - $item = ""; - foreach ($part as $idx=>$itemPart) { - if (is_string($itemPart)) { - // String found - $item .= sprintf("\"%s\", ", $itemPart); - } elseif (is_int($itemPart)) { - // Integer found - $item .= sprintf("%d, ", $itemPart); - } elseif (is_float($itemPart)) { - // Float found - $item .= sprintf("%f, ", $itemPart); - } elseif (is_array($itemPart)) { - // Sub-array found - $item .= "array("; - - // Go all items through - foreach ($itemPart as $idx2=>$subPart) { - if (is_int($subPart)) { - // Integer again found - $item .= sprintf("%d, ", $subPart); - } elseif (is_float($subPart)) { - // Float found - $item .= sprintf("%f, ", $subPart); - } else { - // Unsupport part found - die(sprintf("[Main:] Unsupported sub-array element on pos %d in array %s found: %s", $idx2, $idx, $subPart)); - } - } - - // Remove trailing comma - $item = substr($item, 0, -2); - - // Add closing bracket - $item .= "), "; - } else { - // Unsupport part found - die(sprintf("[Main:] Unsupported array element on pos %d: %s", $idx, $itemPart)); - } - } - - // Remove trailing comma - $item = substr($item, 0, -2); - - // Random price - $price = mt_rand(5, 12) * 10000; - - // Give it a try... - try { - // Generate command for adding objects to a price list - $eval = sprintf("\$merchant->addItemToPriceList(%s::create%s(%s), %d);", - $key, - $key, - $item, - $price - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) DebugMiddleware::getInstance()->output(sprintf("[Main:] Konstruierte PHP-Anweisung:
%s

\n", - htmlentities($eval) - )); - - // Run the constructed command - eval($eval); - } catch (ItemNotTradeableException $e) { - die(sprintf("[Main:] Die Preisliste des Händlers %s kann nicht befüllt werden. Grund: %s
\n", - $merchant->getMerchantName(), - $e->getMessage() - )); - } -} - -// Haendler-Objekt debuggen -if (defined('DEBUG_MERCHANT_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Der Händler %s sieht wie folgt aus:
-
%s
\n", - $merchant->getMerchantName(), - print_r($merchant, true) - )); -} - -// Reederei gruenden -$shipping = ShippingCompany::createShippingCompany("Hanseatic Travel Company", $harbor); - -// Firmenschef setzen -try { - $shipping->setCompanyFounder(CompanyEmployee::createCompanyEmployee("Roland", "Häder", "M", 1977, 9, 26, true, 2000)); -} catch (BirthdayInvalidException $e) { - die(sprintf("[Main:] Reederei-Gründer konnte nicht gesetzt werden. Grund: %s
\n", - $e->getMessage() - )); -} - -// Dann mal ausgeben... -DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s ist von %s %s gegründet worden.
\n", - $shipping->getCompanyName(), - $shipping->getFounderInstance()->getSurname(), - $shipping->getFounderInstance()->getFamily() -)); - -// Die Reederei stellt Personal ein und bedient sich an der $personell-Instanz -try { - $shipping->recruitRandomEmployees(10, $personell); -} catch (ToMuchEmployeesException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal einstellen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (OutOfBoundsException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal einstellen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} - -// Anzahl Personal ausgeben -DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s hat nun %d weitere Mitarbeiter.
\n", - $shipping->getCompanyName(), - $shipping->getTotalEmployee() -)); - -// Dann die ersten 3 Werften in den Hafen einbauen und Personal zuweisen -$shipping->createShipyardInHarbor("Werft 1", $harbor); -$shipping->createShipyardInHarbor("Werft 2", $harbor); -$shipping->createShipyardInHarbor("Werft 3", $harbor); - -// In alle Werften sollen Passagierschiffe gebaut werden koennen -try { - $shipping->addShipTypeToAllShipyards("PassengerShip"); -} catch (ClassNotFoundException $e) { - die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (ClassMismatchException $e) { - die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} - -// Personal auf die Werften verteilen -try { - $shipping->distributeAllPersonellOnShipyards(); -} catch (NoShipyardsConstructedException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (ClassMismatchException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} - -// Normale Meldung ausgeben -DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s beschäftigt nun ihre %d Mitarbeiter in %d Werft(en):
\n", - $shipping->getCompanyName(), - $shipping->getTotalEmployee(), - $shipping->getTotalShipyards() -)); - -// Dann nimmt die Reederei ihren ersten Bauauftrag entgegen. -// Sie muss auch sich selber Bauauftraege erteilen! -try { - $shipping->addNewWorksContract(WorksContract::createWorksContract("PassengerShip", "M/S Poseidon", $shipping)); -} catch (ClassNotFoundException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (EmptyStructuresListException $e) { - die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} - -// Auftrag-Instanz holen -$contract = $shipping->getLastContractInstance(); - -// Die Reederei hat einen Haendler gewaehlt -try { - $shipping->setMerchantInstance($merchant); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", - $merchant->getMerchantName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", - $merchant->getMerchantName(), - $e->getMessage() - )); -} catch (ClassMismatchException $e) { - die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", - $merchant->getMerchantName(), - $e->getMessage() - )); -} - -// Den Bauauftrag mit der Reederei abgleichen, ob sie den Schiffstyp bauen koennen -try { - $typeValid = $shipping->validateWorksContractShipType($contract); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht validieren. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht validieren. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} - -// Kann gebaut werden? -if ($typeValid) { - DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s kann Schiffe vom Typ %s bauen.
\n", - $shipping->getCompanyName(), - $contract->getShipInstance()->getPartDescr() - )); -} else { - DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s kann keine Schiffe vom Typ %s bauen!
\n", - $shipping->getCompanyName(), - $contract->getShipInstance()->getPartDescr() - )); - exit; -} - -// Dann den Bauauftrag verfeinern -foreach ($einbauten['parts'] as $key=>$part) { - try { - $contract->addContractDetails($key, $einbauten['builds'][$key], $part); - } catch (ShipPartNotConstructableException $e) { - // Output message - die($e->getMessage()); - } catch (ShipNotConstructedException $e) { - // Output message - die($e->getMessage()); - } catch (ItemNotInPriceListException $e) { - die(sprintf("[Main:] Der Artikel %s konnte nicht in der Preisliste gefunden werden. Grund: %s
\n", - $key, - $e->getMessage() - )); - } catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Der Artikel %s konnte nicht in der Preisliste gefunden werden. Grund: %s
\n", - $key, - $e->getMessage() - )); - } -} - -// Reederei-Objekt ausgeben -if (defined('DEBUG_COMPANY_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s sieht wie folgt aus:
-
%s
\n", - $shipping->getCompanyName(), - print_r($shipping, true) - )); -} - -// Etwas aufraeumen -unset($einbauten); -unset($part); -unset($eval); -unset($item); -unset($key); -unset($typeValid); - -// Gesamtwert ausgeben -try { - $totalValue = $contract->getTotalPrice(); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} catch (EmptyStructuresListException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} catch (TotalPriceNotCalculatedException $e) { - die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", - $e->getMessage() - )); -} - -// Wert ausgeben -DebugMiddleware::getInstance()->output(sprintf("Der Bau der %s wird der Reederei %s voraussichtlich %s kosten.
\n", - $contract->getShipInstance()->getShipName(), - $shipping->getCompanyName(), - $contract->formatCurrency($totalValue) -)); - -// Etwas aufraeumen -unset($totalValue); - -// Den Bauvertrag unterschreiben (damit wird er in den Bau-Queue aufgenommen) -try { - $shipping->signContract($contract, $shipping); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (InvalidContractPartnerException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (ContractAllreadySignedException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} catch (WrongContractPartnerException $e) { - die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", - $shipping->getCompanyName(), - $e->getMessage() - )); -} - -// Meldung ausgeben -if ($contract->isSigned()) { - DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s hat den Bau der %s zugestimmt.
\n", - $shipping->getCompanyName(), - $contract->getShipInstance()->getShipName() - )); -} else { - DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s hat den Bau der %s abgelehnt.
\n", - $shipping->getCompanyName(), - $contract->getShipInstance()->getShipName() - )); - exit; -} - -// Auftrag-Objekt ausgeben -if (defined('DEBUG_CONTRACT_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Der Bauauftrag sieht wie folgt aus:
-
%s
\n", - print_r($contract, true) - )); -} - -// Erstmal bis hier hin... -//exit(); - -// Anzahl Betten ermitteln -try { - $totalBeds = $contract->getShipInstance()->calcTotalBeds(); -} catch (StructuresOutOfBoundsException $e) { - die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (EmptyStructuresListException $e) { - die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: %s
\n", - $e->getMessage() - )); -} - -// Bettenanzahl ausgeben -DebugMiddleware::getInstance()->output(sprintf("Es stehen %d Betten zur Verfügung.", - $totalBeds -)); - -// -?> diff --git a/ship-simu/tests/loader-test.php b/ship-simu/tests/loader-test.php deleted file mode 100644 index 668e612..0000000 --- a/ship-simu/tests/loader-test.php +++ /dev/null @@ -1,158 +0,0 @@ -%s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (FileIsEmptyException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (FilePointerNotOpenedException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidMD5ChecksumException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidDataLengthException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidSimulatorIDException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (MismatchingCompressorsException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNullException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNoArrayException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerMaybeDamagedException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} - -// Personal-Objekt debuggen -if (defined('DEBUG_PERSONELL_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:
-
%s
\n", - print_r($test, true) - )); -} - -// Erstmal bis hier hin -exit(); - -// Etwas zum Testen... -try { - $test = SimulatorPersonell::createSimulatorPersonell(20); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", - $e->getMessage() - )); -} - -// Personal-Objekt debuggen -if (defined('DEBUG_PERSONELL_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:
-
%s
\n", - print_r($test, true) - )); -} - -// Try to save the object (for testing purposes) -try { - $test->saveObjectToDatabase(); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidObjectException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (UnsupportedLimitationPartException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (GetterNotFoundException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoArrayCreatedException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} - -// -?> diff --git a/ship-simu/tests/personell-test.php b/ship-simu/tests/personell-test.php deleted file mode 100644 index e6acd10..0000000 --- a/ship-simu/tests/personell-test.php +++ /dev/null @@ -1,159 +0,0 @@ -%s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (FileIsEmptyException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (FilePointerNotOpenedException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidMD5ChecksumException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidDataLengthException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidSimulatorIDException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (MismatchingCompressorsException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNullException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerItemIsNoArrayException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} catch (ContainerMaybeDamagedException $e) { - die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", - $e->getMessage() - )); -} - -// Personal-Objekt debuggen -if (defined('DEBUG_PERSONELL_OBJ')) { - echo sprintf("Das Personal-Objekt sieht wie folgt aus:
-
%s
\n", - print_r($test, true) - ); -} - -// Erstmal bis hier hin -exit(); - -// Etwas zum Testen... -try { - $test = SimulatorPersonell::createSimulatorPersonell(20); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", - $e->getMessage() - )); -} - -// Personal-Objekt debuggen -if (defined('DEBUG_PERSONELL_OBJ')) { - echo sprintf("Das Personal-Objekt sieht wie folgt aus:
-
%s
\n", - print_r($test, true) - ); -} - -// Try to save the object (for testing purposes) -try { - $test->saveObjectToDatabase(); -} catch (NullPointerException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoObjectException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidObjectException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (MissingMethodException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (UnsupportedLimitationPartException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (GetterNotFoundException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (NoArrayCreatedException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} catch (InvalidArrayCountException $e) { - die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", - $e->getMessage() - )); -} - -// -?> diff --git a/templates/.htaccess b/templates/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/templates/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/templates/_compiled/.htaccess b/templates/_compiled/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/templates/_compiled/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/templates/de/.htaccess b/templates/de/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/templates/de/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/templates/de/code/.htaccess b/templates/de/code/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/templates/de/code/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/templates/de/code/emergency_exit.ctp b/templates/de/code/emergency_exit.ctp new file mode 100644 index 0000000..a16e1cd --- /dev/null +++ b/templates/de/code/emergency_exit.ctp @@ -0,0 +1,11 @@ + + +{?header:title="Problem in application framework detected!"?} + +{?navigation:nav_row=home;imprint;contact?} + +
+ $content[message] +
+ +{?footer_msg:footer_msg="Please contact the support and supply the full above message, if you think you are not qualified to fix this problem."?} diff --git a/templates/de/code/footer_msg.ctp b/templates/de/code/footer_msg.ctp new file mode 100644 index 0000000..309a0fd --- /dev/null +++ b/templates/de/code/footer_msg.ctp @@ -0,0 +1,8 @@ + + +
+ + + diff --git a/templates/de/code/header.ctp b/templates/de/code/header.ctp new file mode 100644 index 0000000..1faab5b --- /dev/null +++ b/templates/de/code/header.ctp @@ -0,0 +1,20 @@ + + + + + $content[title] + + + + + + + + + + + + + + +
diff --git a/templates/de/html/.htaccess b/templates/de/html/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/templates/de/html/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/tests/contract-test.php b/tests/contract-test.php new file mode 100644 index 0000000..326d104 --- /dev/null +++ b/tests/contract-test.php @@ -0,0 +1,601 @@ +%s
\n", + $e->getMessage() + )); +} catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (FileIsEmptyException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (FilePointerNotOpenedException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidMD5ChecksumException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidDataLengthException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidSimulatorIDException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (MismatchingCompressorsException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerItemIsNullException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerItemIsNoArrayException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerMaybeDamagedException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} + +// Personal-Objekt debuggen +if (defined('DEBUG_PERSONELL_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:
+
%s
\n", + print_r($personell, true) + )); +} + +// Hafen bauen +$harbor = Harbor::createHarbor("Hamburger Hafen"); + +// Name ausgeben +DebugMiddleware::getInstance()->output(sprintf("Der %s ist gegründet worden.
\n", + $harbor->getHarborName() +)); + +// Hafen-Objekt debuggen +if (defined('DEBUG_HARBOR_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Der %s sieht wie folgt aus:
+
%s
\n", + $harbor->getHarborName(), + print_r($harbor, true) + )); +} + +// Haendler gruenden +$merchant = Merchant::createMerchant("Namenlos", $harbor); + +// Array mit Einbauten erstellen +$einbauten = array( + 'parts' => array( // *** Die zu einbauenden Schiffsteile *** + 'Motor' => array( // --- Maschinenraum mit Motor --- + "Ocean-Power 2000", // Bezeichnung + 20000, // Pferdestaerken + 6, // Anzahl Nocken + 2.5, 2, 3.5 // Abmasse (Breite/Hoehe/Laenge) + ), + 'Bridge' => array( // --- Kommandobruecke --- + 26, 2.5, 15 // Abmasse (Breite/Hoehe/Laenge) + ), + 'CarDeck' => array( // --- Autodecks --- + 'amount' => 8, // Anzahl Autodecks (einige liegen hintereinander im selben Deck!) + 'dim' => array( // Abmessung (Breite/Hoehe/Laenge) + 6, 3, 16 + ) + ), + 'TruckDeck' => array( // --- Decks fuer LKW/Busse haben vielleicht ein anderes Belueftgungssystem, etc. --- + 'amount' => 1, // Anzahl der Decks + 'dim' => array( // Abmessung (Breite/Hoehe/Laenge) + 8, 5, 195 // Geht durchs gesamte Schiff! + ) + ), + 'TrainDeck' => array( // --- Decks fuer Zuege haben Schienen... --- + 'amount' => 1, // Anzahl der Decks + 'dim' => array( // Abmessung (Breite/Hoehe/Laenge) + 8, 4, 195 // Geht durchs gesamte Schiff! + ) + ), + 'LuxuryCabin' => array( // --- Luxuskabinen --- + 'amount' => 20, // Anzahl Luxuskabinen im Schiff + 'rooms' => 4, // Raeume: 2 Schlafzimmer, 1 Auffenthaltszimmer, 1 Bad mit Dusche/Toilette/Waschbecken + 'bed' => 3, // Anzahl Betten (1 Doppelbett 2 Einzelbetten, Doppel-/Einzelbetten in getrennte Raeume) + 'dim' => array( // Abmessung der Luxuskabine (Breite/Hoehe/Laenge) + 4, 3, 5 + ), + ), + 'PremierCabin' => array( // --- Mittlere Kabinen --- + 'amount' => 40, // Anzahl + 'rooms' => 2, // Raeume: Schlafzimmer, Bad mit Toilette/Waschbecken + 'bed' => 2, // Anzahl Betten (1 Doppelbett, 1 Einzelbett; gemeinsamer Raum) + 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge) + 4, 2.5, 4 + ) + ), + 'LowCabin' => array( // --- Untere Kabinen (befinden sich in den Unterbauten) --- + 'amount' => 90, // Anzahl + 'rooms' => 1, // Raeume: Schlafzimmer, Waschbecken + 'bed' => 2, // Anzahl Betten (2 Etagenbetten) + 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge) + 3, 2.5, 4 + ) + ), + 'EconomyCabin' => array( // --- Unterste Kabinen (befinden sich tief unten im Schiffsbauch) --- + 'amount' => 140, // Anzahl + 'rooms' => 1, // Raeume: Schlafzimmer, Waschbecken + 'bed' => 1, // Anzahl Betten (1 Etagenbett) + 'dim' => array( // Abmessungen der Kabine (Breite/Hoehe/Laenge) + 2, 2.5, 2 + ) + ) + ), + 'builds' => array( // *** Welche Oberklasse verwendet werden sollen *** + 'Motor' => "MaschineRoom", + 'Bridge' => "BaseUpperStructure", + 'LuxuryCabin' => "BaseCabin", + 'PremierCabin' => "BaseCabin", + 'LowCabin' => "BaseCabin", + 'EconomyCabin' => "BaseCabin", + 'CarDeck' => "BaseDeck", + 'TrainDeck' => "BaseDeck", + 'TruckDeck' => "BaseDeck" + ) +); + +// Preisliste auffuellen +foreach ($einbauten['parts'] as $key=>$part) { + // Create item array string + $item = ""; + foreach ($part as $idx=>$itemPart) { + if (is_string($itemPart)) { + // String found + $item .= sprintf("\"%s\", ", $itemPart); + } elseif (is_int($itemPart)) { + // Integer found + $item .= sprintf("%d, ", $itemPart); + } elseif (is_float($itemPart)) { + // Float found + $item .= sprintf("%f, ", $itemPart); + } elseif (is_array($itemPart)) { + // Sub-array found + $item .= "array("; + + // Go all items through + foreach ($itemPart as $idx2=>$subPart) { + if (is_int($subPart)) { + // Integer again found + $item .= sprintf("%d, ", $subPart); + } elseif (is_float($subPart)) { + // Float found + $item .= sprintf("%f, ", $subPart); + } else { + // Unsupport part found + die(sprintf("[Main:] Unsupported sub-array element on pos %d in array %s found: %s", $idx2, $idx, $subPart)); + } + } + + // Remove trailing comma + $item = substr($item, 0, -2); + + // Add closing bracket + $item .= "), "; + } else { + // Unsupport part found + die(sprintf("[Main:] Unsupported array element on pos %d: %s", $idx, $itemPart)); + } + } + + // Remove trailing comma + $item = substr($item, 0, -2); + + // Random price + $price = mt_rand(5, 12) * 10000; + + // Give it a try... + try { + // Generate command for adding objects to a price list + $eval = sprintf("\$merchant->addItemToPriceList(%s::create%s(%s), %d);", + $key, + $key, + $item, + $price + ); + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) DebugMiddleware::getInstance()->output(sprintf("[Main:] Konstruierte PHP-Anweisung:
%s

\n", + htmlentities($eval) + )); + + // Run the constructed command + eval($eval); + } catch (ItemNotTradeableException $e) { + die(sprintf("[Main:] Die Preisliste des Händlers %s kann nicht befüllt werden. Grund: %s
\n", + $merchant->getMerchantName(), + $e->getMessage() + )); + } +} + +// Haendler-Objekt debuggen +if (defined('DEBUG_MERCHANT_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Der Händler %s sieht wie folgt aus:
+
%s
\n", + $merchant->getMerchantName(), + print_r($merchant, true) + )); +} + +// Reederei gruenden +$shipping = ShippingCompany::createShippingCompany("Hanseatic Travel Company", $harbor); + +// Firmenschef setzen +try { + $shipping->setCompanyFounder(CompanyEmployee::createCompanyEmployee("Roland", "Häder", "M", 1977, 9, 26, true, 2000)); +} catch (BirthdayInvalidException $e) { + die(sprintf("[Main:] Reederei-Gründer konnte nicht gesetzt werden. Grund: %s
\n", + $e->getMessage() + )); +} + +// Dann mal ausgeben... +DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s ist von %s %s gegründet worden.
\n", + $shipping->getCompanyName(), + $shipping->getFounderInstance()->getSurname(), + $shipping->getFounderInstance()->getFamily() +)); + +// Die Reederei stellt Personal ein und bedient sich an der $personell-Instanz +try { + $shipping->recruitRandomEmployees(10, $personell); +} catch (ToMuchEmployeesException $e) { + die(sprintf("[Main:] Die Reederei %s konnte kein Personal einstellen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (OutOfBoundsException $e) { + die(sprintf("[Main:] Die Reederei %s konnte kein Personal einstellen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} + +// Anzahl Personal ausgeben +DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s hat nun %d weitere Mitarbeiter.
\n", + $shipping->getCompanyName(), + $shipping->getTotalEmployee() +)); + +// Dann die ersten 3 Werften in den Hafen einbauen und Personal zuweisen +$shipping->createShipyardInHarbor("Werft 1", $harbor); +$shipping->createShipyardInHarbor("Werft 2", $harbor); +$shipping->createShipyardInHarbor("Werft 3", $harbor); + +// In alle Werften sollen Passagierschiffe gebaut werden koennen +try { + $shipping->addShipTypeToAllShipyards("PassengerShip"); +} catch (ClassNotFoundException $e) { + die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (ClassMismatchException $e) { + die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Die Reederei %s kann ihre Werften nicht beschäftigen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} + +// Personal auf die Werften verteilen +try { + $shipping->distributeAllPersonellOnShipyards(); +} catch (NoShipyardsConstructedException $e) { + die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (ClassMismatchException $e) { + die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Die Reederei %s konnte kein Personal den Werften zuteilen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} + +// Normale Meldung ausgeben +DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s beschäftigt nun ihre %d Mitarbeiter in %d Werft(en):
\n", + $shipping->getCompanyName(), + $shipping->getTotalEmployee(), + $shipping->getTotalShipyards() +)); + +// Dann nimmt die Reederei ihren ersten Bauauftrag entgegen. +// Sie muss auch sich selber Bauauftraege erteilen! +try { + $shipping->addNewWorksContract(WorksContract::createWorksContract("PassengerShip", "M/S Poseidon", $shipping)); +} catch (ClassNotFoundException $e) { + die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (EmptyStructuresListException $e) { + die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} + +// Auftrag-Instanz holen +$contract = $shipping->getLastContractInstance(); + +// Die Reederei hat einen Haendler gewaehlt +try { + $shipping->setMerchantInstance($merchant); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", + $merchant->getMerchantName(), + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", + $merchant->getMerchantName(), + $e->getMessage() + )); +} catch (ClassMismatchException $e) { + die(sprintf("[Main:] Der Händler %s konnte nicht ausgewählt werden. Grund: %s
\n", + $merchant->getMerchantName(), + $e->getMessage() + )); +} + +// Den Bauauftrag mit der Reederei abgleichen, ob sie den Schiffstyp bauen koennen +try { + $typeValid = $shipping->validateWorksContractShipType($contract); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht validieren. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht validieren. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} + +// Kann gebaut werden? +if ($typeValid) { + DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s kann Schiffe vom Typ %s bauen.
\n", + $shipping->getCompanyName(), + $contract->getShipInstance()->getPartDescr() + )); +} else { + DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s kann keine Schiffe vom Typ %s bauen!
\n", + $shipping->getCompanyName(), + $contract->getShipInstance()->getPartDescr() + )); + exit; +} + +// Dann den Bauauftrag verfeinern +foreach ($einbauten['parts'] as $key=>$part) { + try { + $contract->addContractDetails($key, $einbauten['builds'][$key], $part); + } catch (ShipPartNotConstructableException $e) { + // Output message + die($e->getMessage()); + } catch (ShipNotConstructedException $e) { + // Output message + die($e->getMessage()); + } catch (ItemNotInPriceListException $e) { + die(sprintf("[Main:] Der Artikel %s konnte nicht in der Preisliste gefunden werden. Grund: %s
\n", + $key, + $e->getMessage() + )); + } catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Der Artikel %s konnte nicht in der Preisliste gefunden werden. Grund: %s
\n", + $key, + $e->getMessage() + )); + } +} + +// Reederei-Objekt ausgeben +if (defined('DEBUG_COMPANY_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s sieht wie folgt aus:
+
%s
\n", + $shipping->getCompanyName(), + print_r($shipping, true) + )); +} + +// Etwas aufraeumen +unset($einbauten); +unset($part); +unset($eval); +unset($item); +unset($key); +unset($typeValid); + +// Gesamtwert ausgeben +try { + $totalValue = $contract->getTotalPrice(); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", + $e->getMessage() + )); +} catch (EmptyStructuresListException $e) { + die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", + $e->getMessage() + )); +} catch (TotalPriceNotCalculatedException $e) { + die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: %s
\n", + $e->getMessage() + )); +} + +// Wert ausgeben +DebugMiddleware::getInstance()->output(sprintf("Der Bau der %s wird der Reederei %s voraussichtlich %s kosten.
\n", + $contract->getShipInstance()->getShipName(), + $shipping->getCompanyName(), + $contract->formatCurrency($totalValue) +)); + +// Etwas aufraeumen +unset($totalValue); + +// Den Bauvertrag unterschreiben (damit wird er in den Bau-Queue aufgenommen) +try { + $shipping->signContract($contract, $shipping); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (InvalidContractPartnerException $e) { + die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (ContractAllreadySignedException $e) { + die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} catch (WrongContractPartnerException $e) { + die(sprintf("[Main:] Die Reederei %s konnte den Bauauftrag nicht unterzeichnen. Grund: %s
\n", + $shipping->getCompanyName(), + $e->getMessage() + )); +} + +// Meldung ausgeben +if ($contract->isSigned()) { + DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s hat den Bau der %s zugestimmt.
\n", + $shipping->getCompanyName(), + $contract->getShipInstance()->getShipName() + )); +} else { + DebugMiddleware::getInstance()->output(sprintf("Die Reederei %s hat den Bau der %s abgelehnt.
\n", + $shipping->getCompanyName(), + $contract->getShipInstance()->getShipName() + )); + exit; +} + +// Auftrag-Objekt ausgeben +if (defined('DEBUG_CONTRACT_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Der Bauauftrag sieht wie folgt aus:
+
%s
\n", + print_r($contract, true) + )); +} + +// Erstmal bis hier hin... +//exit(); + +// Anzahl Betten ermitteln +try { + $totalBeds = $contract->getShipInstance()->calcTotalBeds(); +} catch (StructuresOutOfBoundsException $e) { + die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (EmptyStructuresListException $e) { + die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: %s
\n", + $e->getMessage() + )); +} + +// Bettenanzahl ausgeben +DebugMiddleware::getInstance()->output(sprintf("Es stehen %d Betten zur Verfügung.", + $totalBeds +)); + +// +?> diff --git a/tests/loader-test.php b/tests/loader-test.php new file mode 100644 index 0000000..668e612 --- /dev/null +++ b/tests/loader-test.php @@ -0,0 +1,158 @@ +%s
\n", + $e->getMessage() + )); +} catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (FileIsEmptyException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (FilePointerNotOpenedException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidMD5ChecksumException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidDataLengthException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidSimulatorIDException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (MismatchingCompressorsException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerItemIsNullException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerItemIsNoArrayException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerMaybeDamagedException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} + +// Personal-Objekt debuggen +if (defined('DEBUG_PERSONELL_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:
+
%s
\n", + print_r($test, true) + )); +} + +// Erstmal bis hier hin +exit(); + +// Etwas zum Testen... +try { + $test = SimulatorPersonell::createSimulatorPersonell(20); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", + $e->getMessage() + )); +} + +// Personal-Objekt debuggen +if (defined('DEBUG_PERSONELL_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:
+
%s
\n", + print_r($test, true) + )); +} + +// Try to save the object (for testing purposes) +try { + $test->saveObjectToDatabase(); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidObjectException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (UnsupportedLimitationPartException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (GetterNotFoundException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoArrayCreatedException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} + +// +?> diff --git a/tests/personell-test.php b/tests/personell-test.php new file mode 100644 index 0000000..e6acd10 --- /dev/null +++ b/tests/personell-test.php @@ -0,0 +1,159 @@ +%s
\n", + $e->getMessage() + )); +} catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (FileIsEmptyException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (FilePointerNotOpenedException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidMD5ChecksumException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidDataLengthException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidSimulatorIDException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (MismatchingCompressorsException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerItemIsNullException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerItemIsNoArrayException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} catch (ContainerMaybeDamagedException $e) { + die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: %s
\n", + $e->getMessage() + )); +} + +// Personal-Objekt debuggen +if (defined('DEBUG_PERSONELL_OBJ')) { + echo sprintf("Das Personal-Objekt sieht wie folgt aus:
+
%s
\n", + print_r($test, true) + ); +} + +// Erstmal bis hier hin +exit(); + +// Etwas zum Testen... +try { + $test = SimulatorPersonell::createSimulatorPersonell(20); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Personenliste nicht angelegt. Grund: %s
\n", + $e->getMessage() + )); +} + +// Personal-Objekt debuggen +if (defined('DEBUG_PERSONELL_OBJ')) { + echo sprintf("Das Personal-Objekt sieht wie folgt aus:
+
%s
\n", + print_r($test, true) + ); +} + +// Try to save the object (for testing purposes) +try { + $test->saveObjectToDatabase(); +} catch (NullPointerException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoObjectException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidObjectException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (MissingMethodException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (UnsupportedLimitationPartException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (GetterNotFoundException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (NoArrayCreatedException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} catch (InvalidArrayCountException $e) { + die(sprintf("[Main:] Objekt nicht gespeichert. Grund: %s
\n", + $e->getMessage() + )); +} + +// +?>