* 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
--- /dev/null
+# 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 <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> 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 <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> 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
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class holding general data about the application and some methods for
+ * the management including the entry point.
+ *
+ * E.g.:
+ *
+ * index.php?app=my_app
+ *
+ * You need to create a folder in the folder "application" named "my_app"
+ * (without the quotes) and create a include file called
+ * class_ApplicationHelper.php. You have to write the same class for your
+ * application and implement the same interface called ManageableApplication
+ * because this class include file will be searched for.
+ *
+ * It is good when you avoid more GET parameters to keep URLs short and sweet.
+ * But sometimes you need some GET paramerers e.g. for your imprint or info page
+ * or other linked pages which you have to create and state some informations.
+ *
+ * Please remember that this include file is being loaded *before* the class
+ * loader is loading classes from "exceptions", "interfaces" and "main"!
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @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]
+?>
--- /dev/null
+<?php
+/**
+ * The application selector class.
+ *
+ * Please remember that this include file is being loaded *before* the class
+ * loader is loading classes from "exceptions", "interfaces" and "main"!
+ *
+ * @todo Extend a later BaseFrameworkApplication class
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @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: <pre><em>%s</em></pre><br />\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("<pre>".print_r($curr, true)."</pre>");
+
+ } // END - for
+ }
+
+ /**
+ * Stub!
+ */
+ public function saveObjectToDatabase () {
+ $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Initialize some debug constants here
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Set the new handler
+//set_exception_handler('selector_exception_handler');
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Application initializer
+//
+// Please remember that this include file is being loaded *before* the class
+// loader is loading classes from "exceptions", "interfaces" and "main"!
+//
+// Get an instance of the initializer
+$eval = sprintf("\$app = %s::getInstance();",
+ FrameworkConfiguration::getInstance()->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]
+?>
--- /dev/null
+<?php
+// The application's class loader
+if (!isset($application)) {
+ // We need this!
+ ApplicationEntryPoint::app_die("[Main:] Interne Variable <strong>application</strong> 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]
+?>
--- /dev/null
+<?php
+// Is there an application helper instance? We need the method main() for
+// maining the application
+$app = ApplicationHelper::getInstance();
+
+// Some sanity checks
+if ((empty($app)) || (is_null($app))) {
+ // Something went wrong!
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden, da die Hilfsklasse <strong>%s</strong> nicht geladen ist!",
+ $application,
+ FrameworkConfiguration::getInstance()->readConfig("app_helper_class")
+ ));
+} elseif (!is_object($app)) {
+ // No object!
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> 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 <strong>%s</strong> kann nicht gestartet werden, da die Methode <strong>%s</strong> 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 <strong>%s</strong> kann nicht gestartet werden. Grund: <u>%s</u>",
+ $application,
+ $e->getMessage()
+ ));
+}
+
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<!-- This template is a frame template for all application templates //-->
+$content[apps_list]
--- /dev/null
+<!-- A compileable template for the application selector //-->
+
+{?header:title={--WELCOME_APPLICATION_SELECTOR--}?}
+
+{?navigation:nav_row=home;imprint;contact?}
+
+<div class="selector_header">
+ {--HEADER_APPLICATION_SELECTOR--}
+</div>
+
+<div class="selector_list_apps">
+ {?selector_apps?}
+</div>
+
+{?footer_msg:footer_msg={--FOOTER_APPLICATION_SELECTOR--}?}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class holding general data about the application and some methods for
+ * the management including the entry point.
+ *
+ * E.g.:
+ *
+ * index.php?app=my_app
+ *
+ * You need to create a folder in the folder "application" named "my_app"
+ * (without the quotes) and create a include file called
+ * class_ApplicationHelper.php. You have to write the same class for your
+ * application and implement the same interface called ManageableApplication
+ * because this class include file will be searched for.
+ *
+ * It is good when you avoid more GET parameters to keep URLs short and sweet.
+ * But sometimes you need some GET paramerers e.g. for your imprint or info page
+ * or other linked pages which you have to create and state some informations.
+ *
+ * Please remember that this include file is being loaded *before* the class
+ * loader is loading classes from "exceptions", "interfaces" and "main"!
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @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]
+?>
--- /dev/null
+<?php
+// Initialize some debug constants here
+
+// Reederei-Objekt debuggen
+//define('DEBUG_COMPANY_OBJ', true);
+// Hafen-Objekt debuggen
+//define('DEBUG_HARBOR_OBJ', true);
+// Schiff-Objekt debuggen
+//define('DEBUG_SHIP_OBJ', true);
+// Auftrag-Objekt debuggen
+//define('DEBUG_CONTRACT_OBJ', true);
+// Haendler-Objekt debuggen
+//define('DEBUG_MERCHANT_OBJ', true);
+// Personal-Objekt debuggen
+//define('DEBUG_PERSONELL_OBJ', true);
+// Personal debuggen
+//define('DEBUG_PERSONELL', true);
+// Reederei debuggen
+//define('DEBUG_COMPANY', true);
+// Mitarbeiter debuggen
+//define('DEBUG_COMPANY_EMPLOYEE', true);
+// Hafen debuggen
+//define('DEBUG_HARBOR', true);
+// Werft debuggen
+//define('DEBUG_SHIPYARD', true);
+// Schiff debuggen
+//define('DEBUG_SHIP', true);
+// Schiffstruktur debuggen
+//define('DEBUG_STRUCTURE', true);
+// Kabinen debuggen
+//define('DEBUG_CABIN', true);
+// Decks debuggen
+//define('DEBUG_DECK', true);
+// Bauauftraege debuggen
+//define('DEBUG_CONTRACT', true);
+// Haendler debuggen
+//define('DEBUG_MERCHANT', true);
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Set the new handler
+//set_exception_handler('shipsimu_exception_handler');
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class BirthdayInvalidException extends FrameworkException {
+ public function __construct ($birthArray, $code) {
+ // Cast the array
+ $birthArray = (array) $birthArray;
+
+ // Add a message around the missing class
+ $message = sprintf("Das Geburtsdatum <u>%s</u> 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]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class CabinShipMismatchException extends FrameworkException {
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ContractAllreadySignedException extends FrameworkException {
+ public function __construct ($classArray, $code) {
+ // Cast the array
+ $classArray = (array) $classArray;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:] Die Vertragsparteien <u>%s</u> und <u>%s</u> haben den Vertrag bereits unterzeichnet!",
+ $classArray[0]->__toString(),
+ $classArray[1]->getCompanyName(),
+ $classArray[2]->getCompanyName()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ContractPartnerMismatchException extends FrameworkException {
+ public function __construct ($classArray, $code) {
+ // Cast the array
+ $classArray = (array) $classArray;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:] Der Vertragspartner von <u>%s</u> ist ungütig (<u>%s</u>) und darf diesen Vertrag nicht unterzeichnen!",
+ $classArray[0]->__toString(),
+ $classArray[1]->getCompanyName(),
+ $classArray[2]->getCompanyName()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class DeckShipMismatchException extends FrameworkException {
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class EmptyStructuresListException extends FrameworkException {
+ public function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:] Die Strukturen-Liste ist leer.",
+ $class->__toString()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidContractPartnerException extends FrameworkException {
+ public function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:] <u>%s</u> ist kein gütiger Vertragspartner.",
+ $class->__toString(),
+ $class->getPartDescr()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidIDFormatException extends FrameworkException {
+ public function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:] Ungültige ID-Nummer übergeben.",
+ $class->__toString()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ItemNotInPriceListException extends FrameworkException {
+ public function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[Merchant:] Preis für den Artikel <u>%s</u> <em><u>%s</u></em> nicht gefunden.",
+ $class->__toString(),
+ $class->getPartDescr()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ItemNotTradeableException extends FrameworkException {
+ public function __construct ($classArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:] <u>%s</u> ist nicht handelbar!",
+ $classArray[0]->__toString(),
+ $classArray[1]->getPartDescr()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class MissingSimulatorIDException extends FrameworkException {
+ public function __construct ($classArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:] Die Simulator-ID <u>%s</u> scheint ungültig zu sein.",
+ $classArray[0]->__toString(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class MotorShipMismatchException extends FrameworkException {
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class NoShipyardsConstructedException extends FrameworkException {
+ public function __construct ($class, $code) {
+ if (is_object($class)) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:] Keine Werften gefunden!",
+ $class->__toString()
+ );
+ } else {
+ // No class given
+ $message = sprintf("Please provide a class for <u>%s</u>", __CLASS__);
+ }
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// A crew list has already been initialized
+class PersonellListAlreadyCreatedException extends FrameworkException {
+ public function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:] Die interne Crew-Liste wurde bereits initialisiert.",
+ $class->__toString()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class RoomShipMismatchException extends FrameworkException {
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class ShipNotConstructedException extends FrameworkException {
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ShipPartNotConstructableException extends FrameworkException {
+ public function __construct (array $partArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Schiffteil <u>%s</u> ist nicht constrierbar!",
+ $partArray[0]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class StructureShipMismatchException extends FrameworkException {
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class StructuresOutOfBoundsException extends FrameworkException {
+ public function __construct ($idx, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Der Index <u>%s</u> liegt ausserhalb des gütigen Bereiches! Schiffsteil nicht auffindbar.", $idx);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ToMuchEmployeesException extends FrameworkException {
+ public function __construct ($amountArray, $code) {
+ // Cast the array
+ $amountArray = (array) $amountArray;
+
+ // Add a message around the missing class
+ $message = sprintf("<u>%d</u> Leute nicht einstellbar, da nur <u>%d</u> arbeitslos sind!",
+ $amountArray[0],
+ $amountArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class TotalPriceNotCalculatedException extends FrameworkException {
+ public function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:] Gesamtpreis ist nicht ermittelbar.",
+ $class->__toString()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class UnsupportedLimitationPartException extends FrameworkException {
+ public function __construct ($str, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Limitierungsinformation <u>%s</u> wird derzeit nicht unterstützt.", $str);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class WrongGenderSpecifiedException extends FrameworkException {
+ public function __construct ($gender, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Das Geschlecht <u>%s</u> Ist nicht <em>M</em> (Männlich) oder <em>F</em> (Weiblich).", $gender);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Application initializer
+//
+// Please remember that this include file is being loaded *before* the class
+// loader is loading classes from "exceptions", "interfaces" and "main"!
+//
+// You can prevent adding this application to the selector by uncommenting the
+// following line:
+//
+// if ((isset($this)) && (is_object($this)) && ($this->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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for constructable ships
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface ConstructableShip extends FrameworkInterface {
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An interface for constructable ship parts
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface ConstructableShipPart extends FrameworkInterface {
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An interface for contract partners
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @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]
+?>
--- /dev/null
+<?php
+/**
+ * An interface for all customers
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @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]
+?>
--- /dev/null
+<?php
+/**
+ * An interface for tradeable items
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @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]
+?>
--- /dev/null
+<?php
+/**
+ * An interface for all personells
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @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]
+?>
--- /dev/null
+<?php
+// The application's class loader
+if (!isset($application)) {
+ // We need this!
+ ApplicationEntryPoint::app_die("[Main:] Interne Variable <strong>application</strong> 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 <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
+ $class,
+ $e->getMessage()
+ ));
+ } catch (PathIsEmptyException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
+ $class,
+ $e->getMessage()
+ ));
+ } catch (PathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
+ $class,
+ $e->getMessage()
+ ));
+ } catch (DirPointerNotOpenedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
+ $class,
+ $e->getMessage()
+ ));
+ }
+}
+
+// Include all classes
+ClassLoader::getInstance()->includeAllClasses();
+
+// Clean up the global namespace
+unset($lowerClasses);
+unset($class);
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ die("limitObject() reached! Stub!");
+ }
--- /dev/null
+<?php
+// What every kind of personell have
+class BasePersonell extends BaseFrameworkSystem implements Personellizer {
+ // Maximum/minimum age
+ private $MIN_AGE = 21;
+ private $MAX_AGE = 40;
+
+ // Male/female
+ private $gender = ""; // M=Male, F=Female, empty=uninitialized
+
+ // Year/month/day of birth
+ private $yearBirth = 0;
+ private $monthBirth = 0;
+ private $dayBirth = 0;
+
+ // Surname/family name
+ private $surname = "";
+ private $family = "";
+
+ // Employed?
+ private $employed = false;
+
+ // Married?
+ private $married = false;
+
+ // Her/his salary
+ private $salary = 0.00;
+
+ // Constructor
+ private function __construct ($class) {
+ // Call parent constructor
+ parent::constructor($class);
+
+ // Debug message
+ if ((defined('DEBUG_PERSONELL')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[PersonellBase:] Konstruktor erreicht.<br />\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.<br />\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]
+?>
--- /dev/null
+<?php
+
+// Ein sehr abstraktes Objekt, Abmasse, Beschreibung und Teil-Instanz werden hier gespeichert
+class BaseSimulator extends BaseFrameworkSystem {
+ // Schiffsteilinstanz
+ private $partInstance = null;
+
+ // Abmasse (Breite/Hoehe/Laenge)
+ private $width = 0;
+ private $height = 0;
+ private $length = 0;
+
+ // Aktuelles Schiff und Schiffsteil
+ private $currShip = null;
+ private $currPart = null;
+
+ // Faktoren zur Erweiterung der Masse. Beispielsweise soll der Maschinenraum groesser wie der Motor sein
+ private $resizeFactorArray = array(
+ 'width' => 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.<br />\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 <strong>%s</strong> in class.<br />\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 <strong>%s</strong> from class.<br />\n",
+ $this->__toString(), $var
+ ));
+ unset($this->$var);
+ }
+
+ // Setter-Methode fuer Laenge
+ public function setLength ($length) {
+ if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] <strong>%dm</strong> Länge gesetzt.<br />\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:] <strong>%dm</strong> Breite gesetzt.<br />\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:] <strong>%dm</strong> Höhe gesetzt.<br />\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.<br />\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.<br />\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.<br />\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.<br />\n",
+ $this->__toString()
+ ));
+ } else {
+ // Leere Instanz kann entfernt werden
+ if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] partInstance wurde entfernt.<br />\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 <strong>%s</strong> wird fuer das Schiff <strong>%s</strong> konstruiert.<br />\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 <strong>%s</strong> vom Typ <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.<br />\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 <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.<br />\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 <strong>%s</strong> vom Typ <strong>%s</strong> 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 <strong>%s</strong> gefunden.<br />\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 <u>%s</u> vom Typ <u>%s</u> 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.<br />\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.<br />\n",
+ $this->__toString()
+ ));
+ unset($this->currShip);
+ }
+
+ // Aktuelle Schiff-Instanz entfernen
+ public function removeCurrPart () {
+ if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrPart erreicht.<br />\n",
+ $this->__toString()
+ ));
+ unset($this->currPart);
+ }
+
+ // Breite entfernen
+ public function removeWidth () {
+ if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Breite entfernt.<br />\n",
+ $this->__toString()
+ ));
+ unset($this->width);
+ }
+
+ // Hoehe entfernen
+ public function removeHeight () {
+ if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe entfernt.<br />\n",
+ $this->__toString()
+ ));
+ unset($this->height);
+ }
+
+ // Laenge entfernen
+ public function removeLength () {
+ if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge entfernt.<br />\n",
+ $this->__toString()
+ ));
+ unset($this->length);
+ }
+
+ // Tiefgang entfernen
+ public function removeDraught () {
+ if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Tiefgang entfernt.<br />\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)<br />\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 <strong>%s</strong>=<strong>%s</strong> gesetzt.<br />\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.<br />\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.<br />\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 <strong>%s</strong>.<br />\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]
+?>
--- /dev/null
+<?php
+
+// Die Haendler-Klasse
+class Merchant extends BaseFrameworkSystem {
+ // Name des Haendlers
+ private $merchantName = "Namenloser Händler";
+
+ // Preislite (Objekte wiedermal!)
+ private $priceList = null;
+
+ // Zugewiesener Hafen
+ private $harborInstance = null;
+
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> niederlassen.<br />\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 <strong>%s</strong> erhält eine leere Preisliste.<br />\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 <strong>%s</strong> ist nun bekannt.<br />\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 <strong>%s</strong> wird verlangt.<br />\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 <strong>%s</strong> lässt sich am <strong>%s</strong> nieder.<br />\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 <strong>%s</strong> hat sich am <strong>%s</strong> niedergelassen.<br />\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 <strong>%s</strong> kann nun das Schiffsteil <strong>%s</strong> "<strong>%s</strong>" zu <strong>%s</strong> verkaufen.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Bauvertrag-Klasse
+class WorksContract extends BaseFrameworkSystem {
+ // Zukuenftiger Schiffsname
+ private $shipName = "";
+
+ // Instanz zum Schiffstypen
+ private $shipInstance = null;
+
+ // Contract partner
+ private $contractPartner = null;
+
+ // Other contract partner
+ private $contractParty = null;
+
+ // Is the contract signed?
+ private $signed = false;
+
+ // Merchant instance
+ private $merchantInstance = null;
+
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.<br />\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: <pre><em>%s</em></pre><br />\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 <strong>%s</strong> wird in den Bauvertrag aufgenommen.<br />\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 <strong>%s</strong> heissen.<br />\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 <strong>%s</strong> angefordert.<br />\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.<br />\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 <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> in den Bauvertrag aufgenommen.<br />\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 <strong>%s</strong> konnte nicht vervollständigt werden. Grund: <strong>%s</strong><br />\\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: <pre><em>%s</em></pre><br />\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.<br />\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 <strong>%s</strong> 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] <strong>%s</strong> kostet <strong>%s</strong>.<br />\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] <strong>%s</strong> wurde in den Bauvertrag aufgenommen.<br />\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 <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> zu.<br />\n",
+ __CLASS__,
+ __LINE__,
+ $partnerInstance->getPartDescr(),
+ $partnerInstance->getCompanyName(),
+ $this->getShipInstance()->getPartDescr(),
+ $this->getShipInstance()->getShipName()
+ ));
+ } else {
+ // Other contract party
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> ein.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Die Reederei-Klasse
+class ShippingCompany extends BaseSimulator implements Customer, ContractPartner {
+ // Firmenname
+ private $companyName = "Namenlose Reederei";
+
+ // Firmenkuerzel
+ private $shortName = "";
+
+ // Reederei-Gruender
+ private $founderInstance = null;
+
+ // Angestellten-Liste
+ private $employeeList = null;
+
+ // Zugewiesener Hafen
+ private $hqInstance = null;
+
+ // Werftenliste
+ private $shipyardList = null;
+
+ // Der Reederei gehoerenden Schiffe
+ private $ownedShips = null;
+
+ // Bauauftraege als Kunde
+ private $contractList = null;
+
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird gegründet.<br />\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 <strong>%s</strong> erhält eine Angestelltenliste.<br />\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 <strong>%s</strong> erhält eine Werftsliste.<br />\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 <strong>%s</strong> erhält eine Auftragsliste.<br />\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 <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.<br />\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 <strong>%s</strong> ist von <strong>%s %s</strong> gegründet worden.<br />\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] <strong>%s %s</strong> tritt der Reederei <strong>%s</strong> als <strong>%s</strong> bei und erhält ein Gehalt von <strong>%s</strong>.<br />\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 <strong>%s</strong> erhält die Werft <strong>%s</strong> hinzugefügt.<br />\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 <strong>%s</strong> stellt per Zufall <strong>%d</strong> neue Mitarbeiter ein.<br />\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 <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> ein.<br />\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 <strong>%s</strong> hat per Zufall <strong>%d</strong> neue Mitarbeiter eingestellt.<br />\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 <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> Werft(en).<br />\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 <strong>%s</strong> hat <strong>%d</strong> Mitarbeiter.<br />\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 <strong>%s</strong> werden die Anzahl der Werften in allen Häfen ermittelt.<br />\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 <strong>%s</strong> hat <strong>%d</strong> Werft(en).<br />\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 <strong>%s</strong> baut in allen Werften bald Schiffe vom Typ <strong>%s</strong>.<br />\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 <strong>%s</strong> prüft den Bauauftrag der <strong>%s</strong>.<br />\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 <strong>%s</strong> prüft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.<br />\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 <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> bauen können.<br />\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 <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.<br />\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 <strong>%s</strong> erstellt einen Bauauftrag für ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.<br />\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:<pre>".print_r($contractInstance, true)."</pre>");
+ }
+
+ // 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 <strong>%s</strong> erteilt an sich selbst einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>".<br />\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 <strong>%s</strong> unterzeichnet einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>" mit der <strong>%s</strong>.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Die Liegeplatz-Klasse
+class Berth extends BaseConstruction {
+ // Durchlaufende Nummer der Liegeplaetze
+ private $berthIndex = 0;
+
+ // Zugewiesener Hafen
+ private $harborInstance = null;
+
+ // Konstruktor
+ private function __construct () {
+ if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Die abstrakte Bauten-Klasse
+class BaseConstruction extends BaseSimulator {
+ // Tiefgang fuer z.B. Trockdocks
+ private $draught = 0;
+
+ // Konstruktor
+ private function __construct ($class) {
+ // Eltern-Konstrutor aufrufen
+ parent::constructor($class);
+
+ // Debug message
+ if ((defined('DEBUG_CORE')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\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.<br />\n",
+ $this->__toString()
+ ));
+ unset($this->draught);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Die Werft-Klasse
+class DryDock extends BaseConstruction {
+ // Zugewiesener Hafen
+ private $harborInstance = null;
+
+ // Konstruktor
+ private function __construct () {
+ if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[DryDock:] Konstruktor erreicht.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Die Hafen-Klasse
+class Harbor extends BaseConstruction {
+ // Namen des Hafens (z.B. Hamburger Hafen)
+ private $harborName = "Unbekannter Hafen";
+
+ // Schiffsliste aller gebauten Schiffe
+ private $constructedShips = null;
+
+ // Liegeplatz-Liste
+ private $berthList = null;
+
+ // List of all assigned shipyards
+ private $shipyardList = null;
+
+ // Constructor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[Harbor:] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird konstruiert.<br />\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 <strong>%s</strong> ist jetzt fertig gebaut.<br />\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 <strong>%s</strong> erstellt.<br />\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 <strong>%s</strong>.<br />\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 <strong>%s</strong> wurde angefordert.<br />\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 <strong>%s</strong> wird im Hafen <strong>%s</strong> gebaut.<br />\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 <strong>%s</strong> wird im Hafen <strong>%s</strong> gebaut.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Die Anlegebruecke-Klasse
+class Terminal extends BaseConstruction {
+ // Zugewiesener Hafen
+ private $harborInstance = null;
+
+ // Konstruktor
+ private function __construct () {
+ if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Die Werft-Klasse
+class Shipyard extends BaseConstruction {
+ // Werft-Name
+ private $shipyardName = "Namenlose Werft";
+
+ // Arbeiter-Liste
+ private $staffList = null;
+
+ // Queue-Liste fuer zu bauende Schiffe
+ private $queueList = null;
+
+ // Aktuell im Bau befindliches Schiff
+ private $currShipInConst = null;
+
+ // Liste konstruierbarer Schiffstypen
+ private $shipTypeList = null;
+
+ // Zugewiesener Hafen
+ private $harborInstance = null;
+
+ // Zugewiesene Reederei
+ private $shippingCompany = null;
+
+ // Constructor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird im Hafen <strong>%s</strong> konstruiert.<br />\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 <strong>%s</strong> wurde gebaut.<br />\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 <strong>%s</strong> erhält eine Arbeiterliste.<br />\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 <strong>%s</strong> erhält eine Typenliste.<br />\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: <pre>".print_r($this, true)."</pre>");
+ }
+
+ // 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 <strong>%s</strong> kann bald Schiffe vom Typ <strong>%s</strong> bauen.<br />\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 <strong>%s</strong> prüft, ob Schiffe vom Typ <strong>%s</strong> baubar sind.<br />\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 <strong>%s</strong> hat die Suche nach dem Schiffstyp <strong>%s</strong> abgeschlossen.<br />\n",
+ __CLASS__,
+ __LINE__,
+ $this->getShipyardName(),
+ $shipType
+ ));
+
+ // Return result
+ return $result;
+ }
+
+ /**
+ * Stub!
+ */
+ public function saveObjectToDatabase () {
+ $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Die abstrakte Antrieb-Klasse
+class BaseDrive extends BaseSimulator {
+ // Price of this drive
+ private $price = 0.00;
+ // PS-Zahl
+ private $horsePower = 0;
+ // Anzahl Nocken
+ private $numCams = 0;
+
+ // Konstruktor
+ private function __construct ($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Debug message
+ if (((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%d</strong> PS gesetzt.<br />\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 <strong>%d</strong> Nocken gesetzt.<br />\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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Motorisierter Antrieb
+class Motor extends BaseDrive implements ItemIsTradeable, ConstructableShipPart {
+ // Constructor
+ private function __construct() {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird gebaut...<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Dieses kann z.B. der Maschinenraum, die Bruecke, Kabinen, Laderaum, etc. sein
+class BaseShipPart extends BaseSimulator {
+ // Price of this ship part
+ private $price = 0.00;
+
+ // Konstruktor
+ private function __construct($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Debug message
+ if (((defined('DEBUG_SHIPPART')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d:] Kontruktor erreicht.<br />\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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Der Maschinenraum ist etwas anderes als eine Kabine, etc. !
+// Daher hat er eine eigene Klasse
+class MaschineRoom extends BaseShipPart {
+ // Constructor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Die Schiffsbesatzung
+class SimulatorPersonell extends BasePersonell {
+ // Personell list
+ private $personellList = null;
+
+ // A cache for lists
+ private $cacheList = null;
+
+ // A string for cached conditions
+ private $cacheCond = null;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ if (((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\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 <strong>%d</strong> Personal bereitgestellt.<br />\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] <strong>%d</strong> Personal bereitgestellt.<br />\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.<br />\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.<br />\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.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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: <pre><em>%s</em></pre><br />\n",
+ __CLASS__,
+ __LINE__,
+ htmlentities($eval)
+ ));
+
+ // Run the command
+ @eval($eval);
+ }
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Die Schiffsbesatzung
+class CompanyEmployee extends SimulatorPersonell {
+ // Employeee list
+ private $employeeList = null;
+
+ // Constructor
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if ((((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s %s</strong> wird angelegt.<br />\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.<br />\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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+class BaseShip extends BaseSimulator {
+ // Name des Shipes
+ private $shipName = "Unbekanntes Schiff";
+
+ // Anzahl Anker
+ private $numAnchor = 0;
+
+ // Tiefgang in Meter
+ private $draught = 0;
+
+ // Besatzung-Objekte
+ private $crewList = null;
+
+ // Aufbauten-Objekte
+ private $structures = null;
+
+ // Namenloses Ship generieren
+ private function __construct($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Beim Schiff angelangt
+ if (((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT')))
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> erhält ein neues Schiffsteil (%s).<br />\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: <pre><em>%s</em></pre><br />\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 <strong>%s</strong> hat keinen Motor erhalten! Grund: <strong>%s</strong><br />\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 <strong>%s</strong> hat keinen Maschinenraum erhalten! Grund: <strong>%s</strong><br />\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 <strong>%s</strong> hat keine Aufbauten erhalten! Grund: <strong>%s</strong><br />\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 <strong>%s</strong> hat keine Kabine erhalten! Grund: <strong>%s</strong><br />\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 <strong>%s</strong> hat kein Deck erhalten! Grund: <strong>%s</strong><br />\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: <strong>%s</strong><br />\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: <strong>%s</strong><br />\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 <strong>%s</strong> hat das Schiffsteil <strong>%s</strong> eingebaut bekommen.<br />\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.<br />\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 <strong>%s</strong> wird auf den Namen <strong>%s</strong> getauft.<br />\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 <strong>%s</strong> ist auf den Namen <strong>%s</strong> getauft worden.<br />\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 <strong>%s</strong> mit dem Namen <strong>%s</strong> hat einen Tiefgang von <strong>%sm</strong>.<br />\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 <strong>%s</strong> wurde angefordert.<br />\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 <strong>%s</strong> mit dem Namen <strong>%s</strong> hat <strong>%s</strong> Anker.<br />\n",
+ __CLASS__,
+ __LINE__,
+ $this->__toString(),
+ $this->shipName,
+ $numAnchor
+ ));
+ $this->numAnchor = (int) $numAnchor;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+class PassengerShip extends BaseShip implements ConstructableShip {
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Kontruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\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 <strong>%d</strong> Betten vom Kabinen-Typ <strong>%s</strong> bereit.<br />\n",
+ __CLASS__,
+ __LINE__,
+ $total,
+ $cabType
+ ));
+ }
+ } else {
+ // Keine Kabine!
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> ist keine Kabine.<br />\n",
+ __CLASS__,
+ __LINE__,
+ $el->getPartDescr()
+ ));
+ }
+ }
+
+ if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das <strong>%s</strong> mit dem Namen <strong>%s</strong> hat <strong>%d</strong> Betten.<br />\n",
+ __CLASS__,
+ __LINE__,
+ $this->getPartDescr(),
+ $this->getShipName(),
+ $numBeds
+ ));
+
+ // Anzahl zurueckliefern
+ return $numBeds;
+ }
+
+ /**
+ * Stub!
+ */
+ public function saveObjectToDatabase () {
+ $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Konstruktionen allgemein (also Aufbauten/Unterbauten)
+class BaseStructure extends BaseSimulator {
+ // Price of this structure
+ private $price = 0.00;
+
+ // Konstruktor (hier keine Exceptions aendern!)
+ private function __construct ($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Debug message
+ if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Kabinen allgemein
+class BaseCabin extends BaseCabinStructure {
+ // Konstruktor
+ private function __construct ($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Debug message
+ if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Economy-Class-Kabinen
+class EconomyCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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]
+?>
--- /dev/null
+<?php
+// 2-Sterne-Kabinen
+class LowCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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]
+?>
--- /dev/null
+<?php
+// Luxuskabinen
+class LuxuryCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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]
+?>
--- /dev/null
+<?php
+// Premier-Kabinen
+class PremierCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[PremierCabin:] Konstruktor erreicht.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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]
+?>
--- /dev/null
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ die("limitObject() reached! Stub!");
+ }
--- /dev/null
+<?php
+// Kabinen allgemein
+class BaseCabinStructure extends BaseStructure {
+ // --- Besondere Eigenschaften dazufuegen: ---
+ // Anzahl der Kabinen im Schiff
+ private $numCabin = 0;
+
+ // Anzahl Raeume pro Kabine (kann auch nur 1 sein)
+ private $numRooms = 0;
+
+ // Anzahl Betten, verallgemeinert
+ private $numBeds = 0;
+
+ // Konstruktor
+ private function __construct ($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Debug message
+ if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.<br />\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 <strong>%s</strong> wurde in das Schiff eingebaut.<br />\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.<br />\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] <strong>%d</strong> Betten angefordert.<br />\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] <strong>%d</strong> Kabine(n) angefordert.<br />\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] <strong>%d</strong> Betten gesetzt.<br />\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] <strong>%d</strong> Raum/Räume gesetzt.<br />\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] <strong>%d</strong> Kabine(n) gesetzt.<br />\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.<br />\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.<br />\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.<br />\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 <strong>%d</strong> Kabinen vom Typ <strong>%s</strong> zu je <strong>%d</strong> Betten. Das sind <strong>%d</strong> Betten.<br />\n",
+ __CLASS__,
+ __LINE__,
+ $num,
+ $cabType,
+ $beds,
+ $cabinBeds
+ ));
+ }
+ return $cabinBeds;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Decks (fuer Cargo) allgemein
+class BaseDeckStructure extends BaseStructure {
+ // Anzahl Decks
+ private $numDecks = 0;
+
+ // Konstruktor
+ private function __construct ($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Debug message
+ if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.<br />\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 <strong>%s</strong> wurde in das Schiff <strong>%s</strong> eingebaut.<br />\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.<br />\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]
+?>
--- /dev/null
+<?php
+// Super structures (renamed to UpperStructure to avoid mixing it with super classes
+class BaseUpperStructure extends BaseStructure {
+ /**
+ * Constructor for all super structures on a ship
+ */
+ private function __construct ($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Debug message
+ if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
+ $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\n",
+ __CLASS__,
+ __LINE__
+ ));
+ }
+
+ // Unique-ID setzen
+ $upperInstance->createUniqueID();
+
+ // Return instance
+ return $upperInstance;
+ }
+
+ /**
+ * Stub!
+ */
+ public function saveObjectToDatabase () {
+ $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Auto-Deck
+class CarDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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]
+?>
--- /dev/null
+<?php
+// Decks fuer LKWs
+class TrainDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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]
+?>
--- /dev/null
+<?php
+// Decks fuer LKWs
+class TruckDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
+ // Konstruktor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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]
+?>
--- /dev/null
+<?php
+// Decks for cargo
+class BaseDeck extends BaseDeckStructure {
+ /**
+ * Constructor for cargo decks in general
+ */
+ private function __construct ($class) {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor($class);
+
+ // Debub message
+ if (((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\n",
+ __CLASS__,
+ __LINE__
+ ));
+
+ // Unique-ID setzen
+ $deckInstance->createUniqueID();
+
+ // Instanz zurueckgeben
+ return $deckInstance;
+ }
+
+ /**
+ * Stub!
+ */
+ public function saveObjectToDatabase () {
+ $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Die Aufbauten allgemein
+class Bridge extends BaseUpperStructure implements ItemIsTradeable, ConstructableShipPart {
+ // Constructor
+ private function __construct () {
+ // Eltern-Konstruktor aufrufen
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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 <strong>%s</strong> erreicht.",
+ $this->__toString(),
+ __FUNCTION__
+ ));
+ }
+
+ /**
+ * Limits this object with an ObjectLimits instance
+ */
+ public function limitObject (ObjectLimits $limitInstance) {
+ ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Is there an application helper instance? We need the method main() for
+// maining the application
+$app = ApplicationHelper::getInstance();
+
+// Some sanity checks
+if ((empty($app)) || (is_null($app))) {
+ // Something went wrong!
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden, da die Hilfsklasse <strong>%s</strong> nicht geladen ist!",
+ $application,
+ FrameworkConfiguration::getInstance()->readConfig("app_helper_class")
+ ));
+} elseif (!is_object($app)) {
+ // No object!
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> 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 <strong>%s</strong> kann nicht gestartet werden, da die Methode <strong>%s</strong> 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 <strong>%s</strong> kann nicht gestartet werden. Grund: <u>%s</u>",
+ $application,
+ $e->getMessage()
+ ));
+}
+
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<div class="selector_content">
+ <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
+ 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!
+ </div>
+
+ <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
+ Oder fangen Sie als Matrose auf einem Passagierschiff (virtuell) an zu
+ arbeiten und werden Sie nach wenigen Kreuzfahrten bald Kapitän!
+ </div>
+
+ <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
+ Oder buchen Sie eine virtuelle Kreuzfahrt durch die bekannten Meeren in
+ {!POINTS!} in einer Luxus-Suite!
+ </div>
+</div>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A dummy class for debugging
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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);
+
+//
+?>
--- /dev/null
+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
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Load framework classes first
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+// 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 <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+ $class
+ ));
+ } catch (PathIsEmptyException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+ $class
+ ));
+ } catch (PathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+ $class
+ ));
+ } catch (DirPointerNotOpenedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+ $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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general abstract exception. You should not throw this even when you
+ * remove the "abstract" key-word. Better you make your own exception and
+ * attach a dedicated message to it.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when compressors are mismatching
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> zu den geladenen Daten aus <u>%s</u> und der aktuell verwendete Kompressor <u>%s</u> 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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when a container item is not an array
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a container item is null
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <em>null</em> gesetzt.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the container is possibly damaged
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when the save path string is empty
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the save path is no directory
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> ist ungütig (kein Pfad).", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the save path is read-protected
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the save path is write-protected
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when a directory pointer is not opended
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> konnte kein Pointer initialisiert werden.", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a file pointer is not opened
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> konnte kein Pointer initialisiert werden. Möglicherweise ist die Datei nicht lesbar oder fehlt!", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the length of the data mismatch
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> Byte ist aufgetreten. <u>%s</u> wurden erwartet!",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1],
+ $array[2]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the returned directory resource is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a MD5 checksum does not exception
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> und <u>%s</u> stimmen nicht überein!",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1],
+ $array[2]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the path string is empty
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a given path is not a directory
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> ist ungütig (kein Pfad).", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a path is read-protected
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when the language path string is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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] <u>%s</u> ist keine Zeichenkette!",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the language path string is empty
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the language path is no directory
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> existiert nicht oder ist eine Datei!",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the language path is read-protected
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when two classes are not matching
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> ist ungleich <u>%s</u>.",
+ $classArray[0],
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a class was not found
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> konnte nicht gefunden werden!", $class);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a configuration entry is empty
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a configuration entry is not found
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> nicht gefunden.",
+ $classArray[0],
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thron when dimension entries are not found in an array
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u>", __CLASS__);
+ }
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when an exception was not changed
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when an other exception was not found
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> nicht gefunden.",
+ $classArray[0],
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a getter for an attribute was not found
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> nicht gefunden.",
+ $dataArray[0]->__toString(),
+ $this->getLine(),
+ $dataArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the number of array elements mismatch
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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] <u>%s</u> hat <u>%d</u> Elemente, soll aber <u>%d</u> enthalten!",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1],
+ $array[2],
+ $array[3]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when an instance variable instances a non-object
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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: <u>%s</u>)",
+ $class->__toString(),
+ $this->getLine(),
+ $class->getPartDescr()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when required array elements are missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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("</u>, <u>", $classArray[2]);
+ } else {
+ // Invalid data
+ $elements = "invalid_data";
+ }
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Das Array <u>%s()</u> keine Elemente <u>%s</u> auf!",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1],
+ $elements
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the decimal and thousands seperators are missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a method is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s()</u> auf!",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown then no array was created in a dynamic environment
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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] <u>%s</u> ist kein erstelltes Objekt.",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the variable holds no array
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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("<u>%s</u> ist kein Array!",
+ $string
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A deprecated exception which should be replaced with InvalidObjectException
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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("<u>%s</u> ist kein Objekt!",
+ $string
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when an object instance is null
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <em>null</em> gesetzt.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a variable is not set
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> wurde keine Variable <u>%s</u> erzeugt.",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1],
+ $array[2]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception throws when the base path is empty
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the base path is no directory
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> existiert nicht oder ist eine Datei!",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the base path is read-protected
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception throws hen the base path string is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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] <u>%s</u> ist keine Zeichenkette!",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a template variable name is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> gefundene Variable <u>%s</u> ist nicht gültig! Gültige Variablennamen sind nur <u>%s</strong>.",
+ $class[0]->__toString(),
+ $this->getLine(),
+ basename($class[1]),
+ $class[2],
+ $class[3]->readConfig("tpl_valid_var")
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception throws when the template type is not supported
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <u>%s</u> entspricht nicht dem erwartetem Template-Typ <u>%s</u>.",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1],
+ $class[2]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for managing applications. This can be a lot. E.g.:
+ *
+ * - Un-/locking applications
+ * - Creating selectors for the selector-mode
+ * - Usage statistics
+ * - And many more...
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * This is the top-level interface for all other interfaces and should contain
+ * method stubs which is being used in every class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface FrameworkInterface {
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for compression classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The general interface for all other database interfaces
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for front-end database classes. The classes should prepare the
+ * objects for saving in the database. So for server-bases database classes SQL
+ * queries shall be generated and send to the backend classes. In case of local
+ * file databases the object shall be serialized and (maybe) transparently
+ * compressed before they got saved to a local file.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for middleware database classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface DatabaseConnector extends FrameworkDatabaseInterface {
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for debugger classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface Debugger extends FrameworkInterface {
+ /**
+ * Outputs the given data
+ *
+ * @param $output Debug text for output
+ * @return void
+ */
+ function outputStream ($output);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This is an inface for limiting object while saving them with the
+ * DatabaseConnection class.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for streams
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface Streamable extends FrameworkInterface {
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for file input operations.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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);
+}
+
+//
+?>
--- /dev/null
+<?php
+/**
+ * An interface for file output operations.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for output streams
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for language systems
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface ManageableLanguage extends FrameworkInterface {
+ /**
+ * Initialize the array-object for all later language strings
+ *
+ * @return void
+ */
+ function initLanguageStrings();
+} // END - class
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for template engines
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The simulator system class is the super class of all other classes. This
+ * class handles saving of games etc.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s</strong> wird zerstört.<br />\n",
+ __CLASS__, $this->__toString()
+ ));
+ }
+
+ // Destroy all informations about this class but keep some text about it alive
+ $this->setPartDescr(sprintf("Entferntes Objekt <em>%s</em>", $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 <strong>%s</strong> wurde bereits zerstört.<br />\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: <pre><em>%s</em></pre><br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <strong>%s</strong> angefordert.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <strong>%s</strong> gesetzt.<br />\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.<br />\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.<br />\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.<br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <u>%s</u>.<br />\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.<br />\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 <u>%s</u>.<br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <strong>%s</strong>=<strong>%s</strong>?<br />\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:] <strong>%s</strong>=<strong>%s</strong>?<br />\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:] <strong>%d</strong> wird umformatiert.<br />\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.<br />\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 <u>%s</u> angefordert.<br />\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]
+?>
--- /dev/null
+<?php
+/**
+ * Class for saving arrays as an object. We need this little extension for
+ * some common methods used in the whole application. Please see below if you
+ * need more details.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * BZIP2 compression and decompression class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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.<br />\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.<br />\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 <strong>nicht</strong> gefunden.<br />\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.<br />\n",
+ $this->__toString()
+ ));
+ return "bz2";
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * GZIP compression and decompression class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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.<br />\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.<br />\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 <strong>nicht</strong> gefunden.<br />\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.<br />\n",
+ $this->__toString()
+ ));
+ return "gz";
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Null compression and decompression class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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.<br />\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.<br />\n",
+ $this->__toString()
+ ));
+ return "null";
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This class contains static helper functions for console applications
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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: <strong>%s</strong><br />\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: <strong>%s</strong><br />\n",
+ $helper->__toString(),
+ $ip
+ ));
+ }
+ } catch (FrameworkException $e) {
+ // Do nothing here
+ }
+
+ // Return the IP address
+ return $ip;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An abstract database access class for handling database I/O requests
+ *
+ * @see DatabaseFrontendInterface An interface for database frontends (front-end to the application)
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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.<br />\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 <strong>%s</strong> angefordert.<br />\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 <strong>%s</strong> soll verwendet werden.<br />\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 <strong>%s</strong> wird verwendet und beinhaltet <strong>%s</strong> Einträge.<br />\n",
+ $this->__toString(),
+ $limitInstance->__toString(),
+ $array->count()
+ ));
+ }
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Database backend class for storing objects in locally created files.
+ *
+ * This class serializes objects and saves them to local files.
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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.<br />\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 <strong>%s</strong> wird verwendet.<br />\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 <strong>%s</strong> soll in eine lokale Datei gespeichert werden.<br />\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 <strong>%s</strong> ist nach der Serialisierung <strong>%s</strong> Byte gross.<br />\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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A debug output class for the console (e.g. hub software)
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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!");
+ }
+}
+
+//
+?>
--- /dev/null
+<?php
+/**
+ * A debug output class for PHP's error_log() command
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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);
+ }
+ }
+}
+
+//
+?>
--- /dev/null
+<?php
+/**
+ * A debug output class for the web browser
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This object limits other objects. This is mostly being used to prepare
+ * objects to the datatabase connection or else a lot heap would be saved.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * This class contains object attributes which we can now send together to
+ * other classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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.<br />\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: <pre><em>%s</em></pre><br />\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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An universal class for file input/output streams.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A class for directory reading and getting its contents
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A class for reading files
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A class for writing files
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The language sub-system for handling language strings being used in the
+ * application and whole framework
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This class simply puts HTML code / JavaScript code or CSS code out to the
+ * browser
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * This class simply puts HTML code / JavaScript code or CSS code out to the
+ * browser
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The own template engine for loading caching and sending out the web pages
+ * and emails.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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 <strong>%s</strong> vom Typ <strong>%s</strong> wird geladen.<br />\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:] <strong>%s</strong> Byte Rohdaten geladen.<br />\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: <pre><em>%s</em></pre><br />\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 <strong>%s</strong> erkannt.",
+ $this->__toString(),
+ $this->getTemplateType()
+ ));
+ die();
+ } else {
+ // Put directly out
+ // DO NOT REWRITE THIS TO app_die() !!!
+ die(sprintf("[%s:] Unbekannter Template-Typ <strong>%s</strong> erkannt.",
+ $this->__toString(),
+ $this->getTemplateType()
+ ));
+ }
+ break;
+ }
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An abstract middleware class for all other middlware classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Middleware for selecting the right compressor channel
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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: <pre><em>%s</em></pre><br />\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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Database selector class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The middlware debug output system. A *real* or concrete output class shall
+ * become registered with this middleware because the back-fall class will
+ * become deprecated soon.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This is a file IO handler. It handles reading from and writing to files.
+ * Missing paths in writing process will be automatically created.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * Base configuration, you should edit config-local.php (or create it) instead
+ * of editing this configuration file.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+// 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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class for the configuration stuff implemented in a singleton design paddern
+ *
+ * NOTE: We cannot put this in inc/classes/ because it would be loaded (again)
+ * in the class loader. See inc/loader/class_ClassLoader.php for instance
+ *
+ * @see ClassLoader
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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.<br />\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]
+?>
--- /dev/null
+<?php
+/**
+ * Initializes the database layer
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+// 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!<br />
+E.g.:<pre>$GLOBALS['cfg']->defineDatabaseType("local");</pre>
+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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidDirectoryResourceException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (PathIsEmptyException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (PathIsNoDirectoryException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (PathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (DirPointerNotOpenedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Datenbankobjekt debuggen
+if (defined('DEBUG_DATABASE_OBJ')) {
+ DebugMiddleware::getInstance()->output(sprintf("Die Datenbank-Schicht sieht wie folgt aus:<br />
+<pre>%s</pre>\n",
+ print_r($db, true)
+ ));
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Initializes the local file database class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+try {
+ $layer = LocalFileDatabase::createLocalFileDatabase(PATH . "db/", FileIOHandler::getInstance());
+} catch (SavePathIsEmptyException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (SavePathNotFoundException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (SavePathIsNoDirectoryException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (SavePathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (SavePathWriteProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Initialize the file I/O handler. Currently there is no need to check if
+ * the initialization was successfull or not because only some class
+ * instances will we generated.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+$io = FileIOHandler::createFileIOHandler();
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Loads more include files by using the generic class loader
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+// 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]
+?>
--- /dev/null
+<?php
+/**
+ * Initializes the language system
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+// 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: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+} catch (InvalidLanguagePathStringException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+} catch (LanguagePathIsNoDirectoryException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+} catch (LanguagePathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This class loads class include files with a specific prefix and suffix
+ *
+ * ----------------------------------
+ * 1.1
+ * - loadClasses rewritten to fix some notices
+ * 1.0
+ * - Initial release
+ * ----------------------------------
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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:] <strong>%d</strong> Klassendateien in <strong>%d</strong> Verzeichnissen gefunden und geladen.<br />\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]
+?>
--- /dev/null
+<?php
+/**
+ * Initializes the output middleware layer
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+// 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]
+?>
--- /dev/null
+<?php
+/**
+ * The application selector main include file
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+// 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]
+?>
--- /dev/null
+<?php
+/**
+ * The main class with the entry point to the whole application. This class
+ * "emulates" Java(tm)'s entry point call. Additionally it covers local
+ * variables from outside access to prevent possible attacks on uninitialized
+ * local variables.
+ *
+ * But good little boys and girls would always initialize their variables... ;-)
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+ } catch (InvalidBasePathStringException $e) {
+ die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+ } catch (BasePathIsNoDirectoryException $e) {
+ die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+ } catch (BasePathReadProtectedException $e) {
+ die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ $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: <strong>%s</strong>",
+ $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]
+?>
--- /dev/null
+#!/bin/sh
+
+echo "$0: Cleaning up..."
+find docs/html/ -type f -exec rm -f {} \;
+rm -f docs/*.log
+echo "$0: Done."
+
+doxygen Doxyfile
+++ /dev/null
-# 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 <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> 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 <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> 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
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A class holding general data about the application and some methods for
- * the management including the entry point.
- *
- * E.g.:
- *
- * index.php?app=my_app
- *
- * You need to create a folder in the folder "application" named "my_app"
- * (without the quotes) and create a include file called
- * class_ApplicationHelper.php. You have to write the same class for your
- * application and implement the same interface called ManageableApplication
- * because this class include file will be searched for.
- *
- * It is good when you avoid more GET parameters to keep URLs short and sweet.
- * But sometimes you need some GET paramerers e.g. for your imprint or info page
- * or other linked pages which you have to create and state some informations.
- *
- * Please remember that this include file is being loaded *before* the class
- * loader is loading classes from "exceptions", "interfaces" and "main"!
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @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]
-?>
+++ /dev/null
-<?php
-/**
- * The application selector class.
- *
- * Please remember that this include file is being loaded *before* the class
- * loader is loading classes from "exceptions", "interfaces" and "main"!
- *
- * @todo Extend a later BaseFrameworkApplication class
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @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: <pre><em>%s</em></pre><br />\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("<pre>".print_r($curr, true)."</pre>");
-
- } // END - for
- }
-
- /**
- * Stub!
- */
- public function saveObjectToDatabase () {
- $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Initialize some debug constants here
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Set the new handler
-//set_exception_handler('selector_exception_handler');
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Application initializer
-//
-// Please remember that this include file is being loaded *before* the class
-// loader is loading classes from "exceptions", "interfaces" and "main"!
-//
-// Get an instance of the initializer
-$eval = sprintf("\$app = %s::getInstance();",
- FrameworkConfiguration::getInstance()->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]
-?>
+++ /dev/null
-<?php
-// The application's class loader
-if (!isset($application)) {
- // We need this!
- ApplicationEntryPoint::app_die("[Main:] Interne Variable <strong>application</strong> 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]
-?>
+++ /dev/null
-<?php
-// Is there an application helper instance? We need the method main() for
-// maining the application
-$app = ApplicationHelper::getInstance();
-
-// Some sanity checks
-if ((empty($app)) || (is_null($app))) {
- // Something went wrong!
- ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden, da die Hilfsklasse <strong>%s</strong> nicht geladen ist!",
- $application,
- FrameworkConfiguration::getInstance()->readConfig("app_helper_class")
- ));
-} elseif (!is_object($app)) {
- // No object!
- ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> 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 <strong>%s</strong> kann nicht gestartet werden, da die Methode <strong>%s</strong> 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 <strong>%s</strong> kann nicht gestartet werden. Grund: <u>%s</u>",
- $application,
- $e->getMessage()
- ));
-}
-
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<!-- This template is a frame template for all application templates //-->
-$content[apps_list]
+++ /dev/null
-<!-- A compileable template for the application selector //-->
-
-{?header:title={--WELCOME_APPLICATION_SELECTOR--}?}
-
-{?navigation:nav_row=home;imprint;contact?}
-
-<div class="selector_header">
- {--HEADER_APPLICATION_SELECTOR--}
-</div>
-
-<div class="selector_list_apps">
- {?selector_apps?}
-</div>
-
-{?footer_msg:footer_msg={--FOOTER_APPLICATION_SELECTOR--}?}
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A class holding general data about the application and some methods for
- * the management including the entry point.
- *
- * E.g.:
- *
- * index.php?app=my_app
- *
- * You need to create a folder in the folder "application" named "my_app"
- * (without the quotes) and create a include file called
- * class_ApplicationHelper.php. You have to write the same class for your
- * application and implement the same interface called ManageableApplication
- * because this class include file will be searched for.
- *
- * It is good when you avoid more GET parameters to keep URLs short and sweet.
- * But sometimes you need some GET paramerers e.g. for your imprint or info page
- * or other linked pages which you have to create and state some informations.
- *
- * Please remember that this include file is being loaded *before* the class
- * loader is loading classes from "exceptions", "interfaces" and "main"!
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @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]
-?>
+++ /dev/null
-<?php
-// Initialize some debug constants here
-
-// Reederei-Objekt debuggen
-//define('DEBUG_COMPANY_OBJ', true);
-// Hafen-Objekt debuggen
-//define('DEBUG_HARBOR_OBJ', true);
-// Schiff-Objekt debuggen
-//define('DEBUG_SHIP_OBJ', true);
-// Auftrag-Objekt debuggen
-//define('DEBUG_CONTRACT_OBJ', true);
-// Haendler-Objekt debuggen
-//define('DEBUG_MERCHANT_OBJ', true);
-// Personal-Objekt debuggen
-//define('DEBUG_PERSONELL_OBJ', true);
-// Personal debuggen
-//define('DEBUG_PERSONELL', true);
-// Reederei debuggen
-//define('DEBUG_COMPANY', true);
-// Mitarbeiter debuggen
-//define('DEBUG_COMPANY_EMPLOYEE', true);
-// Hafen debuggen
-//define('DEBUG_HARBOR', true);
-// Werft debuggen
-//define('DEBUG_SHIPYARD', true);
-// Schiff debuggen
-//define('DEBUG_SHIP', true);
-// Schiffstruktur debuggen
-//define('DEBUG_STRUCTURE', true);
-// Kabinen debuggen
-//define('DEBUG_CABIN', true);
-// Decks debuggen
-//define('DEBUG_DECK', true);
-// Bauauftraege debuggen
-//define('DEBUG_CONTRACT', true);
-// Haendler debuggen
-//define('DEBUG_MERCHANT', true);
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Set the new handler
-//set_exception_handler('shipsimu_exception_handler');
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class BirthdayInvalidException extends FrameworkException {
- public function __construct ($birthArray, $code) {
- // Cast the array
- $birthArray = (array) $birthArray;
-
- // Add a message around the missing class
- $message = sprintf("Das Geburtsdatum <u>%s</u> 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]
-?>
+++ /dev/null
-<?php
-
-// Unsere eigene Exception!
-class CabinShipMismatchException extends FrameworkException {
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class ContractAllreadySignedException extends FrameworkException {
- public function __construct ($classArray, $code) {
- // Cast the array
- $classArray = (array) $classArray;
-
- // Add a message around the missing class
- $message = sprintf("[%s:] Die Vertragsparteien <u>%s</u> und <u>%s</u> haben den Vertrag bereits unterzeichnet!",
- $classArray[0]->__toString(),
- $classArray[1]->getCompanyName(),
- $classArray[2]->getCompanyName()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class ContractPartnerMismatchException extends FrameworkException {
- public function __construct ($classArray, $code) {
- // Cast the array
- $classArray = (array) $classArray;
-
- // Add a message around the missing class
- $message = sprintf("[%s:] Der Vertragspartner von <u>%s</u> ist ungütig (<u>%s</u>) und darf diesen Vertrag nicht unterzeichnen!",
- $classArray[0]->__toString(),
- $classArray[1]->getCompanyName(),
- $classArray[2]->getCompanyName()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Unsere eigene Exception!
-class DeckShipMismatchException extends FrameworkException {
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class EmptyStructuresListException extends FrameworkException {
- public function __construct ($class, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:] Die Strukturen-Liste ist leer.",
- $class->__toString()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class InvalidContractPartnerException extends FrameworkException {
- public function __construct ($class, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:] <u>%s</u> ist kein gütiger Vertragspartner.",
- $class->__toString(),
- $class->getPartDescr()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class InvalidIDFormatException extends FrameworkException {
- public function __construct ($class, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:] Ungültige ID-Nummer übergeben.",
- $class->__toString()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class ItemNotInPriceListException extends FrameworkException {
- public function __construct ($class, $code) {
- // Add a message around the missing class
- $message = sprintf("[Merchant:] Preis für den Artikel <u>%s</u> <em><u>%s</u></em> nicht gefunden.",
- $class->__toString(),
- $class->getPartDescr()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class ItemNotTradeableException extends FrameworkException {
- public function __construct ($classArray, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:] <u>%s</u> ist nicht handelbar!",
- $classArray[0]->__toString(),
- $classArray[1]->getPartDescr()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class MissingSimulatorIDException extends FrameworkException {
- public function __construct ($classArray, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:] Die Simulator-ID <u>%s</u> scheint ungültig zu sein.",
- $classArray[0]->__toString(),
- $classArray[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Unsere eigene Exception!
-class MotorShipMismatchException extends FrameworkException {
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Unsere eigene Exception!
-class NoShipyardsConstructedException extends FrameworkException {
- public function __construct ($class, $code) {
- if (is_object($class)) {
- // Add a message around the missing class
- $message = sprintf("[%s:] Keine Werften gefunden!",
- $class->__toString()
- );
- } else {
- // No class given
- $message = sprintf("Please provide a class for <u>%s</u>", __CLASS__);
- }
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// A crew list has already been initialized
-class PersonellListAlreadyCreatedException extends FrameworkException {
- public function __construct ($class, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:] Die interne Crew-Liste wurde bereits initialisiert.",
- $class->__toString()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Unsere eigene Exception!
-class RoomShipMismatchException extends FrameworkException {
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Unsere eigene Exception!
-class ShipNotConstructedException extends FrameworkException {
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class ShipPartNotConstructableException extends FrameworkException {
- public function __construct (array $partArray, $code) {
- // Add a message around the missing class
- $message = sprintf("Schiffteil <u>%s</u> ist nicht constrierbar!",
- $partArray[0]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Unsere eigene Exception!
-class StructureShipMismatchException extends FrameworkException {
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class StructuresOutOfBoundsException extends FrameworkException {
- public function __construct ($idx, $code) {
- // Add a message around the missing class
- $message = sprintf("Der Index <u>%s</u> liegt ausserhalb des gütigen Bereiches! Schiffsteil nicht auffindbar.", $idx);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class ToMuchEmployeesException extends FrameworkException {
- public function __construct ($amountArray, $code) {
- // Cast the array
- $amountArray = (array) $amountArray;
-
- // Add a message around the missing class
- $message = sprintf("<u>%d</u> Leute nicht einstellbar, da nur <u>%d</u> arbeitslos sind!",
- $amountArray[0],
- $amountArray[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class TotalPriceNotCalculatedException extends FrameworkException {
- public function __construct ($class, $code) {
- // Add a message around the missing class
- $message = sprintf("[%s:] Gesamtpreis ist nicht ermittelbar.",
- $class->__toString()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class UnsupportedLimitationPartException extends FrameworkException {
- public function __construct ($str, $code) {
- // Add a message around the missing class
- $message = sprintf("Limitierungsinformation <u>%s</u> wird derzeit nicht unterstützt.", $str);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// An exception class for lost classes... ;-)
-class WrongGenderSpecifiedException extends FrameworkException {
- public function __construct ($gender, $code) {
- // Add a message around the missing class
- $message = sprintf("Das Geschlecht <u>%s</u> Ist nicht <em>M</em> (Männlich) oder <em>F</em> (Weiblich).", $gender);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Application initializer
-//
-// Please remember that this include file is being loaded *before* the class
-// loader is loading classes from "exceptions", "interfaces" and "main"!
-//
-// You can prevent adding this application to the selector by uncommenting the
-// following line:
-//
-// if ((isset($this)) && (is_object($this)) && ($this->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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for constructable ships
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @version 0.1
- */
-interface ConstructableShip extends FrameworkInterface {
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An interface for constructable ship parts
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @version 0.1
- */
-interface ConstructableShipPart extends FrameworkInterface {
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An interface for contract partners
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @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]
-?>
+++ /dev/null
-<?php
-/**
- * An interface for all customers
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @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]
-?>
+++ /dev/null
-<?php
-/**
- * An interface for tradeable items
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @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]
-?>
+++ /dev/null
-<?php
-/**
- * An interface for all personells
- *
- * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
- * @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]
-?>
+++ /dev/null
-<?php
-// The application's class loader
-if (!isset($application)) {
- // We need this!
- ApplicationEntryPoint::app_die("[Main:] Interne Variable <strong>application</strong> 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 <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
- $class,
- $e->getMessage()
- ));
- } catch (PathIsEmptyException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
- $class,
- $e->getMessage()
- ));
- } catch (PathReadProtectedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
- $class,
- $e->getMessage()
- ));
- } catch (DirPointerNotOpenedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
- $class,
- $e->getMessage()
- ));
- }
-}
-
-// Include all classes
-ClassLoader::getInstance()->includeAllClasses();
-
-// Clean up the global namespace
-unset($lowerClasses);
-unset($class);
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- die("limitObject() reached! Stub!");
- }
+++ /dev/null
-<?php
-// What every kind of personell have
-class BasePersonell extends BaseFrameworkSystem implements Personellizer {
- // Maximum/minimum age
- private $MIN_AGE = 21;
- private $MAX_AGE = 40;
-
- // Male/female
- private $gender = ""; // M=Male, F=Female, empty=uninitialized
-
- // Year/month/day of birth
- private $yearBirth = 0;
- private $monthBirth = 0;
- private $dayBirth = 0;
-
- // Surname/family name
- private $surname = "";
- private $family = "";
-
- // Employed?
- private $employed = false;
-
- // Married?
- private $married = false;
-
- // Her/his salary
- private $salary = 0.00;
-
- // Constructor
- private function __construct ($class) {
- // Call parent constructor
- parent::constructor($class);
-
- // Debug message
- if ((defined('DEBUG_PERSONELL')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[PersonellBase:] Konstruktor erreicht.<br />\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.<br />\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]
-?>
+++ /dev/null
-<?php
-
-// Ein sehr abstraktes Objekt, Abmasse, Beschreibung und Teil-Instanz werden hier gespeichert
-class BaseSimulator extends BaseFrameworkSystem {
- // Schiffsteilinstanz
- private $partInstance = null;
-
- // Abmasse (Breite/Hoehe/Laenge)
- private $width = 0;
- private $height = 0;
- private $length = 0;
-
- // Aktuelles Schiff und Schiffsteil
- private $currShip = null;
- private $currPart = null;
-
- // Faktoren zur Erweiterung der Masse. Beispielsweise soll der Maschinenraum groesser wie der Motor sein
- private $resizeFactorArray = array(
- 'width' => 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.<br />\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 <strong>%s</strong> in class.<br />\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 <strong>%s</strong> from class.<br />\n",
- $this->__toString(), $var
- ));
- unset($this->$var);
- }
-
- // Setter-Methode fuer Laenge
- public function setLength ($length) {
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] <strong>%dm</strong> Länge gesetzt.<br />\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:] <strong>%dm</strong> Breite gesetzt.<br />\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:] <strong>%dm</strong> Höhe gesetzt.<br />\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.<br />\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.<br />\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.<br />\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.<br />\n",
- $this->__toString()
- ));
- } else {
- // Leere Instanz kann entfernt werden
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] partInstance wurde entfernt.<br />\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 <strong>%s</strong> wird fuer das Schiff <strong>%s</strong> konstruiert.<br />\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 <strong>%s</strong> vom Typ <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.<br />\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 <strong>%s</strong> passt in das Schiff <strong>%s</strong> hinein.<br />\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 <strong>%s</strong> vom Typ <strong>%s</strong> 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 <strong>%s</strong> gefunden.<br />\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 <u>%s</u> vom Typ <u>%s</u> 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.<br />\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.<br />\n",
- $this->__toString()
- ));
- unset($this->currShip);
- }
-
- // Aktuelle Schiff-Instanz entfernen
- public function removeCurrPart () {
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] removeCurrPart erreicht.<br />\n",
- $this->__toString()
- ));
- unset($this->currPart);
- }
-
- // Breite entfernen
- public function removeWidth () {
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Breite entfernt.<br />\n",
- $this->__toString()
- ));
- unset($this->width);
- }
-
- // Hoehe entfernen
- public function removeHeight () {
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Höhe entfernt.<br />\n",
- $this->__toString()
- ));
- unset($this->height);
- }
-
- // Laenge entfernen
- public function removeLength () {
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Länge entfernt.<br />\n",
- $this->__toString()
- ));
- unset($this->length);
- }
-
- // Tiefgang entfernen
- public function removeDraught () {
- if (defined('DEBUG_CORE')) $this->getDebugInstance()->output(sprintf("[%s:] Tiefgang entfernt.<br />\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)<br />\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 <strong>%s</strong>=<strong>%s</strong> gesetzt.<br />\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.<br />\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.<br />\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 <strong>%s</strong>.<br />\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]
-?>
+++ /dev/null
-<?php
-
-// Die Haendler-Klasse
-class Merchant extends BaseFrameworkSystem {
- // Name des Haendlers
- private $merchantName = "Namenloser Händler";
-
- // Preislite (Objekte wiedermal!)
- private $priceList = null;
-
- // Zugewiesener Hafen
- private $harborInstance = null;
-
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_MERCHANT')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird angelegt und soll sich am <strong>%s</strong> niederlassen.<br />\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 <strong>%s</strong> erhält eine leere Preisliste.<br />\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 <strong>%s</strong> ist nun bekannt.<br />\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 <strong>%s</strong> wird verlangt.<br />\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 <strong>%s</strong> lässt sich am <strong>%s</strong> nieder.<br />\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 <strong>%s</strong> hat sich am <strong>%s</strong> niedergelassen.<br />\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 <strong>%s</strong> kann nun das Schiffsteil <strong>%s</strong> "<strong>%s</strong>" zu <strong>%s</strong> verkaufen.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-
-// Bauvertrag-Klasse
-class WorksContract extends BaseFrameworkSystem {
- // Zukuenftiger Schiffsname
- private $shipName = "";
-
- // Instanz zum Schiffstypen
- private $shipInstance = null;
-
- // Contract partner
- private $contractPartner = null;
-
- // Other contract partner
- private $contractParty = null;
-
- // Is the contract signed?
- private $signed = false;
-
- // Merchant instance
- private $merchantInstance = null;
-
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.<br />\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: <pre><em>%s</em></pre><br />\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 <strong>%s</strong> wird in den Bauvertrag aufgenommen.<br />\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 <strong>%s</strong> heissen.<br />\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 <strong>%s</strong> angefordert.<br />\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.<br />\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 <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> in den Bauvertrag aufgenommen.<br />\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 <strong>%s</strong> konnte nicht vervollständigt werden. Grund: <strong>%s</strong><br />\\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: <pre><em>%s</em></pre><br />\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.<br />\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 <strong>%s</strong> 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] <strong>%s</strong> kostet <strong>%s</strong>.<br />\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] <strong>%s</strong> wurde in den Bauvertrag aufgenommen.<br />\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 <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> zu.<br />\n",
- __CLASS__,
- __LINE__,
- $partnerInstance->getPartDescr(),
- $partnerInstance->getCompanyName(),
- $this->getShipInstance()->getPartDescr(),
- $this->getShipInstance()->getShipName()
- ));
- } else {
- // Other contract party
- $this->getDebugInstance()->output(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> ein.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Die Reederei-Klasse
-class ShippingCompany extends BaseSimulator implements Customer, ContractPartner {
- // Firmenname
- private $companyName = "Namenlose Reederei";
-
- // Firmenkuerzel
- private $shortName = "";
-
- // Reederei-Gruender
- private $founderInstance = null;
-
- // Angestellten-Liste
- private $employeeList = null;
-
- // Zugewiesener Hafen
- private $hqInstance = null;
-
- // Werftenliste
- private $shipyardList = null;
-
- // Der Reederei gehoerenden Schiffe
- private $ownedShips = null;
-
- // Bauauftraege als Kunde
- private $contractList = null;
-
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird gegründet.<br />\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 <strong>%s</strong> erhält eine Angestelltenliste.<br />\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 <strong>%s</strong> erhält eine Werftsliste.<br />\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 <strong>%s</strong> erhält eine Auftragsliste.<br />\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 <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.<br />\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 <strong>%s</strong> ist von <strong>%s %s</strong> gegründet worden.<br />\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] <strong>%s %s</strong> tritt der Reederei <strong>%s</strong> als <strong>%s</strong> bei und erhält ein Gehalt von <strong>%s</strong>.<br />\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 <strong>%s</strong> erhält die Werft <strong>%s</strong> hinzugefügt.<br />\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 <strong>%s</strong> stellt per Zufall <strong>%d</strong> neue Mitarbeiter ein.<br />\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 <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> ein.<br />\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 <strong>%s</strong> hat per Zufall <strong>%d</strong> neue Mitarbeiter eingestellt.<br />\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 <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> Werft(en).<br />\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 <strong>%s</strong> hat <strong>%d</strong> Mitarbeiter.<br />\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 <strong>%s</strong> werden die Anzahl der Werften in allen Häfen ermittelt.<br />\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 <strong>%s</strong> hat <strong>%d</strong> Werft(en).<br />\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 <strong>%s</strong> baut in allen Werften bald Schiffe vom Typ <strong>%s</strong>.<br />\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 <strong>%s</strong> prüft den Bauauftrag der <strong>%s</strong>.<br />\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 <strong>%s</strong> prüft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.<br />\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 <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> bauen können.<br />\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 <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.<br />\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 <strong>%s</strong> erstellt einen Bauauftrag für ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.<br />\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:<pre>".print_r($contractInstance, true)."</pre>");
- }
-
- // 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 <strong>%s</strong> erteilt an sich selbst einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>".<br />\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 <strong>%s</strong> unterzeichnet einen Bauauftrag für das <strong>%s</strong> "<strong>%s</strong>" mit der <strong>%s</strong>.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-// Die Liegeplatz-Klasse
-class Berth extends BaseConstruction {
- // Durchlaufende Nummer der Liegeplaetze
- private $berthIndex = 0;
-
- // Zugewiesener Hafen
- private $harborInstance = null;
-
- // Konstruktor
- private function __construct () {
- if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Die abstrakte Bauten-Klasse
-class BaseConstruction extends BaseSimulator {
- // Tiefgang fuer z.B. Trockdocks
- private $draught = 0;
-
- // Konstruktor
- private function __construct ($class) {
- // Eltern-Konstrutor aufrufen
- parent::constructor($class);
-
- // Debug message
- if ((defined('DEBUG_CORE')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\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.<br />\n",
- $this->__toString()
- ));
- unset($this->draught);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Die Werft-Klasse
-class DryDock extends BaseConstruction {
- // Zugewiesener Hafen
- private $harborInstance = null;
-
- // Konstruktor
- private function __construct () {
- if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[DryDock:] Konstruktor erreicht.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Die Hafen-Klasse
-class Harbor extends BaseConstruction {
- // Namen des Hafens (z.B. Hamburger Hafen)
- private $harborName = "Unbekannter Hafen";
-
- // Schiffsliste aller gebauten Schiffe
- private $constructedShips = null;
-
- // Liegeplatz-Liste
- private $berthList = null;
-
- // List of all assigned shipyards
- private $shipyardList = null;
-
- // Constructor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_HARBOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[Harbor:] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird konstruiert.<br />\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 <strong>%s</strong> ist jetzt fertig gebaut.<br />\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 <strong>%s</strong> erstellt.<br />\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 <strong>%s</strong>.<br />\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 <strong>%s</strong> wurde angefordert.<br />\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 <strong>%s</strong> wird im Hafen <strong>%s</strong> gebaut.<br />\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 <strong>%s</strong> wird im Hafen <strong>%s</strong> gebaut.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Die Anlegebruecke-Klasse
-class Terminal extends BaseConstruction {
- // Zugewiesener Hafen
- private $harborInstance = null;
-
- // Konstruktor
- private function __construct () {
- if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Die Werft-Klasse
-class Shipyard extends BaseConstruction {
- // Werft-Name
- private $shipyardName = "Namenlose Werft";
-
- // Arbeiter-Liste
- private $staffList = null;
-
- // Queue-Liste fuer zu bauende Schiffe
- private $queueList = null;
-
- // Aktuell im Bau befindliches Schiff
- private $currShipInConst = null;
-
- // Liste konstruierbarer Schiffstypen
- private $shipTypeList = null;
-
- // Zugewiesener Hafen
- private $harborInstance = null;
-
- // Zugewiesene Reederei
- private $shippingCompany = null;
-
- // Constructor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_SHIPYARD')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird im Hafen <strong>%s</strong> konstruiert.<br />\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 <strong>%s</strong> wurde gebaut.<br />\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 <strong>%s</strong> erhält eine Arbeiterliste.<br />\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 <strong>%s</strong> erhält eine Typenliste.<br />\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: <pre>".print_r($this, true)."</pre>");
- }
-
- // 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 <strong>%s</strong> kann bald Schiffe vom Typ <strong>%s</strong> bauen.<br />\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 <strong>%s</strong> prüft, ob Schiffe vom Typ <strong>%s</strong> baubar sind.<br />\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 <strong>%s</strong> hat die Suche nach dem Schiffstyp <strong>%s</strong> abgeschlossen.<br />\n",
- __CLASS__,
- __LINE__,
- $this->getShipyardName(),
- $shipType
- ));
-
- // Return result
- return $result;
- }
-
- /**
- * Stub!
- */
- public function saveObjectToDatabase () {
- $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Die abstrakte Antrieb-Klasse
-class BaseDrive extends BaseSimulator {
- // Price of this drive
- private $price = 0.00;
- // PS-Zahl
- private $horsePower = 0;
- // Anzahl Nocken
- private $numCams = 0;
-
- // Konstruktor
- private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Debug message
- if (((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%d</strong> PS gesetzt.<br />\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 <strong>%d</strong> Nocken gesetzt.<br />\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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Motorisierter Antrieb
-class Motor extends BaseDrive implements ItemIsTradeable, ConstructableShipPart {
- // Constructor
- private function __construct() {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_DRIVE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird gebaut...<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Dieses kann z.B. der Maschinenraum, die Bruecke, Kabinen, Laderaum, etc. sein
-class BaseShipPart extends BaseSimulator {
- // Price of this ship part
- private $price = 0.00;
-
- // Konstruktor
- private function __construct($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Debug message
- if (((defined('DEBUG_SHIPPART')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d:] Kontruktor erreicht.<br />\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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-// Der Maschinenraum ist etwas anderes als eine Kabine, etc. !
-// Daher hat er eine eigene Klasse
-class MaschineRoom extends BaseShipPart {
- // Constructor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Die Schiffsbesatzung
-class SimulatorPersonell extends BasePersonell {
- // Personell list
- private $personellList = null;
-
- // A cache for lists
- private $cacheList = null;
-
- // A string for cached conditions
- private $cacheCond = null;
-
- /**
- * Private constructor
- *
- * @return void
- */
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- if (((defined('DEBUG_PERSONELL')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\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 <strong>%d</strong> Personal bereitgestellt.<br />\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] <strong>%d</strong> Personal bereitgestellt.<br />\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.<br />\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.<br />\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.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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: <pre><em>%s</em></pre><br />\n",
- __CLASS__,
- __LINE__,
- htmlentities($eval)
- ));
-
- // Run the command
- @eval($eval);
- }
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-// Die Schiffsbesatzung
-class CompanyEmployee extends SimulatorPersonell {
- // Employeee list
- private $employeeList = null;
-
- // Constructor
- private function __construct () {
- // Call parent constructor
- parent::constructor(__CLASS__);
-
- // Debug message
- if ((((defined('DEBUG_COMPANY_EMPLOYEE')) && (defined('DEBUG_PERSONELL'))) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s %s</strong> wird angelegt.<br />\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.<br />\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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-class BaseShip extends BaseSimulator {
- // Name des Shipes
- private $shipName = "Unbekanntes Schiff";
-
- // Anzahl Anker
- private $numAnchor = 0;
-
- // Tiefgang in Meter
- private $draught = 0;
-
- // Besatzung-Objekte
- private $crewList = null;
-
- // Aufbauten-Objekte
- private $structures = null;
-
- // Namenloses Ship generieren
- private function __construct($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Beim Schiff angelangt
- if (((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT')))
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> erhält ein neues Schiffsteil (%s).<br />\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: <pre><em>%s</em></pre><br />\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 <strong>%s</strong> hat keinen Motor erhalten! Grund: <strong>%s</strong><br />\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 <strong>%s</strong> hat keinen Maschinenraum erhalten! Grund: <strong>%s</strong><br />\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 <strong>%s</strong> hat keine Aufbauten erhalten! Grund: <strong>%s</strong><br />\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 <strong>%s</strong> hat keine Kabine erhalten! Grund: <strong>%s</strong><br />\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 <strong>%s</strong> hat kein Deck erhalten! Grund: <strong>%s</strong><br />\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: <strong>%s</strong><br />\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: <strong>%s</strong><br />\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 <strong>%s</strong> hat das Schiffsteil <strong>%s</strong> eingebaut bekommen.<br />\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.<br />\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 <strong>%s</strong> wird auf den Namen <strong>%s</strong> getauft.<br />\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 <strong>%s</strong> ist auf den Namen <strong>%s</strong> getauft worden.<br />\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 <strong>%s</strong> mit dem Namen <strong>%s</strong> hat einen Tiefgang von <strong>%sm</strong>.<br />\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 <strong>%s</strong> wurde angefordert.<br />\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 <strong>%s</strong> mit dem Namen <strong>%s</strong> hat <strong>%s</strong> Anker.<br />\n",
- __CLASS__,
- __LINE__,
- $this->__toString(),
- $this->shipName,
- $numAnchor
- ));
- $this->numAnchor = (int) $numAnchor;
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-
-class PassengerShip extends BaseShip implements ConstructableShip {
- // Konstruktor
- private function __construct () {
- // Eltern-Kontruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\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 <strong>%d</strong> Betten vom Kabinen-Typ <strong>%s</strong> bereit.<br />\n",
- __CLASS__,
- __LINE__,
- $total,
- $cabType
- ));
- }
- } else {
- // Keine Kabine!
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> ist keine Kabine.<br />\n",
- __CLASS__,
- __LINE__,
- $el->getPartDescr()
- ));
- }
- }
-
- if ((defined('DEBUG_SHIP')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das <strong>%s</strong> mit dem Namen <strong>%s</strong> hat <strong>%d</strong> Betten.<br />\n",
- __CLASS__,
- __LINE__,
- $this->getPartDescr(),
- $this->getShipName(),
- $numBeds
- ));
-
- // Anzahl zurueckliefern
- return $numBeds;
- }
-
- /**
- * Stub!
- */
- public function saveObjectToDatabase () {
- $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-// Konstruktionen allgemein (also Aufbauten/Unterbauten)
-class BaseStructure extends BaseSimulator {
- // Price of this structure
- private $price = 0.00;
-
- // Konstruktor (hier keine Exceptions aendern!)
- private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Debug message
- if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-// Kabinen allgemein
-class BaseCabin extends BaseCabinStructure {
- // Konstruktor
- private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Debug message
- if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-// Economy-Class-Kabinen
-class EconomyCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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]
-?>
+++ /dev/null
-<?php
-// 2-Sterne-Kabinen
-class LowCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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]
-?>
+++ /dev/null
-<?php
-// Luxuskabinen
-class LuxuryCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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]
-?>
+++ /dev/null
-<?php
-// Premier-Kabinen
-class PremierCabin extends BaseCabin implements ItemIsTradeable, ConstructableShipPart {
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_CABIN')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[PremierCabin:] Konstruktor erreicht.<br />\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...<br />\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.<br />\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.<br />\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.<br />\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]
-?>
+++ /dev/null
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- die("limitObject() reached! Stub!");
- }
+++ /dev/null
-<?php
-// Kabinen allgemein
-class BaseCabinStructure extends BaseStructure {
- // --- Besondere Eigenschaften dazufuegen: ---
- // Anzahl der Kabinen im Schiff
- private $numCabin = 0;
-
- // Anzahl Raeume pro Kabine (kann auch nur 1 sein)
- private $numRooms = 0;
-
- // Anzahl Betten, verallgemeinert
- private $numBeds = 0;
-
- // Konstruktor
- private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Debug message
- if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.<br />\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 <strong>%s</strong> wurde in das Schiff eingebaut.<br />\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.<br />\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] <strong>%d</strong> Betten angefordert.<br />\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] <strong>%d</strong> Kabine(n) angefordert.<br />\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] <strong>%d</strong> Betten gesetzt.<br />\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] <strong>%d</strong> Raum/Räume gesetzt.<br />\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] <strong>%d</strong> Kabine(n) gesetzt.<br />\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.<br />\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.<br />\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.<br />\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 <strong>%d</strong> Kabinen vom Typ <strong>%s</strong> zu je <strong>%d</strong> Betten. Das sind <strong>%d</strong> Betten.<br />\n",
- __CLASS__,
- __LINE__,
- $num,
- $cabType,
- $beds,
- $cabinBeds
- ));
- }
- return $cabinBeds;
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Decks (fuer Cargo) allgemein
-class BaseDeckStructure extends BaseStructure {
- // Anzahl Decks
- private $numDecks = 0;
-
- // Konstruktor
- private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Debug message
- if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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 <strong>%s</strong> wird für das Schiff <strong>%s</strong> konstruiert.<br />\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 <strong>%s</strong> wurde in das Schiff <strong>%s</strong> eingebaut.<br />\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.<br />\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]
-?>
+++ /dev/null
-<?php
-// Super structures (renamed to UpperStructure to avoid mixing it with super classes
-class BaseUpperStructure extends BaseStructure {
- /**
- * Constructor for all super structures on a ship
- */
- private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Debug message
- if (((defined('DEBUG_STRUCTURE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) {
- $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\n",
- __CLASS__,
- __LINE__
- ));
- }
-
- // Unique-ID setzen
- $upperInstance->createUniqueID();
-
- // Return instance
- return $upperInstance;
- }
-
- /**
- * Stub!
- */
- public function saveObjectToDatabase () {
- $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-// Auto-Deck
-class CarDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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]
-?>
+++ /dev/null
-<?php
-// Decks fuer LKWs
-class TrainDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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]
-?>
+++ /dev/null
-<?php
-// Decks fuer LKWs
-class TruckDeck extends BaseDeck implements ItemIsTradeable, ConstructableShipPart {
- // Konstruktor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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.<br />\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]
-?>
+++ /dev/null
-<?php
-// Decks for cargo
-class BaseDeck extends BaseDeckStructure {
- /**
- * Constructor for cargo decks in general
- */
- private function __construct ($class) {
- // Eltern-Konstruktor aufrufen
- parent::constructor($class);
-
- // Debub message
- if (((defined('DEBUG_DECK')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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.<br />\n",
- __CLASS__,
- __LINE__
- ));
-
- // Unique-ID setzen
- $deckInstance->createUniqueID();
-
- // Instanz zurueckgeben
- return $deckInstance;
- }
-
- /**
- * Stub!
- */
- public function saveObjectToDatabase () {
- $this->getDebugInstance()->output(sprintf("[%s:] Stub <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-// Die Aufbauten allgemein
-class Bridge extends BaseUpperStructure implements ItemIsTradeable, ConstructableShipPart {
- // Constructor
- private function __construct () {
- // Eltern-Konstruktor aufrufen
- parent::constructor(__CLASS__);
-
- // Debug message
- if (((defined('DEBUG_MODE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Konstruktor erreicht.<br />\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...<br />\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 <strong>%s</strong> erreicht.",
- $this->__toString(),
- __FUNCTION__
- ));
- }
-
- /**
- * Limits this object with an ObjectLimits instance
- */
- public function limitObject (ObjectLimits $limitInstance) {
- ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!");
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-// Is there an application helper instance? We need the method main() for
-// maining the application
-$app = ApplicationHelper::getInstance();
-
-// Some sanity checks
-if ((empty($app)) || (is_null($app))) {
- // Something went wrong!
- ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden, da die Hilfsklasse <strong>%s</strong> nicht geladen ist!",
- $application,
- FrameworkConfiguration::getInstance()->readConfig("app_helper_class")
- ));
-} elseif (!is_object($app)) {
- // No object!
- ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> 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 <strong>%s</strong> kann nicht gestartet werden, da die Methode <strong>%s</strong> 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 <strong>%s</strong> kann nicht gestartet werden. Grund: <u>%s</u>",
- $application,
- $e->getMessage()
- ));
-}
-
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<div class="selector_content">
- <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
- 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!
- </div>
-
- <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
- Oder fangen Sie als Matrose auf einem Passagierschiff (virtuell) an zu
- arbeiten und werden Sie nach wenigen Kreuzfahrten bald Kapitän!
- </div>
-
- <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
- Oder buchen Sie eine virtuelle Kreuzfahrt durch die bekannten Meeren in
- {!POINTS!} in einer Luxus-Suite!
- </div>
-</div>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A dummy class for debugging
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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);
-
-//
-?>
+++ /dev/null
-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
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * Load framework classes first
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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 <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
- $class
- ));
- } catch (PathIsEmptyException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
- $class
- ));
- } catch (PathReadProtectedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
- $class
- ));
- } catch (DirPointerNotOpenedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
- $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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A general abstract exception. You should not throw this even when you
- * remove the "abstract" key-word. Better you make your own exception and
- * attach a dedicated message to it.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An exception thrown when compressors are mismatching
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> zu den geladenen Daten aus <u>%s</u> und der aktuell verwendete Kompressor <u>%s</u> 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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An exception thrown when a container item is not an array
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a container item is null
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <em>null</em> gesetzt.",
- $class->__toString(),
- $this->getLine()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the container is possibly damaged
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An exception thrown when the save path string is empty
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the save path is no directory
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> ist ungütig (kein Pfad).", $path);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the save path is read-protected
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the save path is write-protected
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An exception thrown when a directory pointer is not opended
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> konnte kein Pointer initialisiert werden.", $path);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a file pointer is not opened
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> konnte kein Pointer initialisiert werden. Möglicherweise ist die Datei nicht lesbar oder fehlt!", $path);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the length of the data mismatch
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> Byte ist aufgetreten. <u>%s</u> wurden erwartet!",
- $array[0]->__toString(),
- $this->getLine(),
- $array[1],
- $array[2]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the returned directory resource is invalid
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a MD5 checksum does not exception
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> und <u>%s</u> stimmen nicht überein!",
- $array[0]->__toString(),
- $this->getLine(),
- $array[1],
- $array[2]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the path string is empty
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a given path is not a directory
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> ist ungütig (kein Pfad).", $path);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a path is read-protected
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An exception thrown when the language path string is invalid
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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] <u>%s</u> ist keine Zeichenkette!",
- $class[0]->__toString(),
- $this->getLine(),
- $class[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the language path string is empty
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the language path is no directory
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> existiert nicht oder ist eine Datei!",
- $class[0]->__toString(),
- $this->getLine(),
- $class[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the language path is read-protected
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
- $class[0]->__toString(),
- $this->getLine(),
- $class[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An exception thrown when two classes are not matching
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> ist ungleich <u>%s</u>.",
- $classArray[0],
- $classArray[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a class was not found
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> konnte nicht gefunden werden!", $class);
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a configuration entry is empty
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a configuration entry is not found
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> nicht gefunden.",
- $classArray[0],
- $this->getLine(),
- $classArray[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thron when dimension entries are not found in an array
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u>", __CLASS__);
- }
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when an exception was not changed
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when an other exception was not found
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> nicht gefunden.",
- $classArray[0],
- $this->getLine(),
- $classArray[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a getter for an attribute was not found
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> nicht gefunden.",
- $dataArray[0]->__toString(),
- $this->getLine(),
- $dataArray[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the number of array elements mismatch
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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] <u>%s</u> hat <u>%d</u> Elemente, soll aber <u>%d</u> enthalten!",
- $array[0]->__toString(),
- $this->getLine(),
- $array[1],
- $array[2],
- $array[3]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when an instance variable instances a non-object
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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: <u>%s</u>)",
- $class->__toString(),
- $this->getLine(),
- $class->getPartDescr()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when required array elements are missing
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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("</u>, <u>", $classArray[2]);
- } else {
- // Invalid data
- $elements = "invalid_data";
- }
-
- // Add a message around the missing class
- $message = sprintf("[%s:%d] Das Array <u>%s()</u> keine Elemente <u>%s</u> auf!",
- $classArray[0]->__toString(),
- $this->getLine(),
- $classArray[1],
- $elements
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the decimal and thousands seperators are missing
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a method is missing
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s()</u> auf!",
- $classArray[0]->__toString(),
- $this->getLine(),
- $classArray[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown then no array was created in a dynamic environment
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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] <u>%s</u> ist kein erstelltes Objekt.",
- $array[0]->__toString(),
- $this->getLine(),
- $array[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the variable holds no array
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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("<u>%s</u> ist kein Array!",
- $string
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * A deprecated exception which should be replaced with InvalidObjectException
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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("<u>%s</u> ist kein Objekt!",
- $string
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when an object instance is null
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <em>null</em> gesetzt.",
- $class->__toString(),
- $this->getLine()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a variable is not set
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> wurde keine Variable <u>%s</u> erzeugt.",
- $array[0]->__toString(),
- $this->getLine(),
- $array[1],
- $array[2]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An exception throws when the base path is empty
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the base path is no directory
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> existiert nicht oder ist eine Datei!",
- $class[0]->__toString(),
- $this->getLine(),
- $class[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when the base path is read-protected
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
- $class[0]->__toString(),
- $this->getLine(),
- $class[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception throws hen the base path string is invalid
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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] <u>%s</u> ist keine Zeichenkette!",
- $class[0]->__toString(),
- $this->getLine(),
- $class[1]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception thrown when a template variable name is invalid
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> gefundene Variable <u>%s</u> ist nicht gültig! Gültige Variablennamen sind nur <u>%s</strong>.",
- $class[0]->__toString(),
- $this->getLine(),
- basename($class[1]),
- $class[2],
- $class[3]->readConfig("tpl_valid_var")
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * An exception throws when the template type is not supported
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <u>%s</u> entspricht nicht dem erwartetem Template-Typ <u>%s</u>.",
- $class[0]->__toString(),
- $this->getLine(),
- $class[1],
- $class[2]
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for managing applications. This can be a lot. E.g.:
- *
- * - Un-/locking applications
- * - Creating selectors for the selector-mode
- * - Usage statistics
- * - And many more...
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * This is the top-level interface for all other interfaces and should contain
- * method stubs which is being used in every class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-interface FrameworkInterface {
-}
-
-//
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for compression classes
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * The general interface for all other database interfaces
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for front-end database classes. The classes should prepare the
- * objects for saving in the database. So for server-bases database classes SQL
- * queries shall be generated and send to the backend classes. In case of local
- * file databases the object shall be serialized and (maybe) transparently
- * compressed before they got saved to a local file.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for middleware database classes
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-interface DatabaseConnector extends FrameworkDatabaseInterface {
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for debugger classes
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-interface Debugger extends FrameworkInterface {
- /**
- * Outputs the given data
- *
- * @param $output Debug text for output
- * @return void
- */
- function outputStream ($output);
-}
-
-//
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * This is an inface for limiting object while saving them with the
- * DatabaseConnection class.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for streams
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-interface Streamable extends FrameworkInterface {
-}
-
-//
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for file input operations.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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);
-}
-
-//
-?>
+++ /dev/null
-<?php
-/**
- * An interface for file output operations.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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);
-}
-
-//
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for output streams
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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);
-}
-
-//
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for language systems
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-interface ManageableLanguage extends FrameworkInterface {
- /**
- * Initialize the array-object for all later language strings
- *
- * @return void
- */
- function initLanguageStrings();
-} // END - class
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An interface for template engines
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * The simulator system class is the super class of all other classes. This
- * class handles saving of games etc.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s</strong> wird zerstört.<br />\n",
- __CLASS__, $this->__toString()
- ));
- }
-
- // Destroy all informations about this class but keep some text about it alive
- $this->setPartDescr(sprintf("Entferntes Objekt <em>%s</em>", $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 <strong>%s</strong> wurde bereits zerstört.<br />\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: <pre><em>%s</em></pre><br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <strong>%s</strong> angefordert.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <strong>%s</strong> gesetzt.<br />\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.<br />\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.<br />\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.<br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <u>%s</u>.<br />\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.<br />\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 <u>%s</u>.<br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <strong>%s</strong>=<strong>%s</strong>?<br />\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:] <strong>%s</strong>=<strong>%s</strong>?<br />\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:] <strong>%d</strong> wird umformatiert.<br />\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.<br />\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 <u>%s</u> angefordert.<br />\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]
-?>
+++ /dev/null
-<?php
-/**
- * Class for saving arrays as an object. We need this little extension for
- * some common methods used in the whole application. Please see below if you
- * need more details.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * BZIP2 compression and decompression class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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.<br />\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.<br />\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 <strong>nicht</strong> gefunden.<br />\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.<br />\n",
- $this->__toString()
- ));
- return "bz2";
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * GZIP compression and decompression class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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.<br />\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.<br />\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 <strong>nicht</strong> gefunden.<br />\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.<br />\n",
- $this->__toString()
- ));
- return "gz";
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * Null compression and decompression class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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.<br />\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.<br />\n",
- $this->__toString()
- ));
- return "null";
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * This class contains static helper functions for console applications
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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: <strong>%s</strong><br />\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: <strong>%s</strong><br />\n",
- $helper->__toString(),
- $ip
- ));
- }
- } catch (FrameworkException $e) {
- // Do nothing here
- }
-
- // Return the IP address
- return $ip;
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An abstract database access class for handling database I/O requests
- *
- * @see DatabaseFrontendInterface An interface for database frontends (front-end to the application)
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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.<br />\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 <strong>%s</strong> angefordert.<br />\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 <strong>%s</strong> soll verwendet werden.<br />\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 <strong>%s</strong> wird verwendet und beinhaltet <strong>%s</strong> Einträge.<br />\n",
- $this->__toString(),
- $limitInstance->__toString(),
- $array->count()
- ));
- }
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * Database backend class for storing objects in locally created files.
- *
- * This class serializes objects and saves them to local files.
- *
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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.<br />\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 <strong>%s</strong> wird verwendet.<br />\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 <strong>%s</strong> soll in eine lokale Datei gespeichert werden.<br />\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 <strong>%s</strong> ist nach der Serialisierung <strong>%s</strong> Byte gross.<br />\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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A debug output class for the console (e.g. hub software)
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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!");
- }
-}
-
-//
-?>
+++ /dev/null
-<?php
-/**
- * A debug output class for PHP's error_log() command
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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);
- }
- }
-}
-
-//
-?>
+++ /dev/null
-<?php
-/**
- * A debug output class for the web browser
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * This object limits other objects. This is mostly being used to prepare
- * objects to the datatabase connection or else a lot heap would be saved.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * This class contains object attributes which we can now send together to
- * other classes
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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.<br />\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: <pre><em>%s</em></pre><br />\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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An universal class for file input/output streams.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A class for directory reading and getting its contents
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A class for reading files
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * A class for writing files
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * The language sub-system for handling language strings being used in the
- * application and whole framework
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * This class simply puts HTML code / JavaScript code or CSS code out to the
- * browser
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * This class simply puts HTML code / JavaScript code or CSS code out to the
- * browser
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * The own template engine for loading caching and sending out the web pages
- * and emails.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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 <strong>%s</strong> vom Typ <strong>%s</strong> wird geladen.<br />\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:] <strong>%s</strong> Byte Rohdaten geladen.<br />\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: <pre><em>%s</em></pre><br />\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 <strong>%s</strong> erkannt.",
- $this->__toString(),
- $this->getTemplateType()
- ));
- die();
- } else {
- // Put directly out
- // DO NOT REWRITE THIS TO app_die() !!!
- die(sprintf("[%s:] Unbekannter Template-Typ <strong>%s</strong> erkannt.",
- $this->__toString(),
- $this->getTemplateType()
- ));
- }
- break;
- }
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * An abstract middleware class for all other middlware classes
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * Middleware for selecting the right compressor channel
- *
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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: <pre><em>%s</em></pre><br />\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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * Database selector class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * The middlware debug output system. A *real* or concrete output class shall
- * become registered with this middleware because the back-fall class will
- * become deprecated soon.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * This is a file IO handler. It handles reading from and writing to files.
- * Missing paths in writing process will be automatically created.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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]
-?>
+++ /dev/null
-<?php
-/**
- * Base configuration, you should edit config-local.php (or create it) instead
- * of editing this configuration file.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A class for the configuration stuff implemented in a singleton design paddern
- *
- * NOTE: We cannot put this in inc/classes/ because it would be loaded (again)
- * in the class loader. See inc/loader/class_ClassLoader.php for instance
- *
- * @see ClassLoader
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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.<br />\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]
-?>
+++ /dev/null
-<?php
-/**
- * Initializes the database layer
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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!<br />
-E.g.:<pre>$GLOBALS['cfg']->defineDatabaseType("local");</pre>
-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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidDirectoryResourceException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (PathIsEmptyException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (PathIsNoDirectoryException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (PathReadProtectedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (DirPointerNotOpenedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Datenbankobjekt debuggen
-if (defined('DEBUG_DATABASE_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Die Datenbank-Schicht sieht wie folgt aus:<br />
-<pre>%s</pre>\n",
- print_r($db, true)
- ));
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * Initializes the local file database class
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-try {
- $layer = LocalFileDatabase::createLocalFileDatabase(PATH . "db/", FileIOHandler::getInstance());
-} catch (SavePathIsEmptyException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (SavePathNotFoundException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (SavePathIsNoDirectoryException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (SavePathReadProtectedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (SavePathWriteProtectedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * Initialize the file I/O handler. Currently there is no need to check if
- * the initialization was successfull or not because only some class
- * instances will we generated.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-$io = FileIOHandler::createFileIOHandler();
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * Loads more include files by using the generic class loader
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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]
-?>
+++ /dev/null
-<?php
-/**
- * Initializes the language system
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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: <strong>%s</strong>",
- $e->getMessage()
- ));
-} catch (InvalidLanguagePathStringException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
- $e->getMessage()
- ));
-} catch (LanguagePathIsNoDirectoryException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
- $e->getMessage()
- ));
-} catch (LanguagePathReadProtectedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
- $e->getMessage()
- ));
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * This class loads class include files with a specific prefix and suffix
- *
- * ----------------------------------
- * 1.1
- * - loadClasses rewritten to fix some notices
- * 1.0
- * - Initial release
- * ----------------------------------
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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:] <strong>%d</strong> Klassendateien in <strong>%d</strong> Verzeichnissen gefunden und geladen.<br />\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]
-?>
+++ /dev/null
-<?php
-/**
- * Initializes the output middleware layer
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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]
-?>
+++ /dev/null
-<?php
-/**
- * The application selector main include file
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-
-// 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]
-?>
+++ /dev/null
-<?php
-/**
- * The main class with the entry point to the whole application. This class
- * "emulates" Java(tm)'s entry point call. Additionally it covers local
- * variables from outside access to prevent possible attacks on uninitialized
- * local variables.
- *
- * But good little boys and girls would always initialize their variables... ;-)
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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: <strong>%s</strong>",
- $e->getMessage()
- ));
- } catch (InvalidBasePathStringException $e) {
- die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
- $e->getMessage()
- ));
- } catch (BasePathIsNoDirectoryException $e) {
- die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
- $e->getMessage()
- ));
- } catch (BasePathReadProtectedException $e) {
- die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
- $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: <strong>%s</strong>",
- $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]
-?>
+++ /dev/null
-#!/bin/sh
-
-echo "$0: Cleaning up..."
-find docs/html/ -type f -exec rm -f {} \;
-rm -f docs/*.log
-echo "$0: Done."
-
-doxygen Doxyfile
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-Deny from all
+++ /dev/null
-<!-- A compileable template for emergency messages //-->
-
-{?header:title="Problem in application framework detected!"?}
-
-{?navigation:nav_row=home;imprint;contact?}
-
- <div class="emergency_exit message_box">
- $content[message]
- </div>
-
-{?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."?}
+++ /dev/null
- <div class="footer_message message_box">
- $content[footer_msg]
- </div>
-
-</div> <!-- masterbox //-->
-
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
-<head>
- <title>
- $content[title]
- </title>
-
- <meta name="author" content="$config[meta_author]" />
- <meta name="publisher" content="$config[meta_publisher]" />
- <meta name="keywords" content="$config[meta_keywords]" />
- <meta name="robots" content="index,follow" />
- <meta name="description" content="$config[meta_description]" />
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <meta http-equiv="content-style-type" content="text/css" />
- <meta http-equiv="content-script-type" content="text/javascript" />
- <meta http-equiv="language" content="de" />
-</head>
-
-<body>
-<div class="masterbox">
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-define('TEST', true);
-// Change directory
-@chdir("..");
-
-// Load config file
-require(dirname(dirname(__FILE__)) . "/inc/config.php");
-
-// Load all include files
-require(PATH . "inc/includes.php");
-
-// Load all game classes
-require(PATH . "inc/classes.php");
-
-// Load more include files
-$_GET['app'] = "ship-simu";
-require_once(PATH . "inc/selector.php");
-
-// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
-// jetzt die Personalliste wiederherstellen
-try {
- $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
-} catch (InvalidIDFormatException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FileIsEmptyException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FilePointerNotOpenedException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidMD5ChecksumException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidDataLengthException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidSimulatorIDException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MismatchingCompressorsException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNullException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNoArrayException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerMaybeDamagedException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
-<pre>%s</pre>\n",
- print_r($personell, true)
- ));
-}
-
-// Hafen bauen
-$harbor = Harbor::createHarbor("Hamburger Hafen");
-
-// Name ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Der <strong>%s</strong> ist gegründet worden.<br />\n",
- $harbor->getHarborName()
-));
-
-// Hafen-Objekt debuggen
-if (defined('DEBUG_HARBOR_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Der <strong>%s</strong> sieht wie folgt aus:<br />
-<pre>%s</pre>\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 <strong>%d</strong> in array <strong>%s</strong> found: <u>%s</u>", $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 <strong>%d</strong>: <u>%s</u>", $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: <pre><em>%s</em></pre><br />\n",
- htmlentities($eval)
- ));
-
- // Run the constructed command
- eval($eval);
- } catch (ItemNotTradeableException $e) {
- die(sprintf("[Main:] Die Preisliste des Händlers <strong>%s</strong> kann nicht befüllt werden. Grund: <strong>%s</strong><br />\n",
- $merchant->getMerchantName(),
- $e->getMessage()
- ));
- }
-}
-
-// Haendler-Objekt debuggen
-if (defined('DEBUG_MERCHANT_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Der Händler <strong>%s</strong> sieht wie folgt aus:<br />
-<pre>%s</pre>\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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Dann mal ausgeben...
-DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> ist von <strong>%s %s</strong> gegründet worden.<br />\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 <strong>%s</strong> konnte kein Personal einstellen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (OutOfBoundsException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal einstellen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Anzahl Personal ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat nun <strong>%d</strong> weitere Mitarbeiter.<br />\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 <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (ClassMismatchException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Personal auf die Werften verteilen
-try {
- $shipping->distributeAllPersonellOnShipyards();
-} catch (NoShipyardsConstructedException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (ClassMismatchException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Normale Meldung ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> beschäftigt nun ihre <strong>%d</strong> Mitarbeiter in <strong>%d</strong> Werft(en):<br />\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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (EmptyStructuresListException $e) {
- die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\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 <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\n",
- $merchant->getMerchantName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Der Händler <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\n",
- $merchant->getMerchantName(),
- $e->getMessage()
- ));
-} catch (ClassMismatchException $e) {
- die(sprintf("[Main:] Der Händler <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\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 <strong>%s</strong> konnte den Bauauftrag nicht validieren. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht validieren. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Kann gebaut werden?
-if ($typeValid) {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> kann Schiffe vom Typ <strong>%s</strong> bauen.<br />\n",
- $shipping->getCompanyName(),
- $contract->getShipInstance()->getPartDescr()
- ));
-} else {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> kann keine Schiffe vom Typ <strong>%s</strong> bauen!<br />\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 <strong>%s</strong> konnte nicht in der Preisliste gefunden werden. Grund: <strong>%s</strong><br />\n",
- $key,
- $e->getMessage()
- ));
- } catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Der Artikel <strong>%s</strong> konnte nicht in der Preisliste gefunden werden. Grund: <strong>%s</strong><br />\n",
- $key,
- $e->getMessage()
- ));
- }
-}
-
-// Reederei-Objekt ausgeben
-if (defined('DEBUG_COMPANY_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> sieht wie folgt aus:<br />
-<pre>%s</pre>\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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (EmptyStructuresListException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (TotalPriceNotCalculatedException $e) {
- die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Wert ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Der Bau der <strong>%s</strong> wird der Reederei <strong>%s</strong> voraussichtlich <strong>%s</strong> kosten.<br />\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 <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (InvalidContractPartnerException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (ContractAllreadySignedException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-} catch (WrongContractPartnerException $e) {
- die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
- $shipping->getCompanyName(),
- $e->getMessage()
- ));
-}
-
-// Meldung ausgeben
-if ($contract->isSigned()) {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat den Bau der <strong>%s</strong> zugestimmt.<br />\n",
- $shipping->getCompanyName(),
- $contract->getShipInstance()->getShipName()
- ));
-} else {
- DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat den Bau der <strong>%s</strong> abgelehnt.<br />\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:<br />
-<pre>%s</pre>\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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (EmptyStructuresListException $e) {
- die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Bettenanzahl ausgeben
-DebugMiddleware::getInstance()->output(sprintf("Es stehen <strong>%d</strong> Betten zur Verfügung.",
- $totalBeds
-));
-
-//
-?>
+++ /dev/null
-<?php
-define('TEST', true);
-// Change directory
-@chdir("..");
-
-// Load config file
-require(dirname(dirname(__FILE__)) . "/inc/config.php");
-
-// Load all include files
-require(PATH . "inc/includes.php");
-
-// Load all game classes
-require(PATH . "inc/classes.php");
-
-// Load more include files
-$_GET['app'] = "ship-simu";
-require_once(PATH . "inc/selector.php");
-
-// jetzt die Personalliste wiederherstellen
-try {
- $test = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
-} catch (InvalidIDFormatException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FileIsEmptyException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FilePointerNotOpenedException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidMD5ChecksumException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidDataLengthException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidSimulatorIDException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MismatchingCompressorsException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNullException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNoArrayException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerMaybeDamagedException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
-<pre>%s</pre>\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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
-<pre>%s</pre>\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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidObjectException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (UnsupportedLimitationPartException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (GetterNotFoundException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoArrayCreatedException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-//
-?>
+++ /dev/null
-<?php
-define('TEST', true);
-// Change directory
-@chdir("..");
-
-// Load config file
-require(dirname(dirname(__FILE__)) . "/inc/config.php");
-
-// Load all include files
-require(PATH . "inc/includes.php");
-
-// Load all game classes
-require(PATH . "inc/classes.php");
-
-// Load more include files
-$_GET['app'] = "ship-simu";
-require_once(PATH . "inc/selector.php");
-
-// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
-// jetzt die Personalliste wiederherstellen
-try {
- $test = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
-} catch (InvalidIDFormatException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NullPointerException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FileIsEmptyException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (FilePointerNotOpenedException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidMD5ChecksumException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidDataLengthException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidSimulatorIDException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MismatchingCompressorsException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNullException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerItemIsNoArrayException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (ContainerMaybeDamagedException $e) {
- die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- echo sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
-<pre>%s</pre>\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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-// Personal-Objekt debuggen
-if (defined('DEBUG_PERSONELL_OBJ')) {
- echo sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
-<pre>%s</pre>\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: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoObjectException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidObjectException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (MissingMethodException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (UnsupportedLimitationPartException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (GetterNotFoundException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (NoArrayCreatedException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-} catch (InvalidArrayCountException $e) {
- die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
- $e->getMessage()
- ));
-}
-
-//
-?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<!-- A compileable template for emergency messages //-->
+
+{?header:title="Problem in application framework detected!"?}
+
+{?navigation:nav_row=home;imprint;contact?}
+
+ <div class="emergency_exit message_box">
+ $content[message]
+ </div>
+
+{?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."?}
--- /dev/null
+ <div class="footer_message message_box">
+ $content[footer_msg]
+ </div>
+
+</div> <!-- masterbox //-->
+
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+ <title>
+ $content[title]
+ </title>
+
+ <meta name="author" content="$config[meta_author]" />
+ <meta name="publisher" content="$config[meta_publisher]" />
+ <meta name="keywords" content="$config[meta_keywords]" />
+ <meta name="robots" content="index,follow" />
+ <meta name="description" content="$config[meta_description]" />
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+ <meta http-equiv="content-style-type" content="text/css" />
+ <meta http-equiv="content-script-type" content="text/javascript" />
+ <meta http-equiv="language" content="de" />
+</head>
+
+<body>
+<div class="masterbox">
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+define('TEST', true);
+// Change directory
+@chdir("..");
+
+// Load config file
+require(dirname(dirname(__FILE__)) . "/inc/config.php");
+
+// Load all include files
+require(PATH . "inc/includes.php");
+
+// Load all game classes
+require(PATH . "inc/classes.php");
+
+// Load more include files
+$_GET['app'] = "ship-simu";
+require_once(PATH . "inc/selector.php");
+
+// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
+// jetzt die Personalliste wiederherstellen
+try {
+ $personell = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
+} catch (InvalidIDFormatException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NullPointerException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (FileIsEmptyException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (FilePointerNotOpenedException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidMD5ChecksumException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidDataLengthException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidSimulatorIDException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MismatchingCompressorsException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerItemIsNullException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerItemIsNoArrayException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerMaybeDamagedException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Personal-Objekt debuggen
+if (defined('DEBUG_PERSONELL_OBJ')) {
+ DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
+<pre>%s</pre>\n",
+ print_r($personell, true)
+ ));
+}
+
+// Hafen bauen
+$harbor = Harbor::createHarbor("Hamburger Hafen");
+
+// Name ausgeben
+DebugMiddleware::getInstance()->output(sprintf("Der <strong>%s</strong> ist gegründet worden.<br />\n",
+ $harbor->getHarborName()
+));
+
+// Hafen-Objekt debuggen
+if (defined('DEBUG_HARBOR_OBJ')) {
+ DebugMiddleware::getInstance()->output(sprintf("Der <strong>%s</strong> sieht wie folgt aus:<br />
+<pre>%s</pre>\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 <strong>%d</strong> in array <strong>%s</strong> found: <u>%s</u>", $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 <strong>%d</strong>: <u>%s</u>", $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: <pre><em>%s</em></pre><br />\n",
+ htmlentities($eval)
+ ));
+
+ // Run the constructed command
+ eval($eval);
+ } catch (ItemNotTradeableException $e) {
+ die(sprintf("[Main:] Die Preisliste des Händlers <strong>%s</strong> kann nicht befüllt werden. Grund: <strong>%s</strong><br />\n",
+ $merchant->getMerchantName(),
+ $e->getMessage()
+ ));
+ }
+}
+
+// Haendler-Objekt debuggen
+if (defined('DEBUG_MERCHANT_OBJ')) {
+ DebugMiddleware::getInstance()->output(sprintf("Der Händler <strong>%s</strong> sieht wie folgt aus:<br />
+<pre>%s</pre>\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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Dann mal ausgeben...
+DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> ist von <strong>%s %s</strong> gegründet worden.<br />\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 <strong>%s</strong> konnte kein Personal einstellen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (OutOfBoundsException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal einstellen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+}
+
+// Anzahl Personal ausgeben
+DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat nun <strong>%d</strong> weitere Mitarbeiter.<br />\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 <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (ClassMismatchException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> kann ihre Werften nicht beschäftigen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+}
+
+// Personal auf die Werften verteilen
+try {
+ $shipping->distributeAllPersonellOnShipyards();
+} catch (NoShipyardsConstructedException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (ClassMismatchException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (NullPointerException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte kein Personal den Werften zuteilen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+}
+
+// Normale Meldung ausgeben
+DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> beschäftigt nun ihre <strong>%d</strong> Mitarbeiter in <strong>%d</strong> Werft(en):<br />\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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NullPointerException $e) {
+ die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (EmptyStructuresListException $e) {
+ die(sprintf("[Main:] Der Bauauftrag konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\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 <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\n",
+ $merchant->getMerchantName(),
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Der Händler <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\n",
+ $merchant->getMerchantName(),
+ $e->getMessage()
+ ));
+} catch (ClassMismatchException $e) {
+ die(sprintf("[Main:] Der Händler <strong>%s</strong> konnte nicht ausgewählt werden. Grund: <strong>%s</strong><br />\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 <strong>%s</strong> konnte den Bauauftrag nicht validieren. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht validieren. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+}
+
+// Kann gebaut werden?
+if ($typeValid) {
+ DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> kann Schiffe vom Typ <strong>%s</strong> bauen.<br />\n",
+ $shipping->getCompanyName(),
+ $contract->getShipInstance()->getPartDescr()
+ ));
+} else {
+ DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> kann keine Schiffe vom Typ <strong>%s</strong> bauen!<br />\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 <strong>%s</strong> konnte nicht in der Preisliste gefunden werden. Grund: <strong>%s</strong><br />\n",
+ $key,
+ $e->getMessage()
+ ));
+ } catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Der Artikel <strong>%s</strong> konnte nicht in der Preisliste gefunden werden. Grund: <strong>%s</strong><br />\n",
+ $key,
+ $e->getMessage()
+ ));
+ }
+}
+
+// Reederei-Objekt ausgeben
+if (defined('DEBUG_COMPANY_OBJ')) {
+ DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> sieht wie folgt aus:<br />
+<pre>%s</pre>\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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (EmptyStructuresListException $e) {
+ die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (TotalPriceNotCalculatedException $e) {
+ die(sprintf("[Main:] Gesamtbestellwert nicht ermittelbar. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Wert ausgeben
+DebugMiddleware::getInstance()->output(sprintf("Der Bau der <strong>%s</strong> wird der Reederei <strong>%s</strong> voraussichtlich <strong>%s</strong> kosten.<br />\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 <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (InvalidContractPartnerException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (ContractAllreadySignedException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+} catch (WrongContractPartnerException $e) {
+ die(sprintf("[Main:] Die Reederei <strong>%s</strong> konnte den Bauauftrag nicht unterzeichnen. Grund: <strong>%s</strong><br />\n",
+ $shipping->getCompanyName(),
+ $e->getMessage()
+ ));
+}
+
+// Meldung ausgeben
+if ($contract->isSigned()) {
+ DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat den Bau der <strong>%s</strong> zugestimmt.<br />\n",
+ $shipping->getCompanyName(),
+ $contract->getShipInstance()->getShipName()
+ ));
+} else {
+ DebugMiddleware::getInstance()->output(sprintf("Die Reederei <strong>%s</strong> hat den Bau der <strong>%s</strong> abgelehnt.<br />\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:<br />
+<pre>%s</pre>\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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (EmptyStructuresListException $e) {
+ die(sprintf("[Main:] Anzahl Betten konnten nicht ermittelt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Bettenanzahl ausgeben
+DebugMiddleware::getInstance()->output(sprintf("Es stehen <strong>%d</strong> Betten zur Verfügung.",
+ $totalBeds
+));
+
+//
+?>
--- /dev/null
+<?php
+define('TEST', true);
+// Change directory
+@chdir("..");
+
+// Load config file
+require(dirname(dirname(__FILE__)) . "/inc/config.php");
+
+// Load all include files
+require(PATH . "inc/includes.php");
+
+// Load all game classes
+require(PATH . "inc/classes.php");
+
+// Load more include files
+$_GET['app'] = "ship-simu";
+require_once(PATH . "inc/selector.php");
+
+// jetzt die Personalliste wiederherstellen
+try {
+ $test = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
+} catch (InvalidIDFormatException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NullPointerException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (FileIsEmptyException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (FilePointerNotOpenedException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidMD5ChecksumException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidDataLengthException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidSimulatorIDException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MismatchingCompressorsException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerItemIsNullException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerItemIsNoArrayException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerMaybeDamagedException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Personal-Objekt debuggen
+if (defined('DEBUG_PERSONELL_OBJ')) {
+ DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
+<pre>%s</pre>\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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Personal-Objekt debuggen
+if (defined('DEBUG_PERSONELL_OBJ')) {
+ DebugMiddleware::getInstance()->output(sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
+<pre>%s</pre>\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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidObjectException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (UnsupportedLimitationPartException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (GetterNotFoundException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoArrayCreatedException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+//
+?>
--- /dev/null
+<?php
+define('TEST', true);
+// Change directory
+@chdir("..");
+
+// Load config file
+require(dirname(dirname(__FILE__)) . "/inc/config.php");
+
+// Load all include files
+require(PATH . "inc/includes.php");
+
+// Load all game classes
+require(PATH . "inc/classes.php");
+
+// Load more include files
+$_GET['app'] = "ship-simu";
+require_once(PATH . "inc/selector.php");
+
+// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
+// jetzt die Personalliste wiederherstellen
+try {
+ $test = SimulatorPersonell::createSimulatorPersonellByID("SimulatorPersonell@829292aeca3f6bf78c16e25fc4f75c98");
+} catch (InvalidIDFormatException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NullPointerException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (FileIsEmptyException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (FilePointerNotOpenedException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidMD5ChecksumException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidDataLengthException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidSimulatorIDException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MismatchingCompressorsException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerItemIsNullException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerItemIsNoArrayException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (ContainerMaybeDamagedException $e) {
+ die(sprintf("[Main:] Die Personenliste konnte nicht erstellt werden. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Personal-Objekt debuggen
+if (defined('DEBUG_PERSONELL_OBJ')) {
+ echo sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
+<pre>%s</pre>\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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Personenliste nicht angelegt. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Personal-Objekt debuggen
+if (defined('DEBUG_PERSONELL_OBJ')) {
+ echo sprintf("Das Personal-Objekt sieht wie folgt aus:<br />
+<pre>%s</pre>\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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoObjectException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidObjectException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (MissingMethodException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (UnsupportedLimitationPartException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (GetterNotFoundException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (NoArrayCreatedException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidArrayCountException $e) {
+ die(sprintf("[Main:] Objekt nicht gespeichert. Grund: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+//
+?>