From: Roland Häder Date: Mon, 3 Mar 2008 20:26:39 +0000 (+0000) Subject: some comments fixed, small fix for windows OSes and some other things fixed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b32994822964093e672d92815c13b70418d46cfd;p=hub.git some comments fixed, small fix for windows OSes and some other things fixed --- diff --git a/.gitattributes b/.gitattributes index d1a5f5f86..809d1641f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,204 +1,203 @@ * text=auto !eol -ship-simu/Doxyfile -text -ship-simu/application/.htaccess -text -ship-simu/application/hub/.htaccess -text -ship-simu/application/hub/class_ApplicationHelper.php -text -ship-simu/application/hub/config.php -text -ship-simu/application/hub/debug.php -text -ship-simu/application/hub/exceptions.php -text -ship-simu/application/hub/exceptions/.htaccess -text -ship-simu/application/hub/exceptions/class_HubException.php -text -ship-simu/application/hub/exceptions/client/.htaccess -text -ship-simu/application/hub/exceptions/client/class_HubHelloException.php -text -ship-simu/application/hub/exceptions/client/class_HubPeerAuthorizationException.php -text -ship-simu/application/hub/exceptions/client/class_HubPeerTimeoutException.php -text -ship-simu/application/hub/exceptions/commands/.htaccess -text -ship-simu/application/hub/exceptions/commands/class_UnexpectedAwaitCommandException.php -text -ship-simu/application/hub/exceptions/master/.htaccess -text -ship-simu/application/hub/exceptions/master/class_HubMasterDisconnectedException.php -text -ship-simu/application/hub/exceptions/socket/.htaccess -text -ship-simu/application/hub/exceptions/socket/class_SocketException.php -text -ship-simu/application/hub/exceptions/socket/connector/.htaccess -text -ship-simu/application/hub/exceptions/socket/connector/class_SocketAcceptException.php -text -ship-simu/application/hub/exceptions/socket/connector/class_SocketSelectorException.php -text -ship-simu/application/hub/exceptions/socket/init/.htaccess -text -ship-simu/application/hub/exceptions/socket/init/class_SocketBindException.php -text -ship-simu/application/hub/exceptions/socket/init/class_SocketConnectException.php -text -ship-simu/application/hub/exceptions/socket/init/class_SocketCreationException.php -text -ship-simu/application/hub/exceptions/socket/init/class_SocketListeningException.php -text -ship-simu/application/hub/exceptions/socket/init/class_SocketSetupException.php -text -ship-simu/application/hub/exceptions/socket/peer/.htaccess -text -ship-simu/application/hub/exceptions/socket/peer/class_BrokenPipeException.php -text -ship-simu/application/hub/exceptions/socket/peer/class_IPSpoofingException.php -text -ship-simu/application/hub/exceptions/socket/peer/class_PeerSocketException.php -text -ship-simu/application/hub/init.php -text -ship-simu/application/hub/interfaces/.htaccess -text -ship-simu/application/hub/loader.php -text -ship-simu/application/hub/main/.htaccess -text -ship-simu/application/hub/main/class_HubCommandProcessor.php -text -ship-simu/application/hub/main/class_HubConnector.php -text -ship-simu/application/hub/main/class_HubCoreLoop.php -text -ship-simu/application/hub/main/class_HubPeer.php -text -ship-simu/application/hub/middleware/.htaccess -text -ship-simu/application/hub/starter.php -text -ship-simu/chat-server.php -text -ship-simu/devel/.htaccess -text -ship-simu/devel/class_Debug.php -text -ship-simu/docs/COPYING -text -ship-simu/docs/NEWS -text -ship-simu/docs/README -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-local.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/hub/.htaccess -text +application/hub/class_ApplicationHelper.php -text +application/hub/config.php -text +application/hub/debug.php -text +application/hub/exceptions.php -text +application/hub/exceptions/.htaccess -text +application/hub/exceptions/class_HubException.php -text +application/hub/exceptions/client/.htaccess -text +application/hub/exceptions/client/class_HubHelloException.php -text +application/hub/exceptions/client/class_HubPeerAuthorizationException.php -text +application/hub/exceptions/client/class_HubPeerTimeoutException.php -text +application/hub/exceptions/commands/.htaccess -text +application/hub/exceptions/commands/class_UnexpectedAwaitCommandException.php -text +application/hub/exceptions/master/.htaccess -text +application/hub/exceptions/master/class_HubMasterDisconnectedException.php -text +application/hub/exceptions/socket/.htaccess -text +application/hub/exceptions/socket/class_SocketException.php -text +application/hub/exceptions/socket/connector/.htaccess -text +application/hub/exceptions/socket/connector/class_SocketAcceptException.php -text +application/hub/exceptions/socket/connector/class_SocketSelectorException.php -text +application/hub/exceptions/socket/init/.htaccess -text +application/hub/exceptions/socket/init/class_SocketBindException.php -text +application/hub/exceptions/socket/init/class_SocketConnectException.php -text +application/hub/exceptions/socket/init/class_SocketCreationException.php -text +application/hub/exceptions/socket/init/class_SocketListeningException.php -text +application/hub/exceptions/socket/init/class_SocketSetupException.php -text +application/hub/exceptions/socket/peer/.htaccess -text +application/hub/exceptions/socket/peer/class_BrokenPipeException.php -text +application/hub/exceptions/socket/peer/class_IPSpoofingException.php -text +application/hub/exceptions/socket/peer/class_PeerSocketException.php -text +application/hub/init.php -text +application/hub/interfaces/.htaccess -text +application/hub/loader.php -text +application/hub/main/.htaccess -text +application/hub/main/class_HubCommandProcessor.php -text +application/hub/main/class_HubConnector.php -text +application/hub/main/class_HubCoreLoop.php -text +application/hub/main/class_HubPeer.php -text +application/hub/middleware/.htaccess -text +application/hub/starter.php -text +/chat-server.php -text +db/.htaccess -text +db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized -text +devel/.htaccess -text +devel/class_Debug.php -text +docs/COPYING -text +docs/NEWS -text +docs/README -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-local.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 diff --git a/.gitignore b/.gitignore index 274b35163..5e4afd2d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ /.cache /.project /.settings -ship-simu/db diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 000000000..5d5b89373 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,1321 @@ +# Doxyfile 1.5.4 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = MXChangeHub + +# 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.0.0 + +# 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/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/ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = YES + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = YES + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is +# documented as struct with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code where the coding convention is that all structs are +# typedef'ed and only the typedef is referenced never the struct's name. + +TYPEDEF_HIDES_STRUCT = NO + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = YES + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = YES + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text " + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = /var/www/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/ship-simu/ + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.php + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = */docs/* \ + */ship-simu.org/* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = YES + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = YES + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = YES + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = NO + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = YES + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = YES diff --git a/application/.htaccess b/application/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/.htaccess b/application/hub/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php new file mode 100644 index 000000000..60409b70c --- /dev/null +++ b/application/hub/class_ApplicationHelper.php @@ -0,0 +1,182 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class 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 hub system + * + * @return void + */ + public final function entryPoint () { + // Get a core loop instance + $hubInstance = HubCoreLoop::createHubCoreLoop(); + + // Output some text + $hubInstance->outputIntro(); + + // Contact the master hub + $hubInstance->contactMasterHub(); + + // The main loop begins here + $hubInstance->coreLoop(); + + // Shutdown the hub + $hubInstance->shutdownHub(); + } +} + +// [EOF] +?> diff --git a/application/hub/config.php b/application/hub/config.php new file mode 100644 index 000000000..926ab2e18 --- /dev/null +++ b/application/hub/config.php @@ -0,0 +1,103 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Some hub-specific configuration like port hostname where we will listen, etc. +$cfg = FrameworkConfiguration::getInstance(); + +// CFG: HUB-LISTEN-ADDR +$cfg->setConfigEntry("hub_listen_addr", "0.0.0.0"); + +// CFG: HUB-LISTEN-PORT (zero = auto-choose) +$cfg->setConfigEntry("hub_listen_port", 9050); + +// CFG: TEMPLATE-ENGINE +$cfg->setConfigEntry("tpl_engine", "ConsoleOutput"); + +// CFG: WEB-ENGINE +$cfg->setConfigEntry("web_engine", "DebugConsoleOutput"); + +// CFG: DEBUG-ENGINE +$cfg->setConfigEntry("debug_engine", "DebugErrorLogOutput"); + +// CFG: WEB-CONTENT-TYPE +$cfg->setConfigEntry("web_content_type", ""); + +// CFG: HUB-INTRO-ENABLED +$cfg->setConfigEntry("hub_intro_enabled", "Y"); + +// CFG: HUB-MAX-AUTH-TRIES +$cfg->setConfigEntry("hub_max_auth_tries", 3); + +// CFG: HUB-MSG-AUTH-TRIES +$cfg->setConfigEntry("hub_msg_auth_tries", "AUTH_MAX_TRIES"); + +// CFG: HUB-MSG-SPOOFING +$cfg->setConfigEntry("hub_msg_spoofing", "SPOOFING"); + +// CFG: HUB-MSG-AUTH-REPLY +$cfg->setConfigEntry("hub_msg_auth_reply_timeout", "TIMEOUT_AUTH"); + +// CFG: HUB-MSG-BYE +$cfg->setConfigEntry("hub_msg_bye", "BYE"); + +// CFG: HUB-MASTER-IP +$cfg->setConfigEntry("hub_master_ip", "192.168.1.17"); + +// CFG: HUB-MASTER-PORT +$cfg->setConfigEntry("hub_master_port", 9050); + +// CFG: HUB-AUTH-REQUEST +$cfg->setConfigEntry("hub_auth_request", "AUTH"); + +// CFG: HUB-AUTH-REQUEST-TIMEOUT (5 seconds for whole auth procedure shall be fine) +$cfg->setConfigEntry("hub_auth_request_timeout", 5); + +// CFG: HUB-PEER-HELLO +$cfg->setConfigEntry("hub_peer_hello", "HELLO"); + +// CFG: HUB-HELLO-REPLY +$cfg->setConfigEntry("hub_hello_reply", "ELHO"); + +// CFG: HUB-HELLO-TIMEOUT +$cfg->setConfigEntry("hub_hello_timeout", 30); + +// CFG: HUB-HELLO-RETRIES +$cfg->setConfigEntry("hub_hello_retires", 3); + +// CFG: HUB-PEER-PING +$cfg->setConfigEntry("hub_peer_ping", "PING"); + +// CFG: HUB-PING-REPLY +$cfg->setConfigEntry("hub_ping_reply", "PONG"); + +// CFG: HUB-PING-TIMEOUT +$cfg->setConfigEntry("hub_ping_timeout", 10); + +// CFG: HUB-PING-MAXDROPS +$cfg->setConfigEntry("hub_ping_maxdrops", 3); + +// CFG: HUB-PEER-MISS-PONG +$cfg->setConfigEntry("hub_peer_miss_pong", "PONG_MISS"); + +// [EOF] +?> diff --git a/application/hub/debug.php b/application/hub/debug.php new file mode 100644 index 000000000..393601cdb --- /dev/null +++ b/application/hub/debug.php @@ -0,0 +1,28 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Hub main loop debugging +define('HUB_DEBUG_MAIN', true); + +// [EOF] +?> diff --git a/application/hub/exceptions.php b/application/hub/exceptions.php new file mode 100644 index 000000000..7b569dc18 --- /dev/null +++ b/application/hub/exceptions.php @@ -0,0 +1,90 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// The hub's own exception handler +function hub_exception_handler ($exceptionInstance) { + // Is it an object and a valid instance? + if ((is_object($exceptionInstance)) && ($exceptionInstance instanceof FrameworkException)) { + // Get the regular trace + $trace = $exceptionInstance->getTrace(); + + // Get 3 call levels + $backTrace = ""; + for ($idx = 0; $idx < 3; $idx++) { + $traceArray = $trace[$idx]; + + // Convert arguments type into human-readable + $args = $traceArray['args']; + $argsString = ""; + foreach ($args as $arg) { + $argsString .= ", ".gettype($arg); + } + $argsString = substr($argsString, 2); + + $backTrace .= sprintf("---------- Pos %d: ---------- +Method : %s%s%s(%s) +----- Caller: ----- +File : %s +Line : %d\n", + ($idx + 1), + $traceArray['class'], + $traceArray['type'], + $traceArray['function'], + $argsString, + basename($traceArray['file']), + $traceArray['line'] + ); + } + + // Construct the message + $message = sprintf("-------------------------------------------------------------------------------- +Uncaught Exception : %s +-------------------------------------------------------------------------------- +Message : %s +Code : %s +File : %s +Line : %d +-------------------------------------------------------------------------------- +Backtrace: +-------------------------------------------------------------------------------- +%s +--------------------------------------------------------------------------------\n", + trim(html_entity_decode(strip_tags($exceptionInstance->__toString()))), + trim(html_entity_decode(strip_tags($exceptionInstance->getMessage()))), + $exceptionInstance->getHexCode(), + $exceptionInstance->getFile(), + $exceptionInstance->getLine(), + trim($backTrace) + ); + + // Output the message + print $message; + } +} + +// Set the new handler +set_exception_handler('hub_exception_handler'); + +// [EOF] +?> diff --git a/application/hub/exceptions/.htaccess b/application/hub/exceptions/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/class_HubException.php b/application/hub/exceptions/class_HubException.php new file mode 100644 index 000000000..b665355bb --- /dev/null +++ b/application/hub/exceptions/class_HubException.php @@ -0,0 +1,38 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +abstract class HubException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public function __construct ($message, $code) { + // For now just pipe all data through + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/client/.htaccess b/application/hub/exceptions/client/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/client/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/client/class_HubHelloException.php b/application/hub/exceptions/client/class_HubHelloException.php new file mode 100644 index 000000000..597af222a --- /dev/null +++ b/application/hub/exceptions/client/class_HubHelloException.php @@ -0,0 +1,47 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubHelloException extends HubException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Peer %s has not replyed our %s request within %d retries.
\n", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['peer']->getValidatedIP(), + $msgArray['this']->getConfigInstance()->readConfig("hub_peer_hello"), + $msgArray['this']->getConfigInstance()->readConfig("hub_hello_retires") + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/client/class_HubPeerAuthorizationException.php b/application/hub/exceptions/client/class_HubPeerAuthorizationException.php new file mode 100644 index 000000000..9018eb290 --- /dev/null +++ b/application/hub/exceptions/client/class_HubPeerAuthorizationException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubPeerAuthorizationException extends HubException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Peer %s has reached the maximum of %d authorization tries. Disconnecting peer....
\n", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['peer']->getValidatedIP(), + $msgArray['max'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/client/class_HubPeerTimeoutException.php b/application/hub/exceptions/client/class_HubPeerTimeoutException.php new file mode 100644 index 000000000..ead9caa6f --- /dev/null +++ b/application/hub/exceptions/client/class_HubPeerTimeoutException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubPeerTimeoutException extends HubException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Peer %s is no longer responding. Trying to disconnect the peer...
\n", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['peer']->getValidatedIP() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/commands/.htaccess b/application/hub/exceptions/commands/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/commands/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/commands/class_UnexpectedAwaitCommandException.php b/application/hub/exceptions/commands/class_UnexpectedAwaitCommandException.php new file mode 100644 index 000000000..df47f36ed --- /dev/null +++ b/application/hub/exceptions/commands/class_UnexpectedAwaitCommandException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class UnexpectedAwaitCommandException extends HubException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Not awaiting command %s from peer %s
\n", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['msg'], + $msgArray['this']->getPeerInstance()->getValidedIP() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/master/.htaccess b/application/hub/exceptions/master/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/master/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/master/class_HubMasterDisconnectedException.php b/application/hub/exceptions/master/class_HubMasterDisconnectedException.php new file mode 100644 index 000000000..9164b5651 --- /dev/null +++ b/application/hub/exceptions/master/class_HubMasterDisconnectedException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubMasterDisconnectedException extends HubException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Raw message received: %s
\n", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['msg'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/.htaccess b/application/hub/exceptions/socket/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/socket/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/socket/class_SocketException.php b/application/hub/exceptions/socket/class_SocketException.php new file mode 100644 index 000000000..867c84ca3 --- /dev/null +++ b/application/hub/exceptions/socket/class_SocketException.php @@ -0,0 +1,38 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +abstract class SocketException extends HubException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public function __construct ($message, $code) { + // For now just pipe all data through + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/connector/.htaccess b/application/hub/exceptions/socket/connector/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/socket/connector/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/socket/connector/class_SocketAcceptException.php b/application/hub/exceptions/socket/connector/class_SocketAcceptException.php new file mode 100644 index 000000000..70b1b7ebc --- /dev/null +++ b/application/hub/exceptions/socket/connector/class_SocketAcceptException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SocketAcceptException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] socket_accept() has failed. Reason: %s (Code: %d)", + $msgArray['this']->__toString(), + $this->getLine(), + socket_strerror($msgArray['code']), + $msgArray['code'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/connector/class_SocketSelectorException.php b/application/hub/exceptions/socket/connector/class_SocketSelectorException.php new file mode 100644 index 000000000..38234ae3a --- /dev/null +++ b/application/hub/exceptions/socket/connector/class_SocketSelectorException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SocketSelectorException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] socket_select() has failed. Reason: %s (Code: %d)", + $msgArray['this']->__toString(), + $this->getLine(), + socket_strerror($msgArray['code']), + $msgArray['code'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/init/.htaccess b/application/hub/exceptions/socket/init/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/socket/init/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/socket/init/class_SocketBindException.php b/application/hub/exceptions/socket/init/class_SocketBindException.php new file mode 100644 index 000000000..caef6f3f9 --- /dev/null +++ b/application/hub/exceptions/socket/init/class_SocketBindException.php @@ -0,0 +1,48 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SocketBindException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Socket konnte nicht an %s:%d gebunden werden. Reason: %s (Code: %d)", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['host'], + $msgArray['port'], + socket_strerror($msgArray['code']), + $msgArray['code'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/init/class_SocketConnectException.php b/application/hub/exceptions/socket/init/class_SocketConnectException.php new file mode 100644 index 000000000..3059677e5 --- /dev/null +++ b/application/hub/exceptions/socket/init/class_SocketConnectException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SocketConnectException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] socket_connect() has failed. Reason: %s (Code: %d)", + $msgArray['this']->__toString(), + $this->getLine(), + socket_strerror($msgArray['code']), + $msgArray['code'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/init/class_SocketCreationException.php b/application/hub/exceptions/socket/init/class_SocketCreationException.php new file mode 100644 index 000000000..2991fc06e --- /dev/null +++ b/application/hub/exceptions/socket/init/class_SocketCreationException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SocketCreationException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Socket konnte nicht erstellt werden. Reason: %s (Code: %d)", + $msgArray['this']->__toString(), + $this->getLine(), + socket_strerror($msgArray['code']), + $msgArray['code'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/init/class_SocketListeningException.php b/application/hub/exceptions/socket/init/class_SocketListeningException.php new file mode 100644 index 000000000..979b1b1dd --- /dev/null +++ b/application/hub/exceptions/socket/init/class_SocketListeningException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SocketListeningException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] socket_listen() has failed. Reason: %s (Code: %d)", + $msgArray['this']->__toString(), + $this->getLine(), + socket_strerror($msgArray['code']), + $msgArray['code'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/init/class_SocketSetupException.php b/application/hub/exceptions/socket/init/class_SocketSetupException.php new file mode 100644 index 000000000..3f3f9141c --- /dev/null +++ b/application/hub/exceptions/socket/init/class_SocketSetupException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SocketSetupException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Socket konnte nicht konfiguriert werden. Reason: %s (Code: %d)", + $msgArray['this']->__toString(), + $this->getLine(), + socket_strerror($msgArray['code']), + $msgArray['code'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/peer/.htaccess b/application/hub/exceptions/socket/peer/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/exceptions/socket/peer/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/exceptions/socket/peer/class_BrokenPipeException.php b/application/hub/exceptions/socket/peer/class_BrokenPipeException.php new file mode 100644 index 000000000..8f7d1a88f --- /dev/null +++ b/application/hub/exceptions/socket/peer/class_BrokenPipeException.php @@ -0,0 +1,47 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BrokenPipeException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Connection lost to peer %s. Error message: %s (Code: %d)
\n", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['this']->getValidatedIP(), + socket_strerror($msgArray['code']), + $msgArray['code'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/peer/class_IPSpoofingException.php b/application/hub/exceptions/socket/peer/class_IPSpoofingException.php new file mode 100644 index 000000000..85516133f --- /dev/null +++ b/application/hub/exceptions/socket/peer/class_IPSpoofingException.php @@ -0,0 +1,46 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class IPSpoofingException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Peer-IP hat sich von %s auf %s geändert.
\n", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['old_ip'], + $msgArray['new_ip'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/exceptions/socket/peer/class_PeerSocketException.php b/application/hub/exceptions/socket/peer/class_PeerSocketException.php new file mode 100644 index 000000000..9d1278d2f --- /dev/null +++ b/application/hub/exceptions/socket/peer/class_PeerSocketException.php @@ -0,0 +1,45 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class PeerSocketException extends SocketException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($msgArray, $code) { + // Construct the message + $message = sprintf("[%s:%d] Peer-Socket ist ungültig. Datentyp: %s
\n", + $msgArray['this']->__toString(), + $this->getLine(), + $msgArray['type'] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/application/hub/init.php b/application/hub/init.php new file mode 100644 index 000000000..4ac89d331 --- /dev/null +++ b/application/hub/init.php @@ -0,0 +1,66 @@ +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) + * + * @author Roland Haeder + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// 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("MXChange Hub"); +$app->setAppVersion("0.0.0"); +$app->setAppShortName("mxhub"); + +// Get's our IP address +$_SERVER['SERVER_ADDR'] = ConsoleTools::aquireSelfIPAddress(); + +// 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(sprintf("%sinc/database%s", + PATH, + FrameworkConfiguration::getInstance()->readConfig("php_extension") +)); + +// [EOF] +?> diff --git a/application/hub/interfaces/.htaccess b/application/hub/interfaces/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/loader.php b/application/hub/loader.php new file mode 100644 index 000000000..8464a8a93 --- /dev/null +++ b/application/hub/loader.php @@ -0,0 +1,66 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Is the instance variable set? +if (!isset($application)) { + // We need this! + ApplicationEntryPoint::app_die("[Main:] Interne Variable application nicht gefunden!"); +} + +// Load all classes for the application +foreach ($lowerClasses as $class) { + // Try to load the application classes + try { + ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application, $class)); + } catch (PathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Reason: %s", + $class, + $e->getMessage() + )); + } catch (PathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Reason: %s", + $class, + $e->getMessage() + )); + } catch (PathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Reason: %s", + $class, + $e->getMessage() + )); + } catch (DirPointerNotOpenedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Reason: %s", + $class, + $e->getMessage() + )); + } +} + +// Include all classes +ClassLoader::getInstance()->includeAllClasses(); + +// Clean up the global namespace +unset($lowerClasses); +unset($class); + +// [EOF] +?> diff --git a/application/hub/main/.htaccess b/application/hub/main/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/class_HubCommandProcessor.php b/application/hub/main/class_HubCommandProcessor.php new file mode 100644 index 000000000..c325928eb --- /dev/null +++ b/application/hub/main/class_HubCommandProcessor.php @@ -0,0 +1,196 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubCommandProcessor extends BaseFrameworkSystem { + /** + * An instance of a HubPeer class + */ + private $peerInstance = null; + + /** + * A list of sent commands but not replied (yet) + */ + private $sentCommandsAwaitingAnswer = array(); + + /** + * Queued commands from the master hub + */ + private $masterCommands = array(); + + // Exceptions + const EXCEPTION_COMMAND_AWAIT_INVALID = 0xc00; + + /** + * The private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Hub-Command-Processor"); + + // Set unique ID + $this->createUniqueID(); + + // Tidy up a little + $this->removeSystemArray(); + $this->removeNumberFormaters(); + } + + /** + * Creates an instance of a HubCommandProcessor class by a HubPeer class + * + * @param $peerInstance An instance of a HubPeer class + * @return $command An instance of this class + */ + public final static function createHubCommandProcessor (HubPeer $peerInstance) { + // Get a new instance of this class + $command = new HubCommandProcessor(); + + // Set the hub instance + $command->setPeerInstance($peerInstance); + + // Return the instance + return $command; + } + + /** + * Setter for HubPeer instances + * + * @param $peerInstance An instance of a HubPeer class + * @return void + */ + public final function setPeerInstance(HubPeer $peerInstance) { + $this->peerInstance = $peerInstance; + } + + /** + * Getter for HubPeer instances + * + * @return $peerInstance An instance of a HubPeer class + */ + public final function getPeerInstance() { + return $this->peerInstance; + } + + /** + * Handles simple commands which require an answer command from the peer without any parameters + * + * @param $sendCommand The command we shall send to the peer + * @param $expectCommand The command we except from the peer + * @return void + */ + public function simpleExecute ($sendCommand, $expectCommand) { + // Remember the command + $this->sentCommandsAwaitingAnswer[$expectCommand] = $sendCommand; + + // Debug message + $this->getPeerInstance()->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Sending command %s to peer %s", + $this->__toString(), + $sendCommand, + $this->getPeerInstance()->getValidatedIP() + )); + + // Execute the command + $this->getPeerInstance()->sendMessage($sendCommand); + } + + /** + * Awaits a specified command from the peer and returns TRUE if received or FALSE if not. + * + * @param $exceptCommand The command we are expecting from the peer + * @return $await Wether the awaited command has been received + * @throws UnexpectedAwaitCommandException If the awaited command is not being awaited... + */ + public function ifAwaitsCommand ($expectCommand) { + $await = false; + + // Do we wait for this command? + if (!isset($this->sentCommandsAwaitingAnswer[$expectCommand])) { + // We are not waiting for this command + throw new UnexpectedAwaitCommandException ( + array( + 'this' => $this, + 'await' => $expectCommand + ), self::EXCEPTION_COMMAND_AWAIT_INVALID + ); + } // END - if + + // Then process it... :-) + $readCommand = $this->getPeerInstance()->readFromSocket(); + + // Is the command not empty? + if (!empty($readCommand)) { + // Debug message + $this->getPeerInstance()->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Raw command %s received from peer %s", + $this->__toString(), + $readCommand, + $this->getPeerInstance()->getValidatedIP() + )); + } // END - if + + if ($readCommand == $expectCommand) { + // Debug message + $this->getPeerInstance()->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Awaited command %s received from peer %s", + $this->__toString(), + $expectCommand, + $this->getPeerInstance()->getValidatedIP() + )); + + // Expected command has been received! + unset($this->sentCommandsAwaitingAnswer[$expectCommand]); + $await = true; + + } // END - if + + // Return the result + return $await; + } + + /** + * Awaits any command from the peer + * + * @return $command The sent command from the peer + */ + public function awaitAnyCommand () { + $command = false; + $readCommand = $this->getPeerInstance()->readFromSocket(); + if (!empty($readCommand)) { + // Remember this command + // TODO Add some validation here! + $this->masterCommands[] = $readCommand; + + // A command is in the queue + $command = true; + } // END - if + + // Return status + return $command; + } + +} // END - class + +// [EOF] +?> diff --git a/application/hub/main/class_HubConnector.php b/application/hub/main/class_HubConnector.php new file mode 100644 index 000000000..2b775c031 --- /dev/null +++ b/application/hub/main/class_HubConnector.php @@ -0,0 +1,185 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubConnector extends BaseFrameworkSystem { + /** + * The socket we shall use for communication + */ + private $socketResource = null; + + /** + * The peer instance (HubPeer class) + */ + private $peerInstance = null; + + /** + * The private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Hub-Connector"); + + // Set unique ID + $this->createUniqueID(); + + // Tidy up a little + $this->removeSystemArray(); + $this->removeNumberFormaters(); + } + + /** + * Creates an instance based on the (IP) address and port number of this + * class. Next it tries to connect to the specified peer and communicates + * to it over a socket + * + * @param $address The peer's IP address + * @param $port The peer's port number + * @param $hubInstance An instance of a HubCoreLoop class + * @return $connector An instance of this class + * @throws HubHelloException If HELLO retries reached maximum + */ + public final static function createHubConnectorByAddressPort ($address, $port, HubCoreLoop $hubInstance) { + // Get a new instance of this class + $connector = new HubConnector(); + + // Connect to the given address and IP number + $connector->aquireConnectionToAddress($address, $port); + + // Message to console + $hubInstance->getOutputInstance()->output(sprintf("[%s] Sending %s request to hub %s:%d...", + __METHOD__, + $connector->getConfigInstance()->readConfig("hub_peer_hello"), + $address, + $port + )); + + // Get a HubPeer instance + $peerInstance = HubPeer::createHubPeerBySocket($connector->getSocketResource(), $hubInstance); + + // Send a HELLO to the master hub + $helloed = 0; $retries = 0; + while (!$peerInstance->ifHelloReplied()) { + // Within timeout? + if ((time() - $helloed) >= $connector->getConfigInstance()->readConfig("hub_hello_timeout")) { + // Send HELLOs out in periodic times + $peerInstance->sendMessage($connector->getConfigInstance()->readConfig("hub_peer_hello")); + $helloed = time(); $retries++; + if ($retries == $connector->getConfigInstance()->readConfig("hub_hello_retires")) { + // Maximum retries reached + throw new HubHelloException( + array( + 'this' => $connector, + 'peer' => $peerInstance + ), HubCoreLoop::EXCEPTION_HELLO_TIMED_OUT + ); + } + } // END - if + } // END - while + + // Set the peer instance + $connector->setPeerInstance($peerInstance); + + // Return the instance + return $connector; + } + + /** + * Aquires a socket link to a specified IP address and port number. It + * throws subclasses of SocketException-s if the peer is down or not + * responding. If the connection is up it writes it's resource into + * the attribute $socketResource and waits for incoming data packages. + * + * @param $address The peer's IP address + * @param $port The peer's port number + * @return void + * @throws SocketCreationException If creation of the socket wents wrong + * @throws SocketConnectException If the connection was not established + */ + public function aquireConnectionToAddress ($address, $port) { + // Create a socket for binding to the address + $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + + // Was it a success? + if (!is_resource($socket)) { + // This fails! :( + throw new SocketCreationException( + array( + 'this' => $this, + 'code' => socket_last_error() + ), HubCoreLoop::EXCEPTION_SOCKET_PROBLEM + ); + } // END - fi + + // Now connect to the peer + if (@socket_connect($socket, $address, $port) === false) { + // Something wents wrong! + throw new SocketConnectException ( + array( + 'this' => $this, + 'code' => socket_last_error() + ), HubCoreLoop::EXCEPTION_SOCKET_PROBLEM + ); + } // END - if + + // Set non-blocking mode + @socket_set_nonblock($socket); + + // Set the socket + $this->socketResource = $socket; + } + + /** + * Getter for current socket + * + * @return $socketResource The current socket resource or null if not set + */ + public final function getSocketResource() { + return $this->socketResource; + } + + /** + * Setter for a HubPeer instance + * + * @param $peerInstance An instance of a HubPeer class + * @return void + */ + public final function setPeerInstance (HubPeer $peerInstance) { + $this->peerInstance = $peerInstance; + } + + /** + * Handles any incoming master requests + * + * @return void + */ + public function handleMasterRequests () { + // Just ask the peer instance + $command = $this->peerInstance->handleMasterRequests(); + } + +} // END - class +?> diff --git a/application/hub/main/class_HubCoreLoop.php b/application/hub/main/class_HubCoreLoop.php new file mode 100644 index 000000000..86f496f5d --- /dev/null +++ b/application/hub/main/class_HubCoreLoop.php @@ -0,0 +1,713 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubCoreLoop extends BaseFrameworkSystem { + /** + * Wether the hub is active and running + */ + private $hubActivated = false; + + /** + * Wether the hub is shutting down + */ + private $hubShutsDown = false; + + /** + * A list of all connected peers (sockets) + */ + private $connectedPeers = null; + + /** + * A console output handler + */ + private $outputInstance = null; + + /** + * Reading peers + */ + private $readPeers = array(); + + /** + * Writing peers + */ + private $writePeers = array(); + + /** + * The main socket (listening) for this hub + */ + private $main_socket = null; + + /** + * A list of authenticated peers + */ + private $authPeers = null; + + /** + * Last peer instance + */ + private $lastPeerInstance = null; + + /** + * Wether this hub is a master hub + */ + private $hubIsMaster = false; + + /** + * Maximum auth retries (cached) + */ + private $authRetries = 0; + + /** + * Auth request message + */ + private $authRequest = ""; + + /** + * Cached timeout for auth requests + */ + private $authRequestTimeout = 0; + + /** + * An instance to the HubConnector class for master hub connection + */ + private $masterConnector = null; + + // Exception codes + const EXCEPTION_SOCKET_PROBLEM = 0xb00; + const EXCEPTION_HUB_PEER_TIMEOUT = 0xb01; + const EXCEPTION_HUB_PEER_FAILED_AUTH = 0xb02; + const EXCEPTION_HELLO_TIMED_OUT = 0xb03; + + /** + * The private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Hub-Core Loop"); + + // Set unique ID + $this->createUniqueID(); + + // Tidy up a little + $this->removeSystemArray(); + $this->removeNumberFormaters(); + + // Init the peer list + $this->initPeerList(); + } + + /** + * Factory for main loop + * + * @return $hubInstance An instance of this class + */ + public final static function createHubCoreLoop () { + // Get an instance + $hubInstance = new HubCoreLoop(); + + // Try to setup the socket + $hubInstance->setupHub(); + + // Get the configuration variable + $outEngine = $hubInstance->getConfigInstance()->readConfig("tpl_engine"); + + // Setup the console output handler + $eval = sprintf("\$hubInstance->setOutputInstance(%s::create%s(\"%s\"));", + $outEngine, + $outEngine, + $hubInstance->getConfigInstance()->readConfig("web_content_type") + ); + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $hubInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: %s", + $hubInstance->__toString(), + htmlentities($eval) + )); + @eval($eval); + + // Return the prepared instance + return $hubInstance; + } + + /** + * Initializes the peer list + * + * @return void + */ + private final function initPeerList () { + $this->connectedPeers = new FrameworkArrayObject(); + $this->authPeers = new FrameworkArrayObject(); + } + + /** + * Get total number of connected peers + * + * @return $num The total number of connected peers + */ + private final function getTotalConnectedPeers () { + $read = array($this->connectedPeers->getIterator()->current()); + $write = array(); + $except = array(); + + // Get socket number + $num = socket_select( + $read, + $write, + $except, + 0 + ); + + // Transfer readers and writers + $this->readPeers = $read; + $this->writePeers = $write; + + // Return the number + return $num; + } + + /** + * Handle newly connected peers + * + * @return void + */ + private final function handleNewPeers () { + // Output message + $this->getOutputInstance()->output(sprintf("[%s] Validating peer...", __METHOD__)); + + // Is the main socket in the array? + if (in_array($this->main_socket, $this->readPeers)) { + // Accept the connection and add him to the list + $peer_socket = socket_accept($this->main_socket); + + // Get a new peer instance + $this->setCurrPeerInstance(HubPeer::createHubPeerBySocket($peer_socket, $this)); + + // Register the new peer + $this->getOutputInstance()->output(sprintf("[%s] Registering new peer with IP %s.", + __METHOD__, + $this->getCurrPeerInstance()->getValidatedIP() + )); + $this->connectedPeers->append($this->lastPeerInstance); + + // A new peer has connected + $this->getOutputInstance()->output(sprintf("[%s] New peer with IP %s has been registered.", + __METHOD__, + $this->getCurrPeerInstance()->getValidatedIP() + )); + + // Remove him from the list + $key = array_search($this->main_socket, $this->readPeers); + unset($this->readPeers[$key]); + } // END - if + } + + /** + * Handles unauthenticated peers + * + * @return void + * @throws HubPeerTimeoutException If the peer times out to answer a request + * @throws HubPeerAuthorizationException If the peer fails to authorize himself (to many retries) + */ + private final function handleUnauthPeers () { + // Are there some peers? + if ($this->connectedPeers->count() > 1) { + // Iterate through all connected peers + for ($idx = $this->connectedPeers->getIterator(); $idx->valid(); $idx->next()) { + // Get current peer + $this->lastPeerInstance = $idx->current(); + + // Ignore own socket and invalid entries + if (($this->getCurrPeerInstance() !== $this->main_socket) && (is_object($this->getCurrPeerInstance())) && ($this->getCurrPeerInstance() instanceof HubPeer)) { + // Is this peer already authorized or is this the master hub? + // If this is the master hub then there is no auth required + if ((!$this->getCurrPeerInstance()->ifPeerIsAuthorized()) && (!$this->getCurrPeerInstance()->ifPeerIsLocalAdmin()) && (!$this->hubIsMaster)) { + // This peer waits for authorization, so does he have some tries left? + if ($this->getCurrPeerInstance()->getAuthRetries() <= $this->authRetries) { + // This peer is still allowed to try his authorization + if ($this->getCurrPeerInstance()->getLastSentMessage() == $this->authRequest) { + // Already asked so maybe timed out? + if ((time() - $this->getCurrPeerInstance()->getLastSentMessageStamp()) >= $this->authRequestTimeout) { + // Timed out so disconnect the peer + throw new HubPeerTimeoutException ( + array( + 'this' => $this, + 'peer' => $this->getCurrPeerInstance() + ), self::EXCEPTION_HUB_PEER_TIMEOUT + ); + } // END - if + } elseif ($this->getCurrPeerInstance()->ifHelloReceived()) { + // HELLO received so we need to sent the AUTH request + $this->getCurrPeerInstance()->askAuthorizationKey(); + } + } else { + // This peer needs disconnecting! + throw new HubPeerAuthorizationException ( + array( + 'this' => $this, + 'peer' => $this->getCurrPeerInstance(), + 'max' => $this->authRetries + ), self::EXCEPTION_HUB_PEER_FAILED_AUTH + ); + } // END - else + } elseif ((!$this->getCurrPeerInstance()->ifPeerIsAuthorized()) && ($this->getCurrPeerInstance()->ifPeerIsLocalAdmin())) { + // This peer is a local admin so he is always authorized! + $this->getCurrPeerInstance()->enableLocalAdmin(); + + // Output debug message + $this->getOutputInstance()->output(sprintf("[%s] A local admin has connected.", + $this->__toString() + )); + + // Say "hi" to the admin + $this->getCurrPeerInstance()->sayHi2Admin(); + } elseif (($this->hubIsMaster) && ($this->getCurrPeerInstance()->ifHelloReceived()) && (!$this->getCurrPeerInstance()->ifELHOsent())) { + // Is the master hub so authorize the peer here... + $this->getCurrPeerInstance()->enableIsAuthorized(); + $this->authPeers->append($this->getCurrPeerInstance()); + + // Reply the HELLO request + $this->getCurrPeerInstance()->replyHelloMessage(); + } + } // END - if + } // END - for + } // END - if + } + + /** + * Handles only authorized peers + * + * @return void + */ + public function handleAuthPeers () { + // Are there some peers? + if (($this->connectedPeers->count() > 1) && ($this->authPeers->count() > 0)) { + // Iterate through all connected peers + for ($idx = $this->authPeers->getIterator(); $idx->valid(); $idx->next()) { + // Get current peer + $this->lastPeerInstance = $idx->current(); + + // Do the ping and update our authPeer list (LATER!) + $this->lastPeerInstance->handlePingPeer(); + } // END - for + } // END - for + } + + /** + * Setup the hub: Create a socket for listening on incoming requests, + * try to bind to a port, etc. + * + * @return void + * @throws SocketCreationException If a socket cannot be created + * @throws SocketSetupException If a socket cannot be setuped + * @throws SocketBindException If a socket cannot be bind to + * an address and port + * @throws SocketListeningException If listening to a socket fails + */ + private final function setupHub () { + // Create a new TCP socket + $main_socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + + // Was it a success? + if (!is_resource($main_socket)) { + // This fails! :( + throw new SocketCreationException( + array( + 'this' => $this, + 'code' => socket_last_error() + ), self::EXCEPTION_SOCKET_PROBLEM + ); + } + + // Set socket options + if (!socket_set_option($main_socket, SOL_SOCKET, SO_REUSEADDR, 1)) { + // Close the socket + $this->closeSocket($main_socket); + + // Problems setting socket options + throw new SocketSetupException ( + array( + 'this' => $this, + 'code' => socket_last_error() + ), self::EXCEPTION_SOCKET_PROBLEM + ); + } + + // Set to non-blocking + socket_set_nonblock($main_socket); + + // Bind the socket to an address + if (!socket_bind($main_socket, $this->getConfigInstance()->readConfig("hub_listen_addr"), $this->getConfigInstance()->readConfig("hub_listen_port"))) { + // Bind failed + throw new SocketBindException ( + array( + 'this' => $this, + 'host' => $this->getConfigInstance()->readConfig("hub_listen_addr"), + 'port' => $this->getConfigInstance()->readConfig("hub_listen_port"), + 'code' => socket_last_error() + ), self::EXCEPTION_SOCKET_PROBLEM + ); + } + + // Listen to ... the socket ;-) + if (!socket_listen($main_socket)) { + // Opps, that didn't work. Next time better listen to your heart... Roxette + throw new SocketListeningException( + array( + 'this' => $this, + 'code' => socket_last_error() + ), self::EXCEPTION_SOCKET_PROBLEM + ); + } + + // Ignore user abort and do not time out + @set_time_limit(0); + @ignore_user_abort(true); + + // Cache more configuration stuff + $this->authRetries = $this->getConfigInstance()->readConfig("hub_max_auth_tries"); + $this->authRequest = $this->getConfigInstance()->readConfig("hub_auth_request"); + $this->authRequestTimeout = $this->getConfigInstance()->readConfig("hub_auth_request_timeout"); + + // The hub is running now! + $this->hubActivated = true; + + // Append the main hub + $this->main_socket = $main_socket; + $this->connectedPeers->append($main_socket); + } + + /** + * Removes the current peer from the list + * + * @return void + */ + public final function removePeerFromConnectList () { + // Iterate through all connected peers + for ($idx = $this->connectedPeers->getIterator(); $idx->valid(); $idx->next()) { + // Get current peer from list + $peer = $idx->current(); + + // Is it a peer instance? + if (($peer !== $this->main_socket) && (is_object($peer)) && ($peer instanceof HubPeer)) { + // Okay, we have a peer instance so is it the same? + if ($this->getCurrPeerInstance()->equals($peer)) { + // Remove him! + $idx->offsetUnset($idx->key()); + $this->lastPeerInstance = null; + break; + } + } + } + } + + /** + * Getter for console output handler + * + * @return $outputInstance An instance of the output handler + */ + public final function getOutputInstance () { + return $this->outputInstance; + } + + /** + * Setter for console output handler + * + * @param $outputInstance An instance of the output handler + */ + public final function setOutputInstance ($outputInstance) { + $this->outputInstance = $outputInstance; + } + + /** + * Getter for current peer instance to HubPeer class + * + * @return $lastPeerInstance Last peer instance + */ + public final function getCurrPeerInstance () { + return $this->lastPeerInstance; + } + + /** + * Setter for current peer instance to HubPeer class + * + * @param $lastPeerInstance Last peer instance + * @return void + */ + public final function setCurrPeerInstance (HubPeer $lastPeerInstance) { + $this->lastPeerInstance = $lastPeerInstance; + } + + /** + * Checks wether the hub is running and not in shutdown phase + * + * @return $isRunning If the hub is running and not in shutdown phase + */ + public function ifHubIsRunning () { + return ((($this->hubActivated) || (!$this->hubShutsDown)) && ($this->connectedPeers->count() > 0)); + } + + /** + * Output the intro text + * + * @return void + */ + public final function outputIntro () { + if ($this->getConfigInstance()->readConfig("hub_intro_enabled") == "Y") { + // Output intro text + $this->getOutputInstance()->output(sprintf("%s v%s Copyright (c) 2007, 2008 by Roland Häder", + ApplicationHelper::getInstance()->getAppName(), + ApplicationHelper::getInstance()->getAppVersion() + )); + $this->getOutputInstance()->output(""); + $this->getOutputInstance()->output("This software is free software licensed under the GNU GPL. In telnet session enter "/license" to read the license."); + $this->getOutputInstance()->output("This software uses the MXChange Framework, Copyright (c) 2007, 2008 by Roland Häder which is licensed under the GNU GPL."); + $this->getOutputInstance()->output("Enter "/framework" in telnet session to read that license."); + $this->getOutputInstance()->output(""); + $this->getOutputInstance()->output("All core systems are initialized. Input on *this* console will currently be ignored!"); + $this->getOutputInstance()->output(""); + $this->getOutputInstance()->output(sprintf("[%s] Listening on: %s:%d", + $this->__toString(), + $this->getConfigInstance()->readConfig("hub_listen_addr"), + $this->getConfigInstance()->readConfig("hub_listen_port") + )); + $this->getOutputInstance()->output("----------------------------------------------------------------------------------------------------------------------------"); + } + } + + /** + * Do the main loop + * + * @return void + * @throws SocketCreationException If the main socket is not a resource + */ + public function coreLoop () { + // Is the main socket vailid? + if (!is_resource($this->main_socket)) { + // Is not valid! + throw new SocketCreationException( + array( + 'this' => $this, + 'code' => socket_last_error() + ), self::EXCEPTION_SOCKET_PROBLEM + ); + } // END - if + + // We are ready to serve requests + $this->getOutputInstance()->output(sprintf("[%s] Ready to serve requests.", + $this->__toString() + )); + + // Wait until the hub is shutting down + while ($this->ifHubIsRunning()) { + // Get number of total connected peers + $num = $this->getTotalConnectedPeers(); + + try { + // Handle the master hub connection + if ($this->masterConnector instanceof HubConnector) { + $this->masterConnector->handleMasterRequests(); + } + + // Check for unauthorized peers + $this->handleUnauthPeers(); + + // Handle authorized peers + $this->handleAuthPeers(); + } catch (HubPeerAuthorizationException $e) { + // Authorization has failed + $this->disconnectPeerWithReason("hub_msg_auth_tries"); + + // Get new total connected peers + $num = $this->getTotalConnectedPeers(); + } catch (HubPeerTimeoutException $e) { + // Disconnect and remove the peer + $this->disconnectPeerWithReason("hub_msg_auth_reply_timeout"); + + // Get new total connected peers + $num = $this->getTotalConnectedPeers(); + } catch (HubMasterDisconnectedException $e) { + // The master hub has disconnected us... :( + $this->masterConnector = null; + $this->getOutputInstance()->output(sprintf("[%s] The master has disconnected us. Reason given: %s", + $this->__toString(), + $e->getMessage() + )); + } catch (BrokenPipeException $e) { + // Broken pipes are bad for us... :( + $this->removePeerFromConnectList(); + $this->getOutputInstance()->output(sprintf("[%s] A peer has closed the connection unexpected: %s", + $this->__toString(), + $e->getMessage() + )); + + // Get new total connected peers + $num = $this->getTotalConnectedPeers(); + } catch (FrameworkException $e) { + // Catch all other exceptions and output them + echo "CATCH".__LINE__.":".$e->__toString()."\n"; + hub_exception_handler($e); + + // Get new total connected peers + $num = $this->getTotalConnectedPeers(); + } + + // Are there some peers? + if ($num < 1) { + // Wait for more peers + continue; + } // END - if + + // A new peer has connected + $this->getOutputInstance()->output(sprintf("[%s] A new peer is connecting.", + $this->__toString() + )); + + try { + // Check for new peers + $this->handleNewPeers(); + } catch (IPSpoofingException $e) { + // Output message + $this->getOutputInstance()->output(sprintf("[%s] The peer's IP number has changed!", + $this->__toString() + )); + + // Output debug message + $this->getDebugInstance()->output(sprintf("[%s] Peer spoofes IP number: %s", + $this->__toString(), + $e->getMessage() + )); + + // Disconnect the peer first + $this->disconnectPeerWithReason("hub_msg_spoofing"); + + // Get new total connected peers + $num = $this->getTotalConnectedPeers(); + } catch (FrameworkException $e) { + // Catch all exceptions and output them to avoid aborting the program unexpectly + echo "CATCH".__LINE__.":".$e->__toString()."\n"; + hub_exception_handler($e); + + // Get new total connected peers + $num = $this->getTotalConnectedPeers(); + } + + } // END - while + } + + /** + * Tries to contact the master server or simply reports that we are the master server + * + * @return void + */ + public function contactMasterHub () { + // Checks wether we are the master hub + if ($_SERVER['SERVER_ADDR'] == $this->getConfigInstance()->readConfig("hub_master_ip")) { + // We are master! + $this->hubIsMaster = true; + $this->getOutputInstance()->output(sprintf("[%s] Our IP %s matches the master IP. Becoming master hub...", + $this->__toString(), + $_SERVER['SERVER_ADDR'] + )); + } else { + // A regular hub or ultra hub so let's contact the master + $this->getOutputInstance()->output(sprintf("[%s] Contacting the master hub at %s:%d...", + $this->__toString(), + $this->getConfigInstance()->readConfig("hub_master_ip"), + $this->getConfigInstance()->readConfig("hub_master_port") + )); + + // Try to aquire a connection to the master... + try { + // Announce us to the master hub + $this->announceToMasterHub(); + } catch (FrameworkException $e) { + // Catch all exceptions and output them + echo "CATCH".__LINE__.":".$e->__toString()."\n"; + hub_exception_handler($e); + } + } // END - else + } + + /** + * Disconnects the current with a configurable reason + * + * @param $reasonEntry The entry with the disconnection reason aka. message to the peer + * @return void + */ + public function disconnectPeerWithReason ($reasonEntry) { + $ip = "0.0.0.0"; + + // Try to disconnect here + try { + // First get the raw IP number + $ip = $this->getCurrPeerInstance()->getValidatedIP(); + + // Disconnect the peer... + $this->getCurrPeerInstance()->disconnectWithReason($this->getConfigInstance()->readConfig($reasonEntry)); + } catch (FrameworkException $e) { + // Catch all exceptions and output them + echo "CATCH".__LINE__.":".$e->__toString()."\n"; + hub_exception_handler($e); + } + + // Remove him from the list anyway + $this->removePeerFromConnectList(); + + // Output the message + $this->getOutputInstance()->output(sprintf("[%s] Peer %s has been disconnected.", + $this->__toString(), + $ip + )); + } + + /** + * Announces this hub to the master hub. This is being done by connecting to it and asking for auth request + * + * @return void + */ + public function announceToMasterHub () { + try { + // Create a new instance for communicating to the master hub + $this->masterConnector = HubConnector::createHubConnectorByAddressPort( + $this->getConfigInstance()->readConfig("hub_master_ip"), + $this->getConfigInstance()->readConfig("hub_master_port"), + $this + ); + + // Send all our accepted objects to the master hub + $this->masterConnector->sendAllAcceptedObjects(); + } catch (SocketConnectException $e) { + // The master hub is down! + ApplicationEntryPoint::app_die($e->getMessage()); + } + } + +} // END - class + +// [EOF] +?> diff --git a/application/hub/main/class_HubPeer.php b/application/hub/main/class_HubPeer.php new file mode 100644 index 000000000..a457b1e1a --- /dev/null +++ b/application/hub/main/class_HubPeer.php @@ -0,0 +1,656 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubPeer extends BaseFrameworkSystem { + /** + * This peer's socket resource + */ + private $peerSocket = null; + + /** + * Timestamp for connection + */ + private $connectTime = 0; + + /** + * Timestamp of last received message + */ + private $lastReceivedMessageStamp = 0; + + /** + * Last received message + */ + private $lastReceivedMessage = ""; + + /** + * Timestamp of last sent message + */ + private $lastSentMessageStamp = 0; + + /** + * Last sent message + */ + private $lastSentMessage = ""; + + /** + * Number of tries for authorization + */ + private $authRetries = 0; + + /** + * Wether the peer is authorized (DO NEVER SET THIS TO "true"!) + */ + private $isAuthorized = false; + + /** + * Wether this peer needs to be requested for the AUTH command + */ + private $needAuthRequest = true; + + /** + * The peer's IP number + */ + private static $peerIP = "0.0.0.0"; + + /** + * Wether the peer has "hello-ed" to the other + */ + private $helloSent = false; + + /** + * Wether the peer has replied our HELLO + */ + private $helloReplied = false; + + /** + * Wether we have sent our ELHO + */ + private $elhoSent = false; + + /** + * An instance of HubCoreLoop + */ + private $hubInstance = null; + + /** + * When the last ping was + */ + private $lastPinged = 0; + + /** + * When the last pong was + */ + private $lastPonged = 0; + + /** + * Number of missing pongs from the other peer + */ + private $missingPongs = 0; + + /** + * An instance of a HubCommandProcessor class + */ + private $commandInstance = null; + + /** + * A queue for reading data in non-blocking mode + */ + private $queues = ""; + + /** + * Line ends + */ + const LINE_END = "\n"; + + //---------------------------------------------------------- + // Exceptions + //---------------------------------------------------------- + const EXCEPTION_PEER_SOCKET_INVALID = 0x200; + const EXCEPTION_PEER_IP_CHANGED = 0x201; + const EXCEPTION_PEER_SOCKET_BROKEN = 0x202; + //---------------------------------------------------------- + + /** + * The private constructor + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Hub-Peer"); + + // Set unique ID + $this->createUniqueID(); + + // Tidy up a little + $this->removeSystemArray(); + $this->removeNumberFormaters(); + + // Get a command processor + $this->commandInstance = HubCommandProcessor::createHubCommandProcessor($this); + } + + /** + * Creates an instance of a HubPeer by a provided valid socket resource + * + * @param $peerSocket The socket resource for the peer + * @param $hubInstance An instance of HubCoreLoop + * @return $peerInstance An instance of HubPeer + */ + public final static function createHubPeerBySocket ($peerSocket, HubCoreLoop $hubInstance) { + // Get a new instance + $peerInstance = new HubPeer(); + + // Is the peer socket fine? + if (!is_resource($peerSocket)) { + // There is a problem with the socket + throw new PeerSocketException ( + array( + 'this' => $peerInstance, + 'type' => gettype($peerSocket) + ), self::EXCEPTION_PEER_SOCKET_INVALID + ); + } + + // Set the socket + $peerInstance->setPeerSocket($peerSocket); + + // Set connection timestamp + $peerInstance->setConnectionTimestamp(); + + // Set the hub instance + $peerInstance->setHubInstance($hubInstance); + + // Return the instance + return $peerInstance; + } + + //---------------------------------------------------------- + // Public getter/setter + //---------------------------------------------------------- + + /** + * Setter for peer socket + * + * @param $peerSocket The peer's socket + * @return void + */ + public final function setPeerSocket ($peerSocket) { + if (is_resource($peerSocket)) { + $this->peerSocket = $peerSocket; + } else { + $this->peerSocket = null; + } + } + + /** + * Setter for connection timestamp only once + * + * @return void + */ + public final function setConnectionTimestamp () { + if ($this->connectTime == 0) $this->connectTime = time(); + } + + /** + * Getter for a raw IP number + * + * @return $ip The peer's IP number + * @throws BrokenPipeException If a socket has lost its connection to the peer + */ + public final function getRawIP () { + if (is_resource($this->peerSocket)) { + // Get IP from socket + @socket_getpeername($this->peerSocket, $ip); + + // Connection problems? + if (socket_last_error() > 0) { + // Throw an exception + throw new BrokenPipeException( + array( + 'this' => $this, + 'code' => socket_last_error() + ), self::EXCEPTION_PEER_SOCKET_BROKEN + ); + } + } else { + // Without a socket we cannot determine the right IP + $ip = "0.0.0.0"; + } + + // And return it... + return $ip; + } + + /** + * Getter for a validated peer IP + * + * @return $peerIP The peer's IP number + */ + public final function getValidatedIP() { + // Is the socket valid and IP not set? + if ((is_resource($this->peerSocket)) && (socket_last_error() == 0) && (self::$peerIP == "0.0.0.0")) { + // Get peer's IP number + self::$peerIP = $this->getRawIP(); + } elseif ((is_resource($this->peerSocket)) && (socket_last_error() == 0)) { + // Get current raw IP number for validation + $ip = $this->getRawIP(); + + // Check if the IP has changed + if ($ip !== self::$peerIP) { + // The IP number has changed! + throw new IPSpoofingException( + array( + 'this' => $this, + 'old_ip' => self::$peerIP, + 'new_ip' => $ip + ), self::EXCEPTION_PEER_IP_CHANGED + ); + } + } + + return self::$peerIP; + } + + /** + * Getter for number of authorization tries + * @return $authRetries Authorization tries + */ + public final function getAuthRetries () { + return $this->authRetries; + } + + //---------------------------------------------------------- + // Public methods + //---------------------------------------------------------- + + /** + * Setter for HubCoreLoop instances + * + * @param $hubInstance An instance of a HubCoreLoop class + * @return void + */ + public final function setHubInstance(HubCoreLoop $hubInstance) { + $this->hubInstance = $hubInstance; + } + + /** + * Getter for HubCoreLoop instances + * + * @return $hubInstance An instance of a HubCoreLoop class + */ + public final function getHubInstance() { + return $this->hubInstance; + } + + /** + * Getter for last sent message timestamp + * + * @return $lastSentMessageStamp Timestamp of last sent message + */ + public final function getLastSentMessageStamp () { + return $this->lastSentMessageStamp; + } + + /** + * Getter for last sent message + * + * @return $lastSentMessage Last sent message to this peer + */ + public final function getLastSentMessage () { + return $this->lastSentMessage; + } + + /** + * Determines wether the peer is authorized + * + * @return void + */ + public final function ifPeerIsAuthorized () { + return (($this->isAuthorized === true) && ($this->ifPeerNeedsAuthRequest() === false)); + } + + /** + * Returns wether this peer needs to receive the AUTH command + */ + public final function ifPeerNeedsAuthRequest () { + return $this->needAuthRequest; + } + + /** + * Disconnects the peer with a special reason (status) + * + * @param $reason The special reason + * @return void + */ + public final function disconnectWithReason ($reason) { + // Is the message set? + if (!empty($reason)) { + // Send the given message + $this->sendMessage($reason); + } else { + // Send default "good bye" + $this->sendMessage($this->getConfigInstance()->readConfig("hub_msg_bye")); + } + + // Disconnect the client + socket_shutdown($this->peerSocket, 2); + socket_close($this->peerSocket); + } + + /** + * Sends a specified message to the peer's socket + * + * @param $message The special message + * @return void + * @throws BrokenPipeException If a pipe to a socket peer is lost + */ + public final function sendMessage ($message) { + if (empty($message)) { + // Set default message + $message = $this->getConfigInstance()->readConfig("hub_msg_bye"); + } + + // Debug message + $this->getDebugInstance()->output(sprintf("[%s] Sending message \"%s\" to peer %s.
\n", + __METHOD__, + $message, + $this->getValidatedIP() + )); + + // Send it to the peer + if (socket_write($this->peerSocket, $message."\n") !== false) { + // Set the timestamp and message + $this->lastSentMessage = $message; + $this->lastSentMessageStamp = time(); + } else { + // Message could not be sent + throw new BrokenPipeException ( + array( + 'this' => $this, + 'code' => socket_last_error() + ), self::EXCEPTION_PEER_SOCKET_BROKEN + ); + } + } + + /** + * Asks the connected new peer for the authorization key + * + * @return void + */ + public final function askAuthorizationKey () { + if ($this->ifPeerNeedsAuthRequest()) { + // This peer needs to receive the AUTH command so send it to him + $this->sendMessage($this->getConfigInstance()->readConfig("hub_auth_request")); + + // Set it to done + $this->needAuthRequest = false; + } + } + + /** + * Determines wether the peer is a local admin (localhost connection) + * + * @return $isLocalAdmin Wether the peer is a local admin + */ + public function ifPeerIsLocalAdmin () { + // Get the remote IP and extract only the first three numbers + $remoteArray = explode(".", self::$peerIP); + + // Is the peer a local admin? + return (($remoteArray[0].".".$remoteArray[1].".".$remoteArray[2]) == "127.0.0"); + } + + /** + * Enables the local admin and authorizes this peer + * + * @return void + */ + public function enableLocalAdmin() { + // Is this IP really local? + if (($this->ifPeerIsLocalAdmin()) && (!$this->ifPeerIsAuthorized())) { + // Then authorize him + $this->isAuthorized = true; + $this->needAuthRequest = false; + } // END - if + } + + /** + * Says "hi" to the local admin + * + * @return void + */ + public function sayHi2Admin () { + // Send a message to him... ;-) + $this->sendMessage("Local admin console is ready. Enter HELP for instructions."); + } + + /** + * Enables wether the peer is authorized + * + * @param $isAuthValid Wether the authorization wents fine + * @return void + */ + public function enableIsAuthorized ($isAuthValid = true) { + $this->isAuthorized = true; + } + + /** + * Checks wether a HELLO has been sent and if not it will be send to the other peer + * + * @return $helloSent Wether a HELLO has been sent + */ + public function ifHelloReceived () { + // HELLO has been sent? + if (!$this->helloSent) { + // Read some data + $read = $this->readFromSocket(); + + // Is this a HELLO? + if ($read == $this->getConfigInstance()->readConfig("hub_peer_hello")) { + // All right! A HELLO has been received + $this->helloSent = true; + $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Peer %s said HELLO to us.", + __METHOD__, + $this->getValidatedIP() + )); + } // END - if + } // END - if + + // Return status + return $this->helloSent; + } + + /** + * Wether this hub has replied our HELLO request + * + * @return $helloReplied Wether this hub has replied our HELLO request + */ + public function ifHelloReplied () { + if ((!$this->helloReplied) && ($this->lastSentMessage == $this->getConfigInstance()->readConfig("hub_peer_hello"))) { + // Read some data + $read = $this->readFromSocket(); + + // Is this a HELLO? + if ($read == $this->getConfigInstance()->readConfig("hub_hello_reply")) { + // Is this the master IP? + if ($this->getValidatedIP() == $this->getConfigInstance()->readConfig("hub_master_ip")) { + // All right! A HELLO has been received + $this->helloReplied = true; + $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] The master hub at %s:%d replied our %s.", + __METHOD__, + $this->getValidatedIP(), + $this->getConfigInstance()->readConfig("hub_master_port"), + $this->getConfigInstance()->readConfig("hub_peer_hello") + )); + } else { + // ELHOs from non-masters are not valid! + $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Peer %s replied our %s but is not the master hub!", + __METHOD__, + $this->getValidatedIP(), + $this->getConfigInstance()->readConfig("hub_peer_hello") + )); + } + } // END - if + } // END - if + + // Return status + return $this->helloReplied; + } + + /** + * Returns wether a ELHO (HELLO reply has been sent) + * + * @return $elhoSent Wether a ELHO has been sent to the peer + */ + public final function ifELHOsent () { + return $this->elhoSent; + } + + /** + * Replies a HELLO message with a ELHO message + * + * @return void + */ + public function replyHelloMessage () { + $this->sendMessage($this->getConfigInstance()->readConfig("hub_hello_reply")); + $this->elhoSent = true; + } + + /** + * Handles pinging this peer + * + * @return void + */ + public function handlePingPeer () { + $lost = false; + + // Do we need to ping? + if ((time() - $this->lastPinged) > $this->getConfigInstance()->readConfig("hub_ping_timeout")) { + // Don't ping any masters! ;-) + if ($this->getValidatedIP() != $this->getConfigInstance()->readConfig("hub_master_ip")) { + // Debug message + $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Sending ping to peer %s...", + $this->__toString(), + $this->getValidatedIP() + )); + + // Send out a PING and await a PONG + $this->commandInstance->simpleExecute( + $this->getConfigInstance()->readConfig("hub_peer_ping"), + $this->getConfigInstance()->readConfig("hub_ping_reply") + ); + + // PONG received within last ping? + if (($this->lastPonged < time()) && (($this->lastPonged - $this->lastPinged) < 0)) { + // Not replied so far + $this->missingPongs++; + + // Debug message + $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Ping not replied! Try: %d", + $this->__toString(), + $this->missingPongs + )); + + // Limit reached? + if ($this->missingPongs == $this->getConfigInstance()->readConfig("hub_ping_maxdrops")) { + // This peer is lost + $this->getHubInstance()->disconnectPeerWithReason("hub_peer_miss_pong"); + $lost = true; + } // END - if + } // END - if + + // Last time we pinged is now. + $this->lastPinged = time(); + + } // END - if + } // END - if + + // Connection is lost? + if ($lost === true) return false; + + // Awaiting PONG here + if ($this->commandInstance->ifAwaitsCommand($this->getConfigInstance()->readConfig("hub_ping_reply"))) { + // PONG received! :-) So reset all counters... + $this->lastPonged = time(); + $this->missingPongs = 0; + + // Notify the loop about the ping-pong-time + $this->getHubInstance()->updatePeerEntry($this, (time() - $this->lastPinged)); + } // END - if + } + + /** + * Handles any incoming commands from the master hub + * + * @return void + */ + public function handleMasterRequests () { + // Read the raw socket for data packages + if ($this->commandInstance->awaitAnyCommand()) { + // A command has been received from the master hub + $command = $this->commandInstance->pull(); + + // TODO Handle a command from the master here... + } // END - if + } + + /** + * Reads raw data from the socket and trims leading/trailing spaces away. + * Returns an empty string if no data has been received. + * + * @return $data Raw data from the underlaying socket + * @throws BrokenPipeException If a socket has lost its connection to the peer + */ + public function readFromSocket () { + $data = ""; + $read = array($this->peerSocket); + $write = null; + $except = null; + $num = socket_select($read, $write, $except, 0); + if ($num > 0) { + // Something has changed on a socket + foreach ($read as $socket) { + if (is_resource($socket)) { + $data = trim(@socket_read($socket, 1024, PHP_NORMAL_READ)); + if (socket_last_error() > 0) { + // Throw an exception + throw new BrokenPipeException( + array( + 'this' => $this, + 'code' => socket_last_error() + ), self::EXCEPTION_PEER_SOCKET_BROKEN + ); + } + break; + } // END - if + } // END - foreach + } // END - if + return $data; + } + +} // END - class + +// [EOF] +?> diff --git a/application/hub/middleware/.htaccess b/application/hub/middleware/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/middleware/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/starter.php b/application/hub/starter.php new file mode 100644 index 000000000..286e2b881 --- /dev/null +++ b/application/hub/starter.php @@ -0,0 +1,82 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// 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 %s kann nicht gestartet werden, da die Hilfsklasse %s nicht geladen ist!", + $application, + FrameworkConfiguration::getInstance()->readConfig("app_helper_class") + )); +} elseif (!is_object($app)) { + // No object! + ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die 'app' kein Objekt ist!", + $application + )); +} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) { + // Method not found! + ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die Methode %s fehlt!", + $application, + FrameworkConfiguration::getInstance()->readConfig("entry_method") + )); +} + +// Call the entry point method +try { + $eval = sprintf("%s::getInstance()->%s();", + FrameworkConfiguration::getInstance()->readConfig("app_helper_class"), + FrameworkConfiguration::getInstance()->readConfig("entry_method") + ); + eval($eval); +} catch (SocketCreationException $e) { + // Problems while creating sockets + ApplicationEntryPoint::app_die(sprintf("[Main:] Das Hub konnte nicht initialisiert werden. Reason: %s, Code: %s", + $e->getMessage(), + $e->getHexCode() + )); +} catch (SocketSetupException $e) { + // Problems while setting up sockets + ApplicationEntryPoint::app_die(sprintf("[Main:] Das Hub konnte nicht initialisiert werden. Reason: %s, Code: %s", + $e->getMessage(), + $e->getHexCode() + )); +} catch (SocketBindException $e) { + // Problems while binding to address/port + ApplicationEntryPoint::app_die(sprintf("[Main:] Das Hub konnte nicht initialisiert werden. Reason: %s, Code: %s", + $e->getMessage(), + $e->getHexCode() + )); +} catch (SocketListeningException $e) { + // Problems while starting listen to the socket + ApplicationEntryPoint::app_die(sprintf("[Main:] Das Hub konnte nicht initialisiert werden. Reason: %s, Code: %s", + $e->getMessage(), + $e->getHexCode() + )); +} + +// [EOF] +?> diff --git a/chat-server.php b/chat-server.php new file mode 100644 index 000000000..8c0afd8f1 --- /dev/null +++ b/chat-server.php @@ -0,0 +1,164 @@ + 0) { + // create a copy, so $clients doesn't get modified by socket_select() + $read = $clients; + + // get a list of all the clients that have data to be read from + // if there are no clients with data, go to next iteration + $left = @socket_select($read, $write = null, $except = null, 0); + if ($left < 1) { + continue; + } + + // check if there is a client trying to connect + if (in_array($main_sock, $read)) { + // accept the client, and add him to the $clients array + $new_sock = socket_accept($main_sock); + $clients[] = $new_sock; + + // send the client a welcome message + socket_write($new_sock, "no noobs, but ill make an exception :)\n". + "There are ".(count($clients) - 1)." client(s) connected to the server\n"); + + socket_getpeername($new_sock, $ip); + print "[".date("m/d/Y:H:i:s", time())."]:New client connected: {$ip}\n"; + + // Notify all chatter + if (count($clients) > 2) { + foreach ($clients as $send_sock) { + if ($send_sock != $main_sock && $send_sock != $new_sock) { + socket_write($send_sock, "Server: Chatter has joined from {$ip}. There are now ".(count($clients) - 1)." clients.\n"); + } + } + } + + // remove the listening socket from the clients-with-data array + $key = array_search($main_sock, $read); + unset($read[$key]); + } + + // loop through all the clients that have data to read from + foreach ($read as $read_sock) { + // Get client data + socket_getpeername($read_sock, $ip); + + // read until newline or 1024 bytes + // socket_read while show errors when the client is disconnected, so silence the error messages + $data = @socket_read($read_sock, 1024, PHP_NORMAL_READ); + + // check if the client is disconnected + if (($data === false) || (in_array(strtolower(trim($data)), $leaving))) { + + // remove client for $clients array + $key = array_search($read_sock, $clients); + unset($clients[$key]); + print "[".date("m/d/Y:H:i:s", time())."]:Client from {$ip} disconnected. Left: ".(count($clients) - 1)."\n"; + + // Notify all chatter + if (count($clients) > 1) { + foreach ($clients as $send_sock) { + if ($send_sock != $main_sock) { + socket_write($send_sock, "Server: Chatter from {$ip} has logged out. ".(count($clients) - 1)." left.\n"); + } + } + } + + // continue to the next client to read from, if any + socket_write($read_sock, "Server: Good bye.\n"); + socket_shutdown($read_sock, 2); + socket_close($read_sock); + continue; + } elseif (in_array(trim($data), $shutdown)) { + // Is he allowed to shutdown? + if (!in_array($ip, $masters)) { + print "[".date("m/d/Y:H:i:s", time())."]:Client $ip has tried to shutdown the server!\n"; + socket_write($read_sock, "Server: You are not allowed to shutdown the server!\n"); + $data = ""; + continue; + } + + // Close all connections a leave here + foreach ($clients as $client) { + // Send message to client + if ($client !== $main_sock && $client != $read_sock) { + socket_write($client, "Server: Shutting down! Thank you for joining us.\n"); + } + + // Quit him + socket_shutdown($client, 2); + socket_close($client); + } // end foreach + + // Leave the loop + $data = ""; + $clients = array(); + continue; + } + + // trim off the trailing/beginning white spaces + $data = trim($data); + + // Test for HTML codes + $tags = strip_tags($data); + + // check if there is any data after trimming off the spaces + if (!empty($data) && $tags == $data && count($clients) > 2) { + // send this to all the clients in the $clients array (except the first one, which is a listening socket) + foreach ($clients as $send_sock) { + + // if its the listening sock or the client that we got the message from, go to the next one in the list + if ($send_sock == $main_sock || $send_sock == $read_sock) + continue; + + // write the message to the client -- add a newline character to the end of the message + socket_write($send_sock, "{$ip}:{$data}\n"); + + } // end of broadcast foreach + + // Send confirmation to "chatter" + socket_write($read_sock, "\nServer: Message accepted.\n"); + } elseif ($tags != $data) { + // HTML codes are not allowed + print "[".date("m/d/Y:H:i:s", time())."]:Client $ip has entered HTML code!\n"; + socket_write($read_sock, "Server: HTML is forbidden!\n"); + } elseif ((count($clients) == 2) && ($read_sock != $main_sock)) { + // No one else will hear the "chatter" + print "[".date("m/d/Y:H:i:s", time())."]:Client $ip speaks with himself.\n"; + socket_write($read_sock, "Server: No one will hear you!\n"); + } + } // end of reading foreach +} + +// close the listening socket +socket_close($main_sock); + +?> + \ No newline at end of file diff --git a/db/.htaccess b/db/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/db/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized b/db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized new file mode 100644 index 000000000..d85d24448 --- /dev/null +++ b/db/SimulatorPersonell/829292aeca3f6bf78c16e25fc4f75c98.serialized @@ -0,0 +1,34 @@ +@head^bz2:1178796141:1228:3bebdff2daf556f5af817a497d493f34 +@data^QlpoMTFBWSZTWZgImj4ACrVfgEAAEAV/+H0myAA///+6YAZ/E2:5581c6b3b029958dae7cbf33fca76967 +@data^ugGFsdJ1Z3sACEpGkGSbFPSaTYggBoAAGRMhoAqo9T1MmIwg0Z:5607b07fa186c7511760cde9d53f3275 +@data^MEYEommptFT9SGhiDIAYmCA0GnqqMhoAMhoDEaaaGjBAwGgNAA:6928989225a72071a456b166db9f6f90 +@data^BpoNANAGgKUoiY1MKaENpqZMQGgDI0wUPp7yfEmEWCYJgmE8BK:bbe0172461a813858519f7afb62d8234 +@data^fEn8/3u/ET/SfEq1JoTP8J3EwTCd4nwPcYzMzMszzE7xMuemLb:b35a8e5c41c5f5d08a5361fc97baa55b +@data^ttTpZZtObRjF6wQ2ZAhtQEEoAhGF3JvDhf48qEp0dg4veAhIBC:1df972fa2c3fec9564a68ac8661a6e0a +@data^sZqYCA1Vi4EMF5ztzLN4umJCMJgXtzLF1UohqhBGt2domt5Ln0:88bef013bf1f36f05b73fb313176e409 +@data^qSnThz1SaiYVciY55Mcubprt16cs4cNRaXZ5uaUzKQ3Fb6vneK:e634054c76ae06816ae3b233c7d28ae1 +@data^Rrdc5M6VkASW7sAjjC4oqmLFe/NjOVZD3hAQikgEIYdgQ572YE:0d84f5e53c203deac2bd44140e48ab63 +@data^JytasASUfOVIJKBkQWFg1qZpbLbTiWrEtZ1SfXzTWLceHveZBJ:1007b2f29136efbee8eaf8771e640208 +@data^5wAhEQjXO9zrGhrk1uzbvXOm0ARyglumIvxrIKPmiUF0QuYSta:01f9da46a20238dd8589aa8ea4bc5b7e +@data^YxGLd3Wz7fHb8WUY6r1XetNN7hMdpLSdhBJrXlxaXWfe5kzVam:e2091b0f8140e70861ddfc7155282762 +@data^pztsZRcYktlGopu7OczRWVLSvDSsh3dA+r55tuxjkc0z8VttOk:2c8174bdf3b35b03ade696125e83a1a2 +@data^YaMUk0clfFpCiTn3Fx3eeSBBHYRVUKqmmmbmXjPa2Zpyq17apV:76c9ed1af8d1f8b82b87b7604395ceaf +@data^2NEALRmQPYitiCS5BGkQ5Ns0TkWDQycAIcAkoTYTiJ2JqTQmhN:2d86f3f20df17c5750842af805e1b3f1 +@data^5ME3BZhbtdxOwm4ndx8hP2dqHgTQa49JMP0JqTSphMYVa6b5u1:20fd20fcc7fcc8fcd700d4d653db1129 +@data^10y3FXXSaCZhKZZiyTCddtidO4V2Rs78K8h2q8UpqyEAkAIAXA:5c70011a8022bab8809cdc4011e1170d +@data^QIhBDstSTMxgzMUiRNxavMhZSidoZyk7ACEUweVl022zN/HXXl:3944662c0c44cb012abb2009e22d4967 +@data^pu22JyJkq8SfAUP40JT3e9k95MrRmMxZlllmNSfz8SfcTlGEXk:466c0587fd6e5275d57d2ceca68ebea3 +@data^TfqX5Sd/LYq4EpvRLgQEnFmvdp0bMaqlxdpuwpxvyHwsqt5LgA:8718e937e6cecd59ceb00f76417fd346 +@data^iAKQ42adenp8Sbiewns/Enz3yc5F2J3E4E7if4T2E/UlMJ/2BP:16f7a8958473e3d7623e2e1d6204a368 +@data^WTlw8dfDy678TbXnjuW7LPe2FmlrNW8BCMZum99yyhNqzYS7PM:bc34356080c9564b0c28f9b46f1f2ed1 +@data^BEApGUeOqWEHTYwvs1sLpunXhRY0ao9jwQzBBjgAkAIACIw9+6:c65c6b1e837ca39220db3a4a471791d3 +@data^fm3xheUpUXfbd6steABE/WBBa7yeuV1teFjq6LAEN4IRfUoIbA:db333ee6a1b294b82c906effda88fec2 +@data^QRD84IIPDx1qwxtn54t+XinH8Fw8nZaC4nEqxfQBCRPygEfeT6:48f89cfe3798de4a75b2efc1c3793ecd +@data^+3Xr1J8vfVwJk8N/bntt9UKvgReonyJr0J8vvJ8oVfuTykX1+3:fe7792babc0222e9c6177d0998642183 +@data^p4dvs93lr5dlNEWwrW0skPjZyq1uzeGQELwsGETcEMoICcVVIC:24c80e453bf3b5a5b0670f83e2af4ac8 +@data^BAMhMyAEgZAgZAgQIExl90npJ5ieoJ24yeJPzKvn+fbaRaE4Ew:c1ef03cb2657421ffd2be85f8837fc8d +@data^qWEzCfMn4BNPXCr2k0k+BNSLCegmqoYTUmoT/ZORP43E7iboVb:61ce41972ca02b064f601cfe3cfd8edb +@data^+JNImn6SBhNvQTwKvpIv7J2J1JxJ3E4k5/UTCdCcyrvFD/pF5t:e137b6eb5c1cea22a1a78f100d8d942d +@data^id2hN8i7E/fiTfIGE2KsJzJ0J5E8YJ5EwKsyTmTYnInElOcgeJ:8d2eac349385494deadebd9bf1be57a0 +@data^NCd/6kXqFDiTz9eJNBQ46kWpVoTcTjCbhQ6/QnpCbybiecnq6y:97f3f499c7d2e6f7dbdbfdcb86280a81 +@data^LYnEnKTgTuJ9pF2+dT2+ijB/F3JFOFCQmAiaPg==:670330f69b80a2f2fec8b8bc882521d1 diff --git a/devel/.htaccess b/devel/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/devel/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/devel/class_Debug.php b/devel/class_Debug.php new file mode 100644 index 000000000..1adbe5a70 --- /dev/null +++ b/devel/class_Debug.php @@ -0,0 +1,58 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class Debug { + // Constructor + public function __construct () { + // Konstruktoren debuggen (nur im Zusammenhang mit den folgenden Schaltern effektiv) + // VIELE DEBUG-MELDUNGEN!!! + //define('DEBUG_CONSTRUCT', true); + // eval()-Befehle debuggen + //define('DEBUG_EVAL', true); + // Systeme debuggen + //define('DEBUG_SYSTEM', true); + // SimulatorBase debuggen (VORSICHT! SEHR VIELE DEBUG-MELDUNGEN!!!) + //define('DEBUG_CORE', true); + //////// Objekte debuggen (ausgeben) //////// + // Datenbank-Objekt debuggen + //define('DEBUG_DATABASE_OBJ', true); + //////// Alles unteren debuggen //////// + //define('DEBUG_ALL', true); + // Kompressor debuggen + //define('DEBUG_COMPRESSOR', true); + // Datenbankschichten debuggen + //define('DEBUG_DATABASE', true); + // Template-System debuggen + //define('DEBUG_TEMPLATE', true); + // Konfiguration debuggen + //define('DEBUG_CONFIG', true); + } +} + +/** + * Initialize the dummy debug class + */ +$dummy = new Debug(); +unset($dummy); + +// +?> diff --git a/docs/COPYING b/docs/COPYING new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/docs/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/docs/NEWS b/docs/NEWS new file mode 100644 index 000000000..9ad0e8539 --- /dev/null +++ b/docs/NEWS @@ -0,0 +1,6 @@ +NEWS +==== + +[2008-01-26] +------------ +- First complete SVN import announced diff --git a/docs/README b/docs/README new file mode 100644 index 000000000..f196a1dac --- /dev/null +++ b/docs/README @@ -0,0 +1,4 @@ +README +------ + +This file needs some extending... ;) diff --git a/docs/THANKS b/docs/THANKS new file mode 100644 index 000000000..bd56a2cfa --- /dev/null +++ b/docs/THANKS @@ -0,0 +1,6 @@ +Special Thanks goes to: + - Daff + - toms + - And all the others I have not listed here. + +If you think your name is missing here please ICQ me: 8809296 diff --git a/inc/.htaccess b/inc/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes.php b/inc/classes.php new file mode 100644 index 000000000..64e2bedc5 --- /dev/null +++ b/inc/classes.php @@ -0,0 +1,66 @@ + + * @version 0.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Lower framework classes +$lowerClasses = array( + 0 => "exceptions", // Exceptions + 1 => "interfaces", // Interfaces + 2 => "main", // General main classes + 3 => "middleware" // The middleware +); + +// Load all classes +foreach ($lowerClasses as $class) { + // Try to load the framework classes + try { + ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $class)); + } catch (PathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + $class + )); + } catch (PathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + $class + )); + } catch (PathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + $class + )); + } catch (DirPointerNotOpenedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + $class + )); + } +} + +// Include all classes +ClassLoader::getInstance()->includeAllClasses(); + +// Clean up the global namespace +unset($lowerClasses[3]); // Applications shall not have any middleware +unset($class); + +////// Until here the framework classes are loaded ////// + +// [EOF] +?> diff --git a/inc/classes/.htaccess b/inc/classes/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/.htaccess b/inc/classes/exceptions/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/class_FrameworkException.php b/inc/classes/exceptions/class_FrameworkException.php new file mode 100644 index 000000000..aaab83a9c --- /dev/null +++ b/inc/classes/exceptions/class_FrameworkException.php @@ -0,0 +1,96 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +abstract class FrameworkException extends ReflectionException { + /** + * Array for the backtrace + */ + private $backTrace = array(); + + /** + * The super constructor for all exceptions + * + * @param $message The non-optional message for the exception + * @param $code An optional code for better debugging + * @return void + */ + public function __construct($message, $code = 0) { + // Extract backtrace + $this->saveBackTrace(); + + // Cast all data + $message = (string) $message; + $code = (int) $code; + + // make sure everything is assigned properly + parent::__construct($message, $code); + } + + /** + * Save the current backtrace + * + * @return void + */ + private final function saveBackTrace () { + $this->backTrace = debug_backtrace(); + } + + /** + * Get saved backtrace + * + * @return $backTrace The full backtrace in an array + */ + public final function getBackTrace () { + return $this->backTrace; + } + + /** + * Returns the name of the thrown exception + * + * @return $toString The name of the thrown exception + */ + public function __toString() { + return get_class($this); + } + + /** + * Getter for hex-decimal code + * + * @return $hexCode The exception code in hex-decimal format + */ + public final function getHexCode () { + // Get the decimal code + $code = $this->getCode(); + + // Format it to hex-decimal, 0x as prefix and 3 chars + $hexCode = sprintf("0x%03s", dechex($code)); + + // Return it + return $hexCode; + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/compressor/.htaccess b/inc/classes/exceptions/compressor/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/compressor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php b/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php new file mode 100644 index 000000000..4ff32f072 --- /dev/null +++ b/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php @@ -0,0 +1,54 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class MismatchingCompressorsException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Kompressor %s zu den geladenen Daten aus %s und der aktuell verwendete Kompressor %s stimmen nicht überein!", + $array[0]->__toString(), + $this->getLine(), + strtoupper($array[1]), + sprintf("%s:%s", + basename(dirname($array[2])), + basename($array[2]) + ), + strtoupper($array[3]) + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/container/.htaccess b/inc/classes/exceptions/container/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/container/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php b/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php new file mode 100644 index 000000000..a5e346815 --- /dev/null +++ b/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ContainerItemIsNoArrayException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Ein Container-Item ist kein Array.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/container/class_ContainerItemIsNullException.php b/inc/classes/exceptions/container/class_ContainerItemIsNullException.php new file mode 100644 index 000000000..bffb9b08d --- /dev/null +++ b/inc/classes/exceptions/container/class_ContainerItemIsNullException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ContainerItemIsNullException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Ein Container-Item ist auf null gesetzt.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php b/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php new file mode 100644 index 000000000..417e49d2e --- /dev/null +++ b/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ContainerMaybeDamagedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Ein Container ist möglicherweise beschädigt.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/database/.htaccess b/inc/classes/exceptions/database/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/database/local_file/.htaccess b/inc/classes/exceptions/database/local_file/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php b/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php new file mode 100644 index 000000000..ddc60e879 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SavePathIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Speicherpfad ist leer.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php b/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php new file mode 100644 index 000000000..0eabf4e52 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SavePathIsNoDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der angegebene Speicherpfad %s ist ungütig (kein Pfad).", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php b/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php new file mode 100644 index 000000000..678ecd005 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SavePathReadProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der Pfad %s ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php b/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php new file mode 100644 index 000000000..0e7ca79c9 --- /dev/null +++ b/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SavePathWriteProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der angegebene Speicherpfad %s ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/.htaccess b/inc/classes/exceptions/io/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/io/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php b/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php new file mode 100644 index 000000000..5c415e167 --- /dev/null +++ b/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class DirPointerNotOpenedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Für den Pfad %s konnte kein Pointer initialisiert werden.", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php b/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php new file mode 100644 index 000000000..fd4e54178 --- /dev/null +++ b/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class FilePointerNotOpenedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Für die Datei %s konnte kein Pointer initialisiert werden. Möglicherweise ist die Datei nicht lesbar oder fehlt!", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_InvalidDataLengthException.php b/inc/classes/exceptions/io/class_InvalidDataLengthException.php new file mode 100644 index 000000000..630d1cae6 --- /dev/null +++ b/inc/classes/exceptions/io/class_InvalidDataLengthException.php @@ -0,0 +1,50 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class InvalidDataLengthException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Eine unerwartete Datenlänge von %s Byte ist aufgetreten. %s wurden erwartet!", + $array[0]->__toString(), + $this->getLine(), + $array[1], + $array[2] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php b/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php new file mode 100644 index 000000000..fc48bebbc --- /dev/null +++ b/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php @@ -0,0 +1,49 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class InvalidDirectoryResourceException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + if (is_null($class)) { + $message = "[???:] Ungütige Verzeichnis-Resource."; + } elseif (is_object($class)) { + $message = sprintf("[%s:%d] Ungütige Verzeichnis-Resource.", + $class->__toString(), + $this->getLine() + ); + } + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php b/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php new file mode 100644 index 000000000..1044d254b --- /dev/null +++ b/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php @@ -0,0 +1,50 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class InvalidMD5ChecksumException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Die MD5-Prüfsummen %s und %s stimmen nicht überein!", + $array[0]->__toString(), + $this->getLine(), + $array[1], + $array[2] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_PathIsEmptyException.php b/inc/classes/exceptions/io/class_PathIsEmptyException.php new file mode 100644 index 000000000..ffabd5c3d --- /dev/null +++ b/inc/classes/exceptions/io/class_PathIsEmptyException.php @@ -0,0 +1,49 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class PathIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + if (is_null($class)) { + $message = "[???:] Der Verzeichnisname ist leer."; + } elseif (is_object($class)) { + $message = sprintf("[%s:%d] Der Verzeichnisname ist leer.", + $class->__toString(), + $this->getLine() + ); + } + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php b/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php new file mode 100644 index 000000000..6b0a53110 --- /dev/null +++ b/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class PathIsNoDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der angegebene Pfad %s ist ungütig (kein Pfad).", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/io/class_PathReadProtectedException.php b/inc/classes/exceptions/io/class_PathReadProtectedException.php new file mode 100644 index 000000000..530f16fa9 --- /dev/null +++ b/inc/classes/exceptions/io/class_PathReadProtectedException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class PathReadProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($path, $code) { + // Add a message around the missing class + $message = sprintf("Der Pfad %s ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/language/.htaccess b/inc/classes/exceptions/language/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/language/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php b/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php new file mode 100644 index 000000000..24674cd33 --- /dev/null +++ b/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class InvalidLanguagePathStringException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] %s ist keine Zeichenkette!", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php b/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php new file mode 100644 index 000000000..4e2cbf828 --- /dev/null +++ b/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class LanguagePathIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Sprachen-Basispfad ist leer.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php b/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php new file mode 100644 index 000000000..1f0f53dae --- /dev/null +++ b/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class LanguagePathIsNoDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Sprach-Basispfad %s existiert nicht oder ist eine Datei!", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php b/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php new file mode 100644 index 000000000..72bf450f8 --- /dev/null +++ b/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class LanguagePathReadProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Sprach-Basispfad %s ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/.htaccess b/inc/classes/exceptions/main/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/main/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/main/class_ClassMismatchException.php b/inc/classes/exceptions/main/class_ClassMismatchException.php new file mode 100644 index 000000000..b8079c1f8 --- /dev/null +++ b/inc/classes/exceptions/main/class_ClassMismatchException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ClassMismatchException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($classArray, $code) { + // Add a message around the missing class + $message = sprintf("Die Klasse %s ist ungleich %s.", + $classArray[0], + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ClassNotFoundException.php b/inc/classes/exceptions/main/class_ClassNotFoundException.php new file mode 100644 index 000000000..a91f6e70b --- /dev/null +++ b/inc/classes/exceptions/main/class_ClassNotFoundException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ClassNotFoundException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("Die interne Script-Klasse %s konnte nicht gefunden werden!", $class); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php b/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php new file mode 100644 index 000000000..2661bf045 --- /dev/null +++ b/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ConfigEntryIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Leeren Konfigurationseintrag angegeben!", + $class, + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php b/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php new file mode 100644 index 000000000..b83567f55 --- /dev/null +++ b/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php @@ -0,0 +1,49 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ConfigEntryNotFoundException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct (array $classArray, $code) { + // Cast the array + $classArray = (array) $classArray; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Konfigurationseintrag %s nicht gefunden.", + $classArray[0], + $this->getLine(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php b/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php new file mode 100644 index 000000000..f65a01afb --- /dev/null +++ b/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php @@ -0,0 +1,50 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class DimNotFoundInArrayException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + if (is_object($class)) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Abmasse konnten nicht extrahiert werden!", + $class->__toString(), + $this->getLine() + ); + } else { + // No class given + $message = sprintf("Please provide a class for %s", __CLASS__); + } + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ExceptionNotChangedException.php b/inc/classes/exceptions/main/class_ExceptionNotChangedException.php new file mode 100644 index 000000000..d8123ebe0 --- /dev/null +++ b/inc/classes/exceptions/main/class_ExceptionNotChangedException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * @deprecated + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ExceptionNotChangedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Exception(s) wurde(n) nicht geändert.", + $class, + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_ExceptionNotFoundException.php b/inc/classes/exceptions/main/class_ExceptionNotFoundException.php new file mode 100644 index 000000000..131e732cb --- /dev/null +++ b/inc/classes/exceptions/main/class_ExceptionNotFoundException.php @@ -0,0 +1,49 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ExceptionNotFoundException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct (array $classArray, $code) { + // Cast the array + $classArray = (array) $classArray; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Exception %s nicht gefunden.", + $classArray[0], + $this->getLine(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_GetterNotFoundException.php b/inc/classes/exceptions/main/class_GetterNotFoundException.php new file mode 100644 index 000000000..bb25fdb80 --- /dev/null +++ b/inc/classes/exceptions/main/class_GetterNotFoundException.php @@ -0,0 +1,49 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class GetterNotFoundException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($dataArray, $code) { + // Cast the array + $dataArray = (array) $dataArray; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Getter-Methode für Attribut %s nicht gefunden.", + $dataArray[0]->__toString(), + $this->getLine(), + $dataArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_InvalidArrayCountException.php b/inc/classes/exceptions/main/class_InvalidArrayCountException.php new file mode 100644 index 000000000..93f4ff81b --- /dev/null +++ b/inc/classes/exceptions/main/class_InvalidArrayCountException.php @@ -0,0 +1,51 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class InvalidArrayCountException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] %s hat %d Elemente, soll aber %d enthalten!", + $array[0]->__toString(), + $this->getLine(), + $array[1], + $array[2], + $array[3] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_InvalidObjectException.php b/inc/classes/exceptions/main/class_InvalidObjectException.php new file mode 100644 index 000000000..c74eecbc8 --- /dev/null +++ b/inc/classes/exceptions/main/class_InvalidObjectException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class InvalidObjectException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: %s)", + $class->__toString(), + $this->getLine(), + $class->getPartDescr() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_MissingArrayElementsException.php b/inc/classes/exceptions/main/class_MissingArrayElementsException.php new file mode 100644 index 000000000..17e0d05de --- /dev/null +++ b/inc/classes/exceptions/main/class_MissingArrayElementsException.php @@ -0,0 +1,60 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class MissingArrayElementsException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($classArray, $code) { + // Cast the array + $classArray = (array) $classArray; + + // Extract all elements + $elements = ""; + if ((isset($classArray[2])) && (is_array($classArray[2]))) { + // Convert into strings + $elements = implode(", ", $classArray[2]); + } else { + // Invalid data + $elements = "invalid_data"; + } + + // Add a message around the missing class + $message = sprintf("[%s:%d] Das Array %s() keine Elemente %s auf!", + $classArray[0]->__toString(), + $this->getLine(), + $classArray[1], + $elements + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php b/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php new file mode 100644 index 000000000..c5b28a4bc --- /dev/null +++ b/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class MissingDecimalsThousandsSeperatorException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($instance, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Die Dezimal- und Tausendertrenner fehlen!", + $instance->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_MissingMethodException.php b/inc/classes/exceptions/main/class_MissingMethodException.php new file mode 100644 index 000000000..46670688f --- /dev/null +++ b/inc/classes/exceptions/main/class_MissingMethodException.php @@ -0,0 +1,49 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class MissingMethodException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($classArray, $code) { + // Cast the array + $classArray = (array) $classArray; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Weisst keine Methode %s() auf!", + $classArray[0]->__toString(), + $this->getLine(), + $classArray[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NoArrayCreatedException.php b/inc/classes/exceptions/main/class_NoArrayCreatedException.php new file mode 100644 index 000000000..b3a68c7c0 --- /dev/null +++ b/inc/classes/exceptions/main/class_NoArrayCreatedException.php @@ -0,0 +1,49 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class NoArrayCreatedException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] %s ist kein erstelltes Objekt.", + $array[0]->__toString(), + $this->getLine(), + $array[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NoArrayException.php b/inc/classes/exceptions/main/class_NoArrayException.php new file mode 100644 index 000000000..9e5942b1a --- /dev/null +++ b/inc/classes/exceptions/main/class_NoArrayException.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class NoArrayException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($string, $code) { + // Add a message around the missing class + $message = sprintf("%s ist kein Array!", + $string + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NoObjectException.php b/inc/classes/exceptions/main/class_NoObjectException.php new file mode 100644 index 000000000..7f3da7725 --- /dev/null +++ b/inc/classes/exceptions/main/class_NoObjectException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * @deprecated + * @see InvalidObjectException + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class NoObjectException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($string, $code) { + // Add a message around the missing class + $message = sprintf("%s ist kein Objekt!", + $string + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_NullPointerException.php b/inc/classes/exceptions/main/class_NullPointerException.php new file mode 100644 index 000000000..45487d5d9 --- /dev/null +++ b/inc/classes/exceptions/main/class_NullPointerException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class NullPointerException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Eine Instanz/Pointer ist auf null gesetzt.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/main/class_VariableIsNotSetException.php b/inc/classes/exceptions/main/class_VariableIsNotSetException.php new file mode 100644 index 000000000..0ec1a4d58 --- /dev/null +++ b/inc/classes/exceptions/main/class_VariableIsNotSetException.php @@ -0,0 +1,50 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class VariableIsNotSetException extends FrameworkException { + /** + * The constructor + * + * @param $message Message from the exception + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($array, $code) { + // Cast the array + $array = (array) $array; + + // Add a message around the missing class + $message = sprintf("[%s:%d] Bei der Initialisierung der Applikation %s wurde keine Variable %s erzeugt.", + $array[0]->__toString(), + $this->getLine(), + $array[1], + $array[2] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/.htaccess b/inc/classes/exceptions/template/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/exceptions/template/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/exceptions/template/class_BasePathIsEmptyException.php b/inc/classes/exceptions/template/class_BasePathIsEmptyException.php new file mode 100644 index 000000000..ed59ac5d7 --- /dev/null +++ b/inc/classes/exceptions/template/class_BasePathIsEmptyException.php @@ -0,0 +1,45 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BasePathIsEmptyException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Template-Basispfad ist leer.", + $class->__toString(), + $this->getLine() + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php b/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php new file mode 100644 index 000000000..6d3230124 --- /dev/null +++ b/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BasePathIsNoDirectoryException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Template-Basispfad %s existiert nicht oder ist eine Datei!", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_BasePathReadProtectedException.php b/inc/classes/exceptions/template/class_BasePathReadProtectedException.php new file mode 100644 index 000000000..b95171dbf --- /dev/null +++ b/inc/classes/exceptions/template/class_BasePathReadProtectedException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BasePathReadProtectedException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Template-Basispfad %s ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_InvalidBasePathStringException.php b/inc/classes/exceptions/template/class_InvalidBasePathStringException.php new file mode 100644 index 000000000..7236f6e2d --- /dev/null +++ b/inc/classes/exceptions/template/class_InvalidBasePathStringException.php @@ -0,0 +1,46 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class InvalidBasePathStringException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] %s ist keine Zeichenkette!", + $class[0]->__toString(), + $this->getLine(), + $class[1] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php new file mode 100644 index 000000000..6dc35afb0 --- /dev/null +++ b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php @@ -0,0 +1,48 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class InvalidTemplateVariableNameException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Die im Template %s gefundene Variable %s ist nicht gültig! Gültige Variablennamen sind nur %s.", + $class[0]->__toString(), + $this->getLine(), + basename($class[1]), + $class[2], + $class[3]->readConfig("tpl_valid_var") + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php b/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php new file mode 100644 index 000000000..06126039d --- /dev/null +++ b/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php @@ -0,0 +1,47 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class UnexpectedTemplateTypeException extends FrameworkException { + /** + * The constructor + * + * @param $class An array holding our informations + * @param $code Code number for the exception + * @return void + */ + public final function __construct ($class, $code) { + // Add a message around the missing class + $message = sprintf("[%s:%d] Der Template-Typ %s entspricht nicht dem erwartetem Template-Typ %s.", + $class[0]->__toString(), + $this->getLine(), + $class[1], + $class[2] + ); + + // Call parent constructor + parent::__construct($message, $code); + } +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/.htaccess b/inc/classes/interfaces/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/application/.htaccess b/inc/classes/interfaces/application/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/application/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/application/class_ManageableApplication.php b/inc/classes/interfaces/application/class_ManageableApplication.php new file mode 100644 index 000000000..f342a0a7c --- /dev/null +++ b/inc/classes/interfaces/application/class_ManageableApplication.php @@ -0,0 +1,83 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface ManageableApplication extends FrameworkInterface { + /** + * Getter for application's version number + * + * @return $appVersion The application's version number + */ + function getAppVersion (); + /** + * Setter for application's version number + * + * @param $appVersion The application's version number + * @return void + */ + function setAppVersion ($appVersion); + + /** + * Getter for application's human-readable name + * + * @return $appName The application's name readable for humans + */ + function getAppName (); + + /** + * Setter for application's human-readable name + * + * @param $appName The application's name readable for humans + * @return void + */ + function setAppName ($appName); + + /** + * Getter for application's short uni*-like name + * + * @return $shortName The application's name readable for humans + */ + function getAppShortName (); + + /** + * Setter for application's short uni*-like name + * + * @param $shortName The application's name readable for humans + * @return void + */ + function setAppShortName ($shortName); + + /** + * Launches the application + * + * @return void + */ + function entryPoint (); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/class_FrameworkInterface.php b/inc/classes/interfaces/class_FrameworkInterface.php new file mode 100644 index 000000000..733d665a1 --- /dev/null +++ b/inc/classes/interfaces/class_FrameworkInterface.php @@ -0,0 +1,29 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface FrameworkInterface { +} + +// +?> diff --git a/inc/classes/interfaces/compressor/.htaccess b/inc/classes/interfaces/compressor/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/compressor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/compressor/class_Compressor.php b/inc/classes/interfaces/compressor/class_Compressor.php new file mode 100644 index 000000000..0e3182a0b --- /dev/null +++ b/inc/classes/interfaces/compressor/class_Compressor.php @@ -0,0 +1,52 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface Compressor extends FrameworkInterface { + /** + * A compression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data + * @throws InvalidObjectException If the stream is an object + */ + function compressStream ($streamData); + + /** + * A decompression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data + * @throws InvalidObjectException If the stream is an object + */ + function decompressStream ($streamData); + + /** + * Getter for the file extension of this compressor + * + * @return $string The compressor's file extension + */ + function getCompressorExtension (); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/database/.htaccess b/inc/classes/interfaces/database/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php b/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php new file mode 100644 index 000000000..3031f60f8 --- /dev/null +++ b/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php @@ -0,0 +1,70 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface FrameworkDatabaseInterface extends FrameworkInterface { + /** + * Saves a whole object by serializing it entirely or some specifyable + * parts. Specifying parts must be done before this method is called. If + * it is not done this method will serialize the whole object. + * + * @param $object An instance to the object we want to save + * @return void + * @see limitObject(ObjectLimits) limitObject + */ + function saveObject ($object); + + /** + * Analyses if a unique ID has already been used or not. This method does + * only pass the given ID through to the "real" database layer. + * + * @param $uniqueID A unique ID number which shall be checked + * before it will be used + * @param $inConstructor If called from a constructor or from + * somewhere else + * @return $isUnused true = The unique ID was not found in the database, + * false = It is already in use by an other object + * @throws NullPointerException If $dbInstance is null + * @throws NoObjectException If $dbInstance is not an object + * @throws MissingMethodException If the required method + * isUniqueIdUsed() was not found + */ + function isUniqueIdUsed ($uniqueID, $inConstructor = false); + + /** + * Gets cached data from the database layer and if not found fetch it from + * the database again. This method does not return the header stuff because + * The underlaying database class will return only the requested content. + * + * @param $idNumber The ID number which we need for looking up + * the requested data + * @return $cachedArray The maybe cached data from the database + * @throws NullPointerException If $dbInstance is null + * @throws NoObjectException If $dbInstance is not an object + * @throws MissingMethodException If the required method + * isUniqueIdUsed() was not found + */ + function getObjectFromCachedData ($idNumber); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/database/frontend/.htaccess b/inc/classes/interfaces/database/frontend/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/database/frontend/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php b/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php new file mode 100644 index 000000000..b6043b396 --- /dev/null +++ b/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface DatabaseFrontendInterface extends FrameworkDatabaseInterface { + /** + * Loads data saved with saveObject from the database and re-creates a + * full object from it. + * If limitObject() was called before a new object ObjectContainer with + * all requested attributes will be returned instead. + * + * @return Object The fully re-created object or instance to + * ObjectContainer + */ + function loadObject (); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/database/middleware/.htaccess b/inc/classes/interfaces/database/middleware/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/database/middleware/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php b/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php new file mode 100644 index 000000000..e9f5031d1 --- /dev/null +++ b/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php @@ -0,0 +1,28 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface DatabaseConnector extends FrameworkDatabaseInterface { +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/debug/.htaccess b/inc/classes/interfaces/debug/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/debug/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/debug/class_Debugger.php b/inc/classes/interfaces/debug/class_Debugger.php new file mode 100644 index 000000000..eeffbf241 --- /dev/null +++ b/inc/classes/interfaces/debug/class_Debugger.php @@ -0,0 +1,35 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface Debugger extends FrameworkInterface { + /** + * Outputs the given data + * + * @param $output Debug text for output + * @return void + */ + function outputStream ($output); +} + +// +?> diff --git a/inc/classes/interfaces/extended/.htaccess b/inc/classes/interfaces/extended/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/extended/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/extended/class_LimitableObject.php b/inc/classes/interfaces/extended/class_LimitableObject.php new file mode 100644 index 000000000..591a21e82 --- /dev/null +++ b/inc/classes/interfaces/extended/class_LimitableObject.php @@ -0,0 +1,40 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface LimitableObject extends FrameworkInterface { + /** + * Reduces the volume of a processed object. + * + * @param $limitInstance An instance to ObjectLimits which holds + * attribute names that we want to include + * in the processing phase. Other attributes + * except $uniqueID and $realClass will be + * ignored and keept out. + * @return void + */ + function limitObject (ObjectLimits $limitInstance); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/io/.htaccess b/inc/classes/interfaces/io/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/io/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/io/class_Streamable.php b/inc/classes/interfaces/io/class_Streamable.php new file mode 100644 index 000000000..4763acbf5 --- /dev/null +++ b/inc/classes/interfaces/io/class_Streamable.php @@ -0,0 +1,28 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface Streamable extends FrameworkInterface { +} + +// +?> diff --git a/inc/classes/interfaces/io/file/.htaccess b/inc/classes/interfaces/io/file/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/io/file/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/io/file/class_FileInputStreamer.php b/inc/classes/interfaces/io/file/class_FileInputStreamer.php new file mode 100644 index 000000000..e13174aec --- /dev/null +++ b/inc/classes/interfaces/io/file/class_FileInputStreamer.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface FileInputStreamer extends Streamable { + /** + * Reads from a local or remote file + * + * @param $fqfn The file's FQFN we shall load + * @return $array An array containing all read lines + * @throws NullPointerException If an instance is null + * @throws NoObjectException If the instance is not an object + * instance + * @throws MissingMethodException If a required method is missing. + * @throws InvalidArrayCountException If an array has not the + * expected size + * @throws InvalidMD5ChecksumException If two MD5 hashes did not match + */ + function loadFileContents ($fqfn); +} + +// +?> diff --git a/inc/classes/interfaces/io/file/class_FileOutputStreamer.php b/inc/classes/interfaces/io/file/class_FileOutputStreamer.php new file mode 100644 index 000000000..e0f55e4f5 --- /dev/null +++ b/inc/classes/interfaces/io/file/class_FileOutputStreamer.php @@ -0,0 +1,42 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface FileOutputStreamer extends Streamable { + /** + * Saves streamed (that are mostly serialized objects) data to files or + * external servers. + * + * @param $fileName The local file's name including full path + * @param $dataArray Array containing the compressor's extension + * and streamed data + * @return void + * @throws NullPointerException If an instance is null + * @throws NoObjectException If the instance is not an object + * instance + * @throws MissingMethodException If a required method is missing. + */ + function saveFile ($fileName, $dataArray); +} + +// +?> diff --git a/inc/classes/interfaces/io/output/.htaccess b/inc/classes/interfaces/io/output/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/io/output/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/io/output/class_OutputStreamer.php b/inc/classes/interfaces/io/output/class_OutputStreamer.php new file mode 100644 index 000000000..a803a4699 --- /dev/null +++ b/inc/classes/interfaces/io/output/class_OutputStreamer.php @@ -0,0 +1,43 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface OutputStreamer extends Streamable { + /** + * Assigns a variable for output + * + * @param $var The variable we shall assign + * @param $value The value to store in the variable + * @return void + */ + function assignVariable ($var, $value); + + /** + * Output the code + * + * @return void + */ + function output ($outStream=false); +} + +// +?> diff --git a/inc/classes/interfaces/language/.htaccess b/inc/classes/interfaces/language/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/language/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/language/class_ManageableLanguage.php b/inc/classes/interfaces/language/class_ManageableLanguage.php new file mode 100644 index 000000000..9ffec5201 --- /dev/null +++ b/inc/classes/interfaces/language/class_ManageableLanguage.php @@ -0,0 +1,34 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface ManageableLanguage extends FrameworkInterface { + /** + * Initialize the array-object for all later language strings + * + * @return void + */ + function initLanguageStrings(); +} // END - class + +// [EOF] +?> diff --git a/inc/classes/interfaces/template/.htaccess b/inc/classes/interfaces/template/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/interfaces/template/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/template/class_CompileableTemplate.php b/inc/classes/interfaces/template/class_CompileableTemplate.php new file mode 100644 index 000000000..f6dc57717 --- /dev/null +++ b/inc/classes/interfaces/template/class_CompileableTemplate.php @@ -0,0 +1,98 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface CompileableTemplate extends FrameworkInterface { + /** + * Assign variables for templates + * + * @param $var The "variable" we want to assign + * @param $value The value we want to store in the variable + * @return void + */ + function assignVariable ($var, $value); + + /** + * Assign a configuration variables for templates + * + * @param $var The configuration "variable" we want to assign + * @param $value The value we want to store in the variable + * @return void + */ + function assignConfigVariable ($var, $value); + + /** + * Load a specified web template into the engine + * + * @param $template The web template we shall load which is + * located in "html" by default + * @return void + */ + function loadWebTemplate ($template); + + /** + * Load a specified code template into the engine for later compilation + * with other code/web/email templates. + * + * @param $template The code template we shall load which is + * located in "html" by default + * @return void + */ + function loadCodeTemplate ($template); + + /** + * Load a specified email template into the engine + * + * @param $template The email template we shall load which is + * located in "emails" by default + * @return void + */ + function loadEmailTemplate ($template); + + /** + * Compile all variables by inserting their respective values + * + * @return void + */ + function compileVariables (); + + + /** + * Compile all required code/web/email-templates into the current one + * + * @return void + */ + function compileTemplate (); + + /** + * Output the compiled template to the outside world. In case of web + * templates this would be vaild (X)HTML code. And in case of email + * templates this would store a prepared email body inside the template + * engine. + * + * @return void + */ + function output (); +} // END - class + +// [EOF] +?> diff --git a/inc/classes/main/.htaccess b/inc/classes/main/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/main/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php new file mode 100644 index 000000000..1e536a201 --- /dev/null +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -0,0 +1,766 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseFrameworkSystem extends stdClass implements FrameworkInterface { + /** + * The instance to the debug output handler (should be DebugConsoleOutput or DebugWebOutput) + * + * @see DebugConsoleOutput + * @see DebugWebOutput + */ + private static $debug = null; + + /** + * The instance to the web output handler (should be WebOutput) + * + * @see WebOutput + */ + private static $webOutput = null; + + /** + * The instance to the compression layer which should be CompressorChannel + */ + private static $compressor = null; + + /** + * The configuration instance which shall be FrameworkConfiguration + */ + private static $cfgInstance = null; + + /** + * The instance to the database layer which should be DatabaseConnection + */ + private $dbInstance = null; + + /** + * The real class name + */ + private $realClass = "FrameworkSystem"; + + /** + * A human-readable description for this simulator part + */ + private $partDescr = "Namenlose Framework-Einheit"; + + /** + * The unique ID string for identifying all type of classes + */ + private $uniqueID = ""; + + /** + * Thousands seperator + */ + private $thousands = "."; // German + + /** + * Decimal seperator + */ + private $decimals = ","; // German + + /*********************** + * Exception codes.... * + ***********************/ + + const EXCEPTION_IS_NULL_POINTER = 0x001; + const EXCEPTION_IS_NO_OBJECT = 0x002; + const EXCEPTION_IS_NO_ARRAY = 0x003; + const EXCEPTION_MISSING_METHOD = 0x004; + const EXCEPTION_CLASSES_NOT_MATCHING = 0x005; + const EXCEPTION_INDEX_OUT_OF_BOUNDS = 0x006; + const EXCEPTION_DIMENSION_ARRAY_INVALID = 0x007; + const EXCEPTION_ITEM_NOT_TRADEABLE = 0x008; + const EXCEPTION_ITEM_NOT_IN_PRICE_LIST = 0x009; + const EXCEPTION_GENDER_IS_WRONG = 0x00a; + const EXCEPTION_BIRTH_DATE_IS_INVALID = 0x00b; + const EXCEPTION_EMPTY_STRUCTURES_ARRAY = 0x00c; + const EXCEPTION_HAS_ALREADY_PERSONELL_LIST = 0x00d; + const EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES = 0x00e; + const EXCEPTION_TOTAL_PRICE_NOT_CALCULATED = 0x00f; + const EXCEPTION_HARBOR_HAS_NO_SHIPYARDS = 0x010; + const EXCEPTION_CONTRACT_PARTNER_INVALID = 0x011; + const EXCEPTION_CONTRACT_PARTNER_MISMATCH = 0x012; + const EXCEPTION_CONTRACT_ALREADY_SIGNED = 0x013; + const EXCEPTION_UNEXPECTED_EMPTY_STRING = 0x014; + const EXCEPTION_PATH_NOT_FOUND = 0x015; + const EXCEPTION_INVALID_PATH_NAME = 0x016; + const EXCEPTION_READ_PROTECED_PATH = 0x017; + const EXCEPTION_WRITE_PROTECED_PATH = 0x018; + const EXCEPTION_DIR_POINTER_INVALID = 0x019; + const EXCEPTION_FILE_POINTER_INVALID = 0x01a; + const EXCEPTION_INVALID_DIRECTORY_POINTER = 0x01b; + const EXCEPTION_UNEXPECTED_OBJECT = 0x01c; + const EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED = 0x01d; + const EXCEPTION_GETTER_IS_MISSING = 0x01e; + const EXCEPTION_ARRAY_EXPECTED = 0x01f; + const EXCEPTION_ARRAY_HAS_INVALID_COUNT = 0x020; + const EXCEPTION_ID_IS_INVALID_FORMAT = 0x021; + const EXCEPTION_MD5_CHECKSUMS_MISMATCH = 0x022; + const EXCEPTION_UNEXPECTED_STRING_SIZE = 0x023; + const EXCEPTION_SIMULATOR_ID_INVALID = 0x024; + const EXCEPTION_MISMATCHING_COMPRESSORS = 0x025; + const EXCEPTION_CONTAINER_ITEM_IS_NULL = 0x026; + const EXCEPTION_ITEM_IS_NO_ARRAY = 0x027; + const EXCEPTION_CONTAINER_MAYBE_DAMAGED = 0x028; + const EXCEPTION_INVALID_STRING = 0x029; + const EXCEPTION_VARIABLE_NOT_SET = 0x02a; + const EXCEPTION_ATTRIBUTES_ARE_MISSING = 0x02b; + const EXCEPTION_ARRAY_ELEMENTS_MISSING = 0x02c; + + /** + * In the super constructor these system classes shall be ignored or else + * we would get an endless calling loop. + * + *--------------------------------------------------------------------* + * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL SHOOT YOUR SERVER!!! * + *--------------------------------------------------------------------* + */ + private $systemClasses = array( + "DebugMiddleware", // Debug middleware output sub-system + "DebugWebOutput", // Debug web output sub-system + "DebugConsoleOutput", // Debug console output sub-system + "DebugErrorLogOutput", // Debug error_log() output sub-system + "CompressorChannel", // Compressor sub-system + "FrameworkDirectoryPointer", // Directory handler sub-system + "NullCompressor", // Null compressor + "Bzip2Compressor", // BZIP2 compressor + "GzipCompressor", // GZIP compressor + "WebOutput", // Web output sub-system + ); + + /** + * Private super constructor + * + * @return void + */ + private function __construct ($class) { + // Set real class + $this->setRealClass($class); + } + + /** + * Destructor reached... + * + * @return void + */ + public function __destruct() { + // Is this object already destroyed? + if ($this->__toString() != "DestructedObject") { + // Debug message + if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { + $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wird zerstört.
\n", + __CLASS__, $this->__toString() + )); + } + + // Destroy all informations about this class but keep some text about it alive + $this->setPartDescr(sprintf("Entferntes Objekt %s", $this->__toString())); + $this->setRealClass("DestructedObject"); + $this->resetUniqueID(); + } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { + // Already destructed object + $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wurde bereits zerstört.
\n", + __CLASS__, $this->__toString() + )); + } + } + + /** + * The call method where all non-implemented methods end up + * + * @return void + */ + public final function __call ($methodName, $args) { + // Implode all given arguments + $argsString = implode("|", $args); + if (empty($argsString)) $argsString = "NULL"; + + $this->getDebugInstance()->output(sprintf("[%s::%s] Stub! Args: %s", + $this->__toString(), + $methodName, + $argsString + )); + + // Return nothing + return null; + } + + /** + * Public constructor (for initializing things, etc.) + * + * @return void + */ + public function constructor ($class) { + // Call constructor + $this->__construct($class); + + // Get the current (singleton) configuration instance + $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration()); + + // Is the class weather debug nor compressor channel? + if (!in_array($class, $this->systemClasses)) { + // Initialize debug instance + if (is_null($this->getDebugInstance())) { + // Set the debug output system if it is not debug class ;) + $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig("debug_engine"))); + } + + // Initialize web instance + if (is_null($this->getWebOutputInstance())) { + // Generate the eval() command + $eval = sprintf("\$this->setWebOutputInstance(%s::create%s(\"%s\"));", + $this->getConfigInstance()->readConfig("web_engine"), + $this->getConfigInstance()->readConfig("web_engine"), + $this->getConfigInstance()->readConfig("web_content_type") + ); + + // Debug message + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + $this->__toString(), + htmlentities($eval) + )); + + // Run the command + eval($eval); + } + + // Initialize compressor channel + if (is_null($this->getCompressorChannel())) { + // Set the compressor channel + $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s", + PATH, + $this->getConfigInstance()->readConfig("compressor_base_path") + ))); + } + + // Initialize database middleware + if (is_null($this->getDatabaseInstance())) { + // Get the middleware instance + $db = DatabaseConnection::getInstance(); + if (is_object($db)) { + // Set the database middleware + $this->setDatabaseInstance($db); + } + } + + // Debug output + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Alle Sub-Systeme sind initialisiert.
\n", + $this->__toString() + )); + } + } + + /** + * Setter for language instance + * + * @param $configInstance The configuration instance which shall + * be FrameworkConfiguration + * @return void + */ + public final function setConfigInstance (FrameworkConfiguration $configInstance) { + $this->cfgInstance = $configInstance; + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler auf %s gesetzt.
\n", + $this->__toString(), + $configInstance->__toString() + )); + } + + /** + * Getter for configuration instance + * + * @return $cfhInstance - Configuration instance + */ + public final function getConfigInstance () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler %s angefordert.
\n", + $this->__toString(), + $this->cfgInstance->__toString() + )); + return $this->cfgInstance; + } + + /** + * Setter for debug instance + * + * @param $debugInstance The instance for debug output class + * @return void + */ + public final function setDebugInstance (DebugMiddleware $debugInstance) { + self::$debug = $debugInstance; + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Debug-Handler auf %s gesetzt.
\n", + $this->__toString(), + $this->getDebugInstance()->__toString() + )); + } + + /** + * Getter for debug instance + * + * @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput + */ + public final function getDebugInstance () { + return self::$debug; + } + + /** + * Setter for web output instance + * + * @param $webInstance The instance for web output class + * @return void + */ + public final function setWebOutputInstance (OutputStreamer $webInstance) { + self::$webOutput = $webInstance; + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Web-Handler auf %s gesetzt.
\n", + $this->__toString(), + $this->getWebOutputInstance()->__toString() + )); + } + + /** + * Getter for web output instance + * + * @return $webOutput - Instance to class WebOutput + */ + public final function getWebOutputInstance () { + return self::$webOutput; + } + + /** + * Static setter for database instance + * + * @param $dbInstance The instance for the database connection + * (forced DatabaseConnection) + * @return void + */ + public final function setDatabaseInstance (DatabaseConnection $dbInstance) { + if ((defined('DEBUG_SYSTEM')) && (is_object($dbInstance->getDebugInstance()))) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Datenbankschicht gesetzt.
\n", + $dbInstance->__toString() + )); + $this->dbInstance = $dbInstance; + } + + /** + * Getter for $realClass + * + * @return $realClass The name of the real class (not BaseFrameworkSystem) + */ + public final function __toString () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] __toString() erreicht.
\n", + $this->realClass + )); + return $this->realClass; + } + + /** + * Setter for the real class name + * + * @param $realClass Class name (string) + * @return void + */ + public final function setRealClass ($realClass) { + // Cast to string + $realClass = (string) $realClass; + + // Set real class + $this->realClass = $realClass; + } + + /** + * Generate unique ID from a lot entropy + * + * @return void + */ + public final function createUniqueID () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID aufgerufen.
\n", + $this->__toString() + )); + + // Existiert noch keine? + if (empty($this->uniqueID)) { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID erzeugt neue Unique-ID.
\n", + $this->__toString() + )); + + // Correct missing class name + $corrected = false; + if ($this->__toString() == "") { + $this->setRealClass(__CLASS__); + $corrected = true; + } + + // Neue ID erstellen + $tempID = false; + while (true) { + // Generate a unique ID number + $tempID = $this->generateIdNumber(); + $isUsed = false; + + // Try to figure out if the ID number is not yet used + try { + if (is_object($this->getDatabaseInstance())) { + $isUsed = $this->getDatabaseInstance()->isUniqueIdUsed($tempID, true); + } + } catch (FrameworkException $e) { + // Catches all and ignores all ;-) + } + + if ( + ( + $tempID !== false + ) && ( + ( + $this->getDatabaseInstance() === null + ) || ( + ( + is_object($this->getDatabaseInstance()) + ) && ( + !$isUsed + ) + ) + ) + ) { + // Abort the loop + break; + } + } + + // Debug message + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] uniqueID ist auf %s gesetzt.
\n", + $this->__toString(), + $tempID + )); + + // Apply the new ID + $this->setUniqueID($tempID); + + // Revert maybe corrected class name + if ($corrected) { + $this->setRealClass(""); + } + + // Remove system classes if we are in a system class + if ((isset($this->systemClasses)) && (in_array($this->__toString(), $this->systemClasses))) { + // This may save some RAM... + $this->removeSystemArray(); + } + } + } + + /** + * Generates a new ID number for classes based from the class' real name, + * the description and some random data + * + * @return $tempID The new (temporary) ID number + */ + private final function generateIdNumber () { + return sprintf("%s@%s", + $this->__toString(), + md5(sprintf("%s:%s:%s:%s:%s:%s", + $this->__toString(), + $this->getPartDescr(), + time(), + getenv('REMOTE_ADDR'), + getenv('SERVER_ADDR'), + mt_rand() + )) + ); + } + + /** + * Setter for unique ID + * + * @param $uniqueID The newly generated unique ID number + * @return void + */ + private final function setUniqueID ($uniqueID) { + // Cast to string + $uniqueID = (string) $uniqueID; + + // Debug message + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID gesetzt auf %s.
\n", + $this->__toString(), + $uniqueID + )); + + // Set the ID number + $this->uniqueID = $uniqueID; + } + + /** + * Getter for unique ID + * + * @return $uniqueID The unique ID of this class + */ + public final function getUniqueID () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID angefordert.
\n", + $this->__toString() + )); + return $this->uniqueID; + } + + /** + * Resets or recreates the unique ID number + * + * @return void + */ + public final function resetUniqueID() { + // Sweet and simple... ;-) + $newUniqueID = $this->generateIdNumber(); + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID zurückgesetzt auf %s.
\n", + $this->__toString(), + $newUniqueID + )); + $this->setUniqueID($newUniqueID); + } + + /** + * Getter for simulator description + * + * @return $partDescr The description of this simulation part + */ + public final function getPartDescr () { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] getPartDescr erreicht.
\n", + $this->__toString() + )); + if (isset($this->partDescr)) { + return $this->partDescr; + } else { + return null; + } + } + + /** + * Setter for simulation part description + * + * @param $partDescr The description as string for this simulation part + * @return void + */ + public final function setPartDescr ($partDescr) { + $this->partDescr = (String) $partDescr; + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Teilbeschreibung wird auf %s gesetzt.
\n", + $this->__toString(), + $this->partDescr + )); + } + + /** + * Validate if given object is the same as current + * + * @param $object An object instance for comparison with this class + * @return boolean The result of comparing both's unique ID + */ + public final function equals ($object) { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Ist %s=%s?
\n", + $this->__toString(), + $this->__toString(), + $object->__toString() + )); + return ($this->getUniqueID() == $object->getUniqueID()); + } + + /** + * Compare if both simulation part description and class name matches + * (shall be enougth) + * + * @param $itemInstance An object instance to an other class + * @return boolean The result of comparing class name simulation part description + */ + public function itemMatches ($itemInstance) { + return ( + ($this->__toString() == $itemInstance->__toString()) + && ($this->getPartDescr() == $itemInstance->getPartDescr()) + ); + } + + /** + * Compare class name of this and given class name + * + * @param $class The class name as string from the other class + * @return boolean The result of comparing both class names + */ + public final function isClass ($class) { + if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] %s=%s?
\n", + $this->__toString(), + $this->__toString(), + $class + )); + return ($this->__toString() == $class); + } + + /** + * Stub method (only real cabins shall override it) + * + * @return boolean false = is no cabin, true = is a cabin + */ + public function isCabin () { + return false; + } + + /** + * Stub method for tradeable objects + * + * @return boolean false = is not tradeable by the Merchant class, + * true = is a tradeable object + */ + public function isTradeable () { + return false; + } + + /** + * Formats computer generated price values into human-understandable formats + * with thousand and decimal seperators. + * + * @param $value The in computer format value for a price + * @param $currency The currency symbol (use HTML-valid characters!) + * @param $decNum Number of decimals after commata + * @return $price The for the current language formated price string + * @throws MissingDecimalsThousandsSeperatorException If decimals or + * thousands seperator + * is missing + */ + public function formatCurrency ($value, $currency = "€", $decNum = 2) { + // Are all required attriutes set? + if ((!isset($this->decimals)) || (!isset($this->thousands))) { + // Throw an exception + throw new MissingDecimalsThousandsSeperatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING); + } + + // Cast the number + $value = (float) $value; + if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] %d wird umformatiert.
\n", + $this->__toString(), + $value + )); + + // Reformat the US number + $price = sprintf("%s %s", + number_format($value, $decNum, $this->decimals, $this->thousands), + $currency + ); + + // Return as string... + return $price; + } + + /** + * Removes number formating characters + * + * @return void + */ + public final function removeNumberFormaters () { + if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Zahlenumformatierungszeichen werden entfernt.
\n", + $this->__toString() + )); + unset($this->thousands); + unset($this->decimals); + } + + /** + * Getter for database layer + * + * @return $dbInstance The database layer instance + */ + public final function getDatabaseInstance () { + if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Datenbank-Instanz %s angefordert.
\n", + $this->__toString(), + $this->dbInstance + )); + return $this->dbInstance; + } + + /** + * Setter for compressor channel + * + * @param $compressorChannel An instance of CompressorChannel + * @return void + */ + public final function setCompressorChannel (CompressorChannel $compressorChannel) { + self::$compressor = $compressorChannel; + } + + /** + * Getter for compressor channel + * + * @return $compressor The compressor channel + */ + public final function getCompressorChannel () { + return self::$compressor; + } + + /** + * Remove the $systemClasses array from memory + * + * @return void + */ + public final function removeSystemArray () { + unset($this->systemClasses); + } + + /** + * Create a file name and path name from the object's unique ID number. + * The left part of the ID shall always be a valid class name and the + * right part an ID number. + * + * @return $pfn The file name with a prepended path name + * @throws NoArrayCreatedException If explode() fails to create an array + * @throws InvalidArrayCountException If the array contains less or + * more than two elements + */ + public function getPathFileNameFromObject () { + // Get the main object's unique ID. We use this as a path/filename combination + $pathFile = $this->getUniqueID(); + + // Split it up in path and file name + $pathFile = explode("@", $pathFile); + + // Are there two elements? Index 0 is the path, 1 the file name + global extension + if (!is_array($pathFile)) { + // No array found + throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); + } elseif (count($pathFile) != 2) { + // Invalid ID returned! + throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + } + + // Auto-append missing trailing slash + $pathFile[0] = $this->addMissingTrailingSlash($pathFile[0]); + + // Create the file name and return it + $pfn = ($pathFile[0] . $pathFile[1]); + return $pfn; + } + + /** + * Appends a trailing slash to a string + * + * @param $str A string (maybe) without trailing slash + * @return $str A string with an auto-appended trailing slash + */ + public final function addMissingTrailingSlash ($str) { + // Is there a trailing slash? + if (substr($str, -1, 1) != "/") $str .= "/"; + return $str; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/class_FrameworkArrayObject.php b/inc/classes/main/class_FrameworkArrayObject.php new file mode 100644 index 000000000..85397a415 --- /dev/null +++ b/inc/classes/main/class_FrameworkArrayObject.php @@ -0,0 +1,48 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class FrameworkArrayObject extends ArrayObject { + /** + * Constructor for smooth coding style ;-) + * + * @param $class The class's real name + * @return void + */ + public function constructor ($class) { + // $class will be ignored for backward compatiblity + } + + /** + * Get real class' name back + * + * @return $realClass The class' real name + */ + public function __toString () { + return get_class($this); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/compressor/.htaccess b/inc/classes/main/compressor/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/main/compressor/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/compressor/class_Bzip2Compressor.php b/inc/classes/main/compressor/class_Bzip2Compressor.php new file mode 100644 index 000000000..c0c475f44 --- /dev/null +++ b/inc/classes/main/compressor/class_Bzip2Compressor.php @@ -0,0 +1,123 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor! + parent::constructor(__CLASS__); + + // Debug message + if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Set description + $this->setPartDescr("BZIP2-Kompressor"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Create a new compressor channel based a given compression handler + * + * @return $cInstance An instance of this class + */ + public final static function createBzip2Compressor () { + // Get new instance + if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) { + // Compressor can maybe be used + $cInstance = new Bzip2Compressor(); + + // Debug message + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompression wird verwendet.
\n", + $cInstance->__toString() + )); + } else { + // Routines not found! + $cInstance = null; + + // Debug message + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompressionsroutinen nicht gefunden.
\n", + $cInstance->__toString() + )); + } + + // Return the compressor instance + return $cInstance; + } + + /** + * BZIP2 compression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function compressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the compressed stream + return bzcompress($streamData, 1); + } + + /** + * BZIP2 decompression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function decompressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the decompressed stream + return bzdecompress($streamData); + } + + /** + * Getter for the file extension of this compressor + * + * @return $string Returns always "bz2" + */ + public final function getCompressorExtension () { + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", + $this->__toString() + )); + return "bz2"; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/compressor/class_GzipCompressor.php b/inc/classes/main/compressor/class_GzipCompressor.php new file mode 100644 index 000000000..0caae9f80 --- /dev/null +++ b/inc/classes/main/compressor/class_GzipCompressor.php @@ -0,0 +1,123 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class GzipCompressor extends BaseFrameworkSystem implements Compressor { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor! + parent::constructor(__CLASS__); + + // Debug message + if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Set description + $this->setPartDescr("GZIP-Kompressor"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Create a new compressor channel based a given compression handler + * + * @return $cInstance An instance of this class + */ + public final static function createGzipCompressor () { + // Get new instance + if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) { + // Compressor can maybe be used + $cInstance = new GzipCompressor(); + + // Debug message + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompression wird verwendet.
\n", + $cInstance->__toString() + )); + } else { + // Routines not found! + $cInstance = null; + + // Debug message + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompressionsroutinen nicht gefunden.
\n", + $cInstance->__toString() + )); + } + + // Return the compressor instance + return $cInstance; + } + + /** + * GZIP compression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function compressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the compressed stream + return gzcompress($streamData, 1); + } + + /** + * GZIP decompression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function decompressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the decompressed stream + return gzuncompress($streamData); + } + + /** + * Getter for the file extension of this compressor + * + * @return $string Returns always "gz" + */ + public final function getCompressorExtension () { + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", + $this->__toString() + )); + return "gz"; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/compressor/class_NullCompressor.php b/inc/classes/main/compressor/class_NullCompressor.php new file mode 100644 index 000000000..56b2d5f4f --- /dev/null +++ b/inc/classes/main/compressor/class_NullCompressor.php @@ -0,0 +1,107 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class NullCompressor extends BaseFrameworkSystem implements Compressor { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor! + parent::constructor(__CLASS__); + + // Debug message + if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Set description + $this->setPartDescr("Null-Kompressor"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Create a new compressor channel based a given compression handler + * + * @return $cInstance An instance of this class + */ + public final static function createNullCompressor () { + // Get new instance + $cInstance = new NullCompressor(); + + // Return the compressor instance + return $cInstance; + } + + /** + * Null compression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function compressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the compressed stream + return $streamData; + } + + /** + * Null decompression stream + * + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data + * @throws InvalidObjectException If the stream is an object + */ + public function decompressStream ($streamData) { + if (is_object($streamData)) { + // Throw an exception + throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); + } + + // Return the decompressed stream + return $streamData; + } + + /** + * Getter for the file extension of this compressor + * + * @return $string Returns always "bz2" + */ + public final function getCompressorExtension () { + if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", + $this->__toString() + )); + return "null"; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/console/.htaccess b/inc/classes/main/console/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/main/console/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/console/class_ConsoleTools.php b/inc/classes/main/console/class_ConsoleTools.php new file mode 100644 index 000000000..5ba9ae642 --- /dev/null +++ b/inc/classes/main/console/class_ConsoleTools.php @@ -0,0 +1,89 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ConsoleTools extends BaseFrameworkSystem { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Console-Tools"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Aquires the IP address of this host by reading the /etc/hostname file and solving it + * + * @return $ip The resolved IP address + */ + public static function aquireSelfIPAddress () { + // Local IP by default + $ip = "127.0.0.1"; + + // Get a new instance + $helper = new ConsoleTools(); + + try { + // Get a file pointer + $io = FrameworkFileInputPointer::createFrameworkFileInputPointer("/etc/hostname"); + + // Read the file + $hostname = trim($io->readFromFile()); + $helper->getDebugInstance()->output(sprintf("[%s:] Our host name is: %s
\n", + $helper->__toString(), + $hostname + )); + + // Close the file + $io->closeFile(); + + // Resolve it + $ipResolved = gethostbyname($hostname); + if (($ipResolved !== false) && ($ipResolved != $hostname)) { + // Okay, this works! + $ip = $ipResolved; + + // Debug message + $helper->getDebugInstance()->output(sprintf("[%s:] Resolved IP address is: %s
\n", + $helper->__toString(), + $ip + )); + } + } catch (FrameworkException $e) { + // Do nothing here + } + + // Return the IP address + return $ip; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/database/.htaccess b/inc/classes/main/database/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/main/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/database/class_BaseDatabaseFrontend.php b/inc/classes/main/database/class_BaseDatabaseFrontend.php new file mode 100644 index 000000000..b8f0d4354 --- /dev/null +++ b/inc/classes/main/database/class_BaseDatabaseFrontend.php @@ -0,0 +1,106 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject { + /** + * The limiter instance + */ + private $limitInstance = null; + + /** + * Private constructor + * + * @return void + */ + private function __construct($class) { + // Call parent constructor + parent::constructor($class); + + // Debug message + if (((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", + $this->__toString() + )); + + // Clean up a little + $this->removeNumberFormaters(); + } + + /** + * The public constructor + * + * @return void + */ + public function constructor ($class) { + // Calls just the private one + $this->__construct($class); + } + + /** + * Getter for limitation instance + * + * @return $limitInstance The instance to the object ObjectLimits + */ + public final function getLimitInstance () { + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s angefordert.
\n", + $this->__toString(), + $this->limitInstance->__toString() + )); + return $this->limitInstance; + } + + /** + * Setup limitation for the saving process + * + * @param $limitInstance An instance of ObjectLimits which contains + * elements we shall exclusivly include in + * saving process + * @return void + */ + public final function limitObject (ObjectLimits $limitInstance) { + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s soll verwendet werden.
\n", + $this->__toString(), + $limitInstance->__toString() + )); + + // Get limitArray for validation + $array = $limitInstance->getLimitArray(); + + // Sanity-check if some limitations are in the object + if ($array->count() > 0) { + // Okay, there is enougth + $this->limitInstance = $limitInstance; + + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s wird verwendet und beinhaltet %s Einträge.
\n", + $this->__toString(), + $limitInstance->__toString(), + $array->count() + )); + } + } +} + +// [EOF] +?> diff --git a/inc/classes/main/database/classes/.htaccess b/inc/classes/main/database/classes/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/main/database/classes/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/database/classes/class_LocalFileDatabase.php b/inc/classes/main/database/classes/class_LocalFileDatabase.php new file mode 100644 index 000000000..55875a6de --- /dev/null +++ b/inc/classes/main/database/classes/class_LocalFileDatabase.php @@ -0,0 +1,515 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface { + /** + * Save path for "file database" + */ + private $savePath = ""; + + /** + * The file's extension + */ + private $fileExtension = "serialized"; + + /** + * The IO handler for file handling which should be FileIOHandler. + */ + private $ioInstance = null; + + /** + * The last read file's name + */ + private $lastFile = ""; + + /** + * The last read file's content including header information + */ + private $lastContents = array(); + + /** + * The private constructor. Do never instance from outside! + * You need to set a local file path. The class will then validate it. + * + * @return void + */ + private function __construct() { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Dateidatenbankschicht"); + + // Create unique ID + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + /** + * Create an object of LocalFileDatabase and set the save path for local files. + * This method also validates the given file path. + * + * @param $savePath The local file path string + * @param $ioInstance The input/output handler. This + * should be FileIOHandler + * @return $dbInstance An instance of LocalFileDatabase + * @throws SavePathIsEmptyException If the given save path is an + * empty string + * @throws SavePathIsNoDirectoryException If the save path is no + * path (e.g. a file) + * @throws SavePathReadProtectedException If the save path is read- + * protected + * @throws SavePathWriteProtectedException If the save path is write- + * protected + */ + public final static function createLocalFileDatabase ($savePath, FileIOHandler $ioInstance) { + // Get an instance + $dbInstance = new LocalFileDatabase(); + + if (empty($savePath)) { + // Empty string + throw new SavePathIsEmptyException($dbInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); + } elseif (!is_dir($savePath)) { + // Is not a dir + throw new SavePathIsNoDirectoryException($savePath, self::EXCEPTION_INVALID_PATH_NAME); + } elseif (!is_readable($savePath)) { + // Path not readable + throw new SavePathReadProtectedException($savePath, self::EXCEPTION_READ_PROTECED_PATH); + } elseif (!is_writeable($savePath)) { + // Path not writeable + throw new SavePathWriteProtectedException($savePath, self::EXCEPTION_WRITE_PROTECED_PATH); + } + + // Debug output + if (defined('DEBUG_DATABASE')) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Es werden lokale Dateien zum Speichern von Objekten verwendet.
\n", + $dbInstance->__toString() + )); + + // Set save path and IO instance + $dbInstance->setSavePath($savePath); + $dbInstance->setIOInstance($ioInstance); + + // Return database instance + return $dbInstance; + } + + /** + * Setter for save path + * + * @param $savePath The local save path where we shall put our serialized classes + * @return void + */ + public final function setSavePath ($savePath) { + // Secure string + $savePath = (string) $savePath; + + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Lokaler Speicherpfad %s wird verwendet.
\n", + $this->__toString(), + $savePath + )); + + // Set save path + $this->savePath = $savePath; + } + + /** + * Getter for save path + * + * @return $savePath The local save path where we shall put our serialized classes + */ + public final function getSavePath () { + return $this->savePath; + } + + /** + * Getter for file extension + * + * @return $fileExtension The file extension for all file names + */ + public final function getFileExtension () { + return $this->fileExtension; + } + + /** + * Saves a given object to the local file system by serializing and + * transparently compressing it + * + * @param $object The object we shall save to the local file system + * @return void + * @throws NullPointerException If the object instance is null + * @throws NoObjectException If the parameter $object is not + * an object + */ + public final function saveObject ($object) { + // Some tests on the parameter... + if (is_null($object)) { + // Is null, throw exception + throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($object)) { + // Is not an object, throw exception + throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($object, '__toString')) { + // A highly required method was not found... :-( + throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD); + } + + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s soll in eine lokale Datei gespeichert werden.
\n", + $this->__toString(), + $object->__toString() + )); + + // Get a string containing the serialized object. We cannot exchange + // $this and $object here because $object does not need to worry + // about it's limitations... ;-) + $serialized = $this->serializeObject($object); + + // Debug message + if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s ist nach der Serialisierung %s Byte gross.
\n", + $this->__toString(), + $object->__toString(), + strlen($serialized) + )); + + // Get a path name plus file name and append the extension + $fqfn = $this->getSavePath() . $object->getPathFileNameFromObject() . "." . $this->getFileExtension(); + + // Save the file to disc we don't care here if the path is there, + // this must be done in later methods. + $this->getIOInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized)); + } + + /** + * Get a serialized string from the given object + * + * @param $object The object we want to serialize and transparently + * compress + * @return $serialized A string containing the serialzed/compressed object + * @see ObjectLimits An object holding limition information + * @see SerializationContainer A special container class for e.g. + * attributes from limited objects + */ + private function serializeObject ($object) { + // If there is no limiter instance we serialize the whole object + // otherwise only in the limiter object (ObjectLimits) specified + // attributes summarized in a special container class + if ($this->getLimitInstance() === null) { + // Serialize the whole object. This tribble call is the reason + // why we need a fall-back implementation in CompressorChannel + // of the methods compressStream() and decompressStream(). + $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($object)); + } else { + // Serialize only given attributes in a special container + $container = SerializationContainer::createSerializationContainer($this->getLimitInstance(), $object); + + // Serialize the container + $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($container)); + } + + // Return the serialized object string + return $serialized; + } + + /** + * Analyses if a unique ID has already been used or not by search in the + * local database folder. + * + * @param $uniqueID A unique ID number which shall be checked + * before it will be used + * @param $inConstructor If we got called in a de/con-structor or + * from somewhere else + * @return $isUnused true = The unique ID was not found in the database, + * false = It is already in use by an other object + * @throws NoArrayCreatedException If explode() fails to create an array + * @throws InvalidArrayCountException If the array contains less or + * more than two elements + */ + public function isUniqueIdUsed ($uniqueID, $inConstructor = false) { + // Currently not used... ;-) + $isUsed = false; + + // Split the unique ID up in path and file name + $pathFile = explode("@", $uniqueID); + + // Are there two elements? Index 0 is the path, 1 the file name + global extension + if (!is_array($pathFile)) { + // No array found + if ($inConstructor) { + return false; + } else { + throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); + } + } elseif (count($pathFile) != 2) { + // Invalid ID returned! + if ($inConstructor) { + return false; + } else { + throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + } + } + + // Create full path name + $pathName = $this->getSavePath() . $pathFile[0]; + + // Check if the file is there with a file handler + if ($inConstructor) { + // No exceptions in constructors and destructors! + $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName, true); + + // Has an object being created? + if (!is_object($dirInstance)) return false; + } else { + // Outside a constructor + try { + $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName); + } catch (PathIsNoDirectoryException $e) { + // Okay, path not found + return false; + } + } + + // Initialize the search loop + $isValid = false; + while ($dataFile = $dirInstance->readDirectoryExcept(array(".", ".."))) { + // Generate FQFN for testing + $fqfn = sprintf("%s/%s", $pathName, $dataFile); + $this->setLastFile($fqfn); + + // Get instance for file handler + $inputHandler = $this->getIOInstance(); + + // Try to read from it. This makes it sure that the file is + // readable and a valid database file + $this->setLastFileContents($inputHandler->loadFileContents($fqfn)); + + // Extract filename (= unique ID) from it + $ID = substr(basename($fqfn), 0, -(strlen($this->getFileExtension()) + 1)); + + // Is this the required unique ID? + if ($ID == $pathFile[1]) { + // Okay, already in use! + $isUsed = true; + } + } + + // Close the directory handler + $dirInstance->closeDirectory(); + + // Now the same for the file... + return $isUsed; + } + + /** + * Getter for the file IO instance + * + *�@return $ioInstance An instance for IO operations + * @see FileIOHandler The concrete handler for IO operations + */ + public final function getIOInstance () { + return $this->ioInstance; + } + + /** + * Setter for the file IO instance + * + * @param $ioInstance An instance for IO operations (should be + * FileIOHandler) + * @return void + */ + public final function setIOInstance (FileIOHandler $ioInstance) { + $this->ioInstance = $ioInstance; + } + + /** + * Setter for the last read file + * + * @param $fqfn The FQFN of the last read file + * @return void + */ + private function setLastFile ($fqfn) { + // Cast string + $fqfn = (string) $fqfn; + $this->lastFile = $fqfn; + } + + /** + * Getter for last read file + * + * @return $lastFile The last read file's name with full path + */ + public final function getLastFile () { + return $this->lastFile; + } + + /** + * Setter for contents of the last read file + * + * @param $contents An array with header and data elements + * @return void + */ + private function setLastFileContents ($contents) { + // Cast array + $contents = (array) $contents; + $this->lastContents = $contents; + } + + /** + * Getter for last read file's content as an array + * + * @return $lastContent The array with elements 'header' and 'data'. + */ + public final function getLastContents () { + return $this->lastContents; + } + + /** + * Get cached (last fetched) data from the local file database + * + * @param $uniqueID The ID number for looking up the data + * @return $object The restored object from the maybe compressed + * serialized data + * @throws MismatchingCompressorsException If the compressor from + * the loaded file + * mismatches with the + * current used one. + * @throws NullPointerException If the restored object + * is null + * @throws NoObjectException If the restored "object" + * is not an object instance + * @throws MissingMethodException If the required method + * toString() is missing + */ + public function getObjectFromCachedData ($uniqueID) { + // Get instance for file handler + $inputHandler = $this->getIOInstance(); + + // Get last file's name and contents + $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID); + $contents = $this->repairContents($this->getLastContents(), $fqfn); + + // Let's decompress it. First we need the instance + $compressInstance = $this->getCompressorChannel(); + + // Is the compressor's extension the same as the one from the data? + if ($compressInstance->getCompressorExtension() != $contents['header'][0]) { + /** + * @todo For now we abort here but later we need to make this a little more dynamic. + */ + throw new MismatchingCompressorsException(array($this, $contents['header'][0], $fqfn, $compressInstance->getCompressorExtension()), self::EXCEPTION_MISMATCHING_COMPRESSORS); + } + + // Decompress the data now + $serialized = $compressInstance->getCompressor()->decompressStream($contents['data']); + + // And unserialize it... + $object = unserialize($serialized); + + // This must become a valid object, so let's check it... + if (is_null($object)) { + // Is null, throw exception + throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($object)) { + // Is not an object, throw exception + throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($object, '__toString')) { + // A highly required method was not found... :-( + throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD); + } + + // And return the object + return $object; + } + + /** + * Private method for re-gathering (repairing) the FQFN + * + * @param $fqfn The current FQFN we shall validate + * @param $uniqueID The unique ID number + * @return $fqfn The repaired FQFN when it is empty + * @throws NoArrayCreatedException If explode() has not + * created an array + * @throws InvalidArrayCountException If the array count is not + * as the expected + */ + private function repairFQFN ($fqfn, $uniqueID) { + // Cast both strings + $fqfn = (string) $fqfn; + $uniqueID = (string) $uniqueID; + + // Is there pre-cached data available? + if (empty($fqfn)) { + // Split the unique ID up in path and file name + $pathFile = explode("@", $uniqueID); + + // Are there two elements? Index 0 is the path, 1 the file name + global extension + if (!is_array($pathFile)) { + // No array found + throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); + } elseif (count($pathFile) != 2) { + // Invalid ID returned! + throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); + } + + // Create full path name + $pathName = $this->getSavePath() . $pathFile[0]; + + // Nothing cached, so let's create a FQFN first + $fqfn = sprintf("%s/%s.%s", $pathName, $pathFile[1], $this->getFileExtension()); + $this->setLastFile($fqfn); + } + + // Return repaired FQFN + return $fqfn; + } + + /** + * Private method for re-gathering the contents of a given file + * + * @param $contents The (maybe) already cached contents as an array + * @param $fqfn The current FQFN we shall validate + * @return $contents The repaired contents from the given file + */ + private function repairContents ($contents, $fqfn) { + // Is there some content and header (2 indexes) in? + if ((!is_array($contents)) || (count($contents) != 2) || (!isset($contents['header'])) || (!isset($contents['data']))) { + // No content found so load the file again + $contents = $inputHandler->loadFileContents($fqfn); + + // And remember all data for later usage + $this->setLastContents($contents); + } + + // Return the repaired contents + return $contents; + } + + /* DUMMY */ public final function loadObject () {} +} + +// [EOF] +?> diff --git a/inc/classes/main/debug/.htaccess b/inc/classes/main/debug/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/main/debug/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/debug/class_DebugConsoleOutput.php b/inc/classes/main/debug/class_DebugConsoleOutput.php new file mode 100644 index 000000000..46205f48b --- /dev/null +++ b/inc/classes/main/debug/class_DebugConsoleOutput.php @@ -0,0 +1,66 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class DebugConsoleOutput 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 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)); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/debug/class_DebugErrorLogOutput.php b/inc/classes/main/debug/class_DebugErrorLogOutput.php new file mode 100644 index 000000000..2897e948f --- /dev/null +++ b/inc/classes/main/debug/class_DebugErrorLogOutput.php @@ -0,0 +1,75 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger { + /** + * 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); + } + } + } +} + +// [EOF] +?> diff --git a/inc/classes/main/debug/class_DebugWebOutput.php b/inc/classes/main/debug/class_DebugWebOutput.php new file mode 100644 index 000000000..f79bec012 --- /dev/null +++ b/inc/classes/main/debug/class_DebugWebOutput.php @@ -0,0 +1,66 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class DebugWebOutput extends BaseFrameworkSystem implements Debugger { + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Debug-Ausgabe auf Konsole"); + + // Create an unique ID + $this->createUniqueID(); + } + + /** + * Creates an instance of this class + * + * @return $debugInstance The prepared debug instance + */ + public final static function createDebugWebOutput () { + // Get a new instance + $debugInstance = new DebugWebOutput(); + + // Return it + return $debugInstance; + } + + /** + * Outputs the given data directly + * + * @param $output The HTML output + * @return void + */ + public final function outputStream ($output) { + trigger_error($output); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/extended/.htaccess b/inc/classes/main/extended/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/main/extended/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/extended/class_ObjectLimits.php b/inc/classes/main/extended/class_ObjectLimits.php new file mode 100644 index 000000000..91dc519f8 --- /dev/null +++ b/inc/classes/main/extended/class_ObjectLimits.php @@ -0,0 +1,131 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ObjectLimits extends BaseFrameworkSystem { + /** + * Limitation array for storing all attribute names we will use later + * only. + */ + private $limitArray = null; + + /** + * Private constructor + * + * @return void + */ + private final function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set part description + $this->setPartDescr("Limitierungsobjekt"); + + // Create unique ID number + $this->createUniqueID(); + + // Clean up a little + $this->removeNumberFormaters(); + } + + /** + * Create a new ObjectLimits object and (maybe prepare it a little) + * + * @param $limitationArray The limitation array we "walk" through + * @return $limitInstance The instance to an ObjectLimits object + */ + public final static function createObjectLimits (array $limitationArray) { + // Is there a limitation array given? + if (count($limitationArray) > 0) { + // Get instance + $limitInstance = new ObjectLimits(); + + // Get all limitations and do them + foreach ($limitationArray as $limit) { + // What shall we limitate? + if ($limit instanceof FrameworkInterface) { + // Add an object + $limitInstance->addObject($limit); + } elseif (is_string($limit)) { + // Add a string + $limitInstance->addString($limit); + } else { + // Others are not supported (yet) + throw new UnsupportedLimitationPartException($limit, self::EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED); + } + } + + // Return instance + return $limitInstance; + } else { + // No limitation given so we send "null" back + return null; + } + } + + /** + * Add an object's name to the limitation list + * + * @param $object The object's name we shall add to the list + * @return void + */ + private final function addObject (FrameworkInterface $object) { + // Auto-initialization + if (is_null($this->limitArray)) { + // Initialize this array + $this->limitArray = new FrameworkArrayObject(); + } + + // Add the object's name to it + $this->limitArray->append($object->__toString()); + } + + /** + * Add a string directly to the limitation list + * + * @param $str The string we want to add directly + * @return void + */ + private final function addString ($str) { + // Auto-initialization + if (is_null($this->limitArray)) { + // Initialize this array + $this->limitArray = new FrameworkArrayObject(); + } + + // Add the direct string to ArrayObject + $this->limitArray->append($str); + } + + /** + * Getter for limitArray + * + * @return $limitArray The object ArrayObject which holds limitations + */ + public final function getLimitArray () { + return $this->limitArray; + } +} + +// [EOF] +?> diff --git a/inc/classes/main/extended/class_SerializationContainer.php b/inc/classes/main/extended/class_SerializationContainer.php new file mode 100644 index 000000000..d32551c84 --- /dev/null +++ b/inc/classes/main/extended/class_SerializationContainer.php @@ -0,0 +1,92 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class SerializationContainer extends FrameworkArrayObject { + /** + * Public constructor, if you like to have an object of this class... + * + * @return void + */ + public function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Debug message + if ((defined('DEBUG_CONTAINER')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[SerializationContainer:] Konstruktor erreicht.
\n"); + } + + /** + * Create a SerializationContainer object by applying the limitations + * in $limitInstance on $object. The resulting data container will only + * hold the attributed and their values which we have specified in + * the limitation object. + * + * @param $limitInstance The instance to the object ObjectLimits + * @param $object The origin object. We don't touch it here. + * @return $containerInstance An instance of SerializationContainer + * @throws GetterNotFoundException If a getter was not found + */ + public final static function createSerializationContainer (ObjectLimits $limitInstance, $object) { + // Get an instance + $containerInstance = new SerializationContainer(); + + // Iterate through the whole limitation array + for ($idx = $limitInstance->getLimitArray()->getIterator(); $idx->valid(); $idx->next()) { + // Get current item from list + $curr = ucfirst($idx->current()); + + // Is the required method available? + if (method_exists($object, sprintf("get%s", $curr))) { + // Generate a command for getting it + $eval = sprintf("\$value = \$object->get%s();", + $curr + ); + + // Debug eval command + if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $limitInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

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

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

\n", + $cInstance->__toString(), + htmlentities($eval) + )); + + // Run it. This will create an instance to the current class + eval($eval); + + // Is the instance valid? We have the stream handler here + if ((!is_null($tempInstance)) && (method_exists($tempInstance, 'compressStream')) && (method_exists($tempInstance, 'decompressStream'))) { + // Okay, this handler is valid + $cInstance->setCompressor($tempInstance); + + // No more searches required because we have found a valid compressor stream + break; + } + } + } + + // Close the directory + $dirPointer->closeDirectory(); + } + + // Check again if there is a compressor + if ( + (is_null($cInstance->getCompressor())) + || (!is_object($cInstance->getCompressor())) + || (!method_exists($cInstance->getCompressor(), 'compressStream')) + || (!method_exists($cInstance->getCompressor(), 'decompressStream')) + ) { + // Set the null compressor handler + $cInstance->setCompressor(NullCompressor::createNullCompressor()); + } + + // Return the compressor instance + return $cInstance; + } + + /** + * Getter for compressor instance + * + * @return $compressor The compressor instance + */ + public final function getCompressor () { + return $this->compressor; + } + + /** + * Setter for compressor + * + * @param $compressorInstance The compressor instance we shall use + * @return void + */ + public final function setCompressor (Compressor $compressorInstance) { + $this->compressor = $compressorInstance; + } + + /** + * Getter for the file extension of the current compressor + */ + public final function getCompressorExtension () { + // Get compressor extension from current compressor + return $this->getCompressor()->getCompressorExtension(); + } +} + +// [EOF] +?> diff --git a/inc/classes/middleware/database/.htaccess b/inc/classes/middleware/database/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/middleware/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/middleware/database/class_DatabaseConnection.php b/inc/classes/middleware/database/class_DatabaseConnection.php new file mode 100644 index 000000000..e6adbbe67 --- /dev/null +++ b/inc/classes/middleware/database/class_DatabaseConnection.php @@ -0,0 +1,214 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, LimitableObject { + // Array for connection data + private $connectData = array(); + + // The real database layer + private $dbLayer = null; + + // An instance of this class + private static $thisInstance = null; + + // Private constructor + private final function __construct() { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Datenbank-Mittelschicht"); + + // Create an unique ID + $this->createUniqueID(); + + // Clean up a little + $this->removeSystemArray(); + } + + // Create new database connection layer + public final static function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseFrontendInterface $dbLayer) { + // Get instance + $dbInstance = new DatabaseConnection(); + + // Set debug output handler + $dbInstance->setDebugInstance($debugInstance); + + // Set database layer + $dbInstance->setDatabaseLayer($dbLayer); + + // Set db instance + self::$thisInstance = $dbInstance; + + // Return instance + return $dbInstance; + } + + // Get an instance of this class + public final static function getInstance () { + return self::$thisInstance; + } + + // Public setter for database connection + public final function setConnectionData ($login, $pass, $dbase, $host) { + // Transfer connection data + $this->connectData['login'] = (string) $login; + $this->connectData['pass'] = (string) $pass; + $this->connectData['dbase'] = (string) $dbase; + $this->connectData['host'] = (string) $host; + } + + /** + * Save a whole object or parts of it to the database or local file + * + * @param $object The object we shall save + * @return void + * @throws NullPointerException If $limitInstance is null + * @throws NoObjectException If $limitInstance is not an object + * @throws MissingMethodException If the required method + * saveObject() was not found + */ + public final function saveObject ($object) { + // Some sanity checks + if (is_null($this->dbLayer)) { + // Is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->dbLayer)) { + // Is not an object + throw new NoObjectException($this->dbLayer, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->dbLayer, 'saveObject')) { + // Does not have the required instance + throw new MissingMethodException(array($this->dbLayer, 'saveObject'), self::EXCEPTION_MISSING_METHOD); + } + + // For now just pipe it through to the database layer + $this->dbLayer->saveObject($object); + } + + /** + * Set a limitation for the saving process. This shall be done before + * saveObject() is called else saveObject() shall save the whole object. + * + * @param $limitInstance An instance of ObjectLimits which contains + * elements we shall exclusivly include in + * saving process + * @return void + * @throws NullPointerException If $limitInstance is null + * @throws NoObjectException If $limitInstance is not an object + * @throws MissingMethodException If the required method + * limitObject() was not found + */ + public final function limitObject (ObjectLimits $limitInstance) { + // Get real database connection + $this->dbLayer = $this->getDatabaseInstance(); + + // Some sanity checks + if (is_null($this->dbLayer)) { + // Is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->dbLayer)) { + // Is not an object + throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->dbLayer, 'limitObject')) { + // Does not have the required instance + throw new MissingMethodException(array($this->dbLayer, 'limitObject'), self::EXCEPTION_MISSING_METHOD); + } + + // For now we pipe this through to the real database instance + $this->dbLayer->limitObject($limitInstance); + } + + /** + * Analyses if a unique ID has already been used or not. This method does + * only pass the given ID through to the "real" database layer. + * + * @param $uniqueID A unique ID number which shall be checked + * before it will be used + * @param $inConstructor If called from a constructor or from + * somewhere else + * @return $isUnused true = The unique ID was not found in the database, + * false = It is already in use by an other object + * @throws NullPointerException If $this->dbLayer is null + * @throws NoObjectException If $this->dbLayer is not an object + * @throws MissingMethodException If the required method + * isUniqueIdUsed() was not found + */ + public final function isUniqueIdUsed ($uniqueID, $inConstructor = false) { + // Some sanity checks + if (is_null($this->dbLayer)) { + // Is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->dbLayer)) { + // Is not an object + throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->dbLayer, 'isUniqueIdUsed')) { + // Does not have the required instance + throw new MissingMethodException(array($this->dbLayer, 'isUniqueIdUsed'), self::EXCEPTION_MISSING_METHOD); + } + + // Pass the returning result through + return $this->dbLayer->isUniqueIdUsed($uniqueID, $inConstructor); + } + + /** + * Gets cached data from the database layer and if not found fetch it from + * the database again. This method does not return the header stuff because + * The underlaying database class will return only the requested content. + * + * @param $idNumber The ID number which we need for looking up + * the requested data + * @return $cachedArray The maybe cached data from the database + * @throws NullPointerException If $this->dbLayer is null + * @throws NoObjectException If $this->dbLayer is not an object + * @throws MissingMethodException If the required method + * isUniqueIdUsed() was not found + */ + public final function getObjectFromCachedData ($idNumber) { + // Some sanity checks + if (is_null($this->dbLayer)) { + // Is null + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->dbLayer)) { + // Is not an object + throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->dbLayer, 'getObjectFromCachedData')) { + // Does not have the required instance + throw new MissingMethodException(array($this->dbLayer, 'getObjectFromCachedData'), self::EXCEPTION_MISSING_METHOD); + } + + // Pass the returning result through + return $this->dbLayer->getObjectFromCachedData($idNumber); + } + + /** + * Setter for the real database layer + * @param $dbLayer An instance of the real database layer + * @return void + */ + public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) { + $this->dbLayer = $dbLayer; + } +} + +// [EOF] +?> diff --git a/inc/classes/middleware/debug/.htaccess b/inc/classes/middleware/debug/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/middleware/debug/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/middleware/debug/class_DebugMiddleware.php b/inc/classes/middleware/debug/class_DebugMiddleware.php new file mode 100644 index 000000000..5193532e1 --- /dev/null +++ b/inc/classes/middleware/debug/class_DebugMiddleware.php @@ -0,0 +1,147 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class DebugMiddleware extends BaseMiddleware { + /** + * The concrete output instance + */ + private $outputHandler = null; + + /** + * An instance of this class + */ + private static $thisInstance = null; + + /** + * Private constructor + * + * @return void + */ + private final function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Debug-Ausgabe-Handler"); + + // Create an unique ID + $this->createUniqueID(); + + // Set own instance + self::$thisInstance = $this; + } + + /** + * Create a new debug output system. + * If no output is given this class is currently being used for back-fall. + * This fall-back mechanism will become deprecated very soon. + * + * @param $debuggerClass The class name which we shall use for + * registering the *real* debug output + * @return $debugInstance An instance of this middleware class + */ + public final static function createDebugMiddleware ($debuggerClass) { + // Create an instance if this middleware + $debugInstance = new DebugMiddleware(); + + // Is there a valid output handler provided? + if ((!is_null($debuggerClass)) && (is_object($debuggerClass)) && (method_exists($debuggerClass, 'outputStream'))) { + // Use the given output system + $debugInstance->setOutputHandler($debuggerClass); + } elseif ((!is_null($debuggerClass)) && (is_string($debuggerClass)) && (class_exists($debuggerClass))) { + // A name for a debug output class has been provided so we try to get it + $eval = sprintf("\$debuggerClass = %s::create%s();", + $debuggerClass, + $debuggerClass + ); + + // Run the constructed name + @eval($eval); + + // Was this successfull? + if ((is_object($debuggerClass)) && (method_exists($debuggerClass, "outputStream"))) { + // Set this as output class + $debugInstance->setOutputHandler($debuggerClass); + } else { + // No object or method is missing use fall-back + throw new MissingMethodException(array($debuggerClass, 'outputStream'), self::EXCEPTION_MISSING_METHOD); + } + } + + // Return instance + return $debugInstance; + } + + /** + * Getter for an instance of this class + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance() { + return self::$thisInstance; + } + + /** + * Setter for output handler + * + * @return void + */ + public final function setOutputHandler ($outputHandler) { + $this->outputHandler = $outputHandler; + } + + /** + * This method shall send debug output which can be HTML code for the + * browser or debug lines for a log file, etc. to the registered debug + * output handler. + * + * @return void + */ + public final function output ($outStream) { + // Check if the output handler is valid + if (is_null($this->outputHandler)) { + // Debug output handler was not set + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($this->outputHandler)) { + // The debug output handler is not an object + throw new NoObjectException($this->ouputHandler, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($this->outputHandler, 'outputStream')) { + // The required method outputStream() is missing + throw new MissingMethodException(array($this->outputHandler, 'outputStream'), self::EXCEPTION_MISSING_METHOD); + } + + // Is the output stream set + if (empty($outStream)) { + // Initialization phase + return; + } + + // Use the output handler + $this->outputHandler->outputStream($outStream); + } +} + +// [EOF] +?> diff --git a/inc/classes/middleware/io/.htaccess b/inc/classes/middleware/io/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/classes/middleware/io/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/middleware/io/class_FileIOHandler.php b/inc/classes/middleware/io/class_FileIOHandler.php new file mode 100644 index 000000000..7e624cccf --- /dev/null +++ b/inc/classes/middleware/io/class_FileIOHandler.php @@ -0,0 +1,181 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class FileIOHandler extends BaseMiddleware { + /** + * The *real* file input class we shall use for reading data + */ + private $inputStream = null; + + /** + * The *real* file output class we shall use for reading data + */ + private $outputStream = null; + + /** + * An instance of this class + */ + private static $thisInstance = null; + + /** + * Private constructor + * + * @return void + */ + private function __construct () { + // Call parent constructor + parent::constructor(__CLASS__); + + // Set description + $this->setPartDescr("Datei-Ein-/Ausgabe-Handler"); + + // Create an unique ID + $this->createUniqueID(); + + // Clean up a little + $this->removeNumberFormaters(); + $this->removeSystemArray(); + + // Set own instance + self::$thisInstance = $this; + } + + /** + * Creates an instance of this class and prepares the IO system. This is + * being done by setting the default file IO class + * + * @return $ioInstance A prepared instance of FilIOHandler + */ + public final static function createFileIOHandler () { + // Get instance + $ioHandler = new FileIOHandler(); + + // Set the *real* file IO instances (both the same) + $ioHandler->setInputStream(FileIOStream::createFileIOStream()); + $ioHandler->setOutputStream(FileIOStream::createFileIOStream()); + + // Return instance + return $ioHandler; + } + + /** + * Getter for an instance of this class + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance () { + return self::$thisInstance; + } + + /** + * Setter for the *real* file input instance + * + * @param $inputStream The *real* file-input class + */ + public final function setInputStream (FileInputStreamer $inputStream) { + $this->inputStream = $inputStream; + } + + /** + * Getter for the *real* file input instance + * + * @return $inputStream The *real* file-input class + */ + public final function getInputStream () { + return $this->inputStream; + } + + /** + * Setter for the *real* file output instance + * + * @param $outputStream The *real* file-output class + */ + public final function setOutputStream (FileOutputStreamer $outputStream) { + $this->outputStream = $outputStream; + } + + /** + * Getter for the *real* file output instance + * + * @return $outputStream The *real* file-output class + */ + public final function getOutputStream () { + return $this->outputStream; + } + + /** + * Saves a file with data by using the current output stream + * + * @see FileOutputStreamer + */ + public function saveFile ($fileName, $dataArray) { + // Get output stream + $outInstance = $this->getOutputStream(); + + // Is it a valid stream? + if (is_null($outInstance)) { + // No class returned + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($outInstance)) { + // Not an object! ;-( + throw new NoObjectException($outInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($outInstance, 'saveFile')) { + // Nope, so throw exception + throw new MissingMethodException(array($outInstance, 'saveFile'), self::EXCEPTION_MISSING_METHOD); + } + + // Send the fileName and dataArray to the output handler + $outInstance->saveFile($fileName, $dataArray); + } + + /** Loads data from a file over the input handler + * + * @see FileInputStreamer + */ + public function loadFileContents ($fqfn) { + // Initialize the array + $array = array(); + + // Get output stream + $inInstance = $this->getInputStream(); + + // Is it a valid stream? + if (is_null($inInstance)) { + // No class returned + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } elseif (!is_object($inInstance)) { + // Not an object! ;-( + throw new NoObjectException($inInstance, self::EXCEPTION_IS_NO_OBJECT); + } elseif (!method_exists($inInstance, 'loadFileContents')) { + // Nope, so throw exception + throw new MissingMethodException(array($inInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD); + } + + // Read from the input handler + return $inInstance->loadFileContents($fqfn); + } +} + +// [EOF] +?> diff --git a/inc/config-local.php b/inc/config-local.php new file mode 100644 index 000000000..99b4e6627 --- /dev/null +++ b/inc/config-local.php @@ -0,0 +1,29 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// CFG: DEFAULT-APPLICATION +$cfg->setConfigEntry("default_application", "mxchange"); + +// [EOF] +?> diff --git a/inc/config.php b/inc/config.php new file mode 100644 index 000000000..3a14eaa9c --- /dev/null +++ b/inc/config.php @@ -0,0 +1,157 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Load the class from inc/config direktory +@require_once(dirname(__FILE__) . "/config/class_FrameworkConfiguration.php"); + +// Get a new configuration instance +$cfg = FrameworkConfiguration::createFrameworkConfiguration(); + +// CFG: SERVER-PATH +$cfg->definePath(dirname(dirname(__FILE__)) . "/"); // DON'T MISS THE TRAILING SLASH!!! + +// CFG: DATABASE-TYPE +$cfg->defineDatabaseType("local"); + +// CFG: TIME-ZONE +$cfg->setDefaultTimezone("Europe/Berlin"); + +// CFG: MAGIC-QUOTES-RUNTIME +$cfg->setMagicQuotesRuntime(false); + +// CFG: PHP-SCRIPT-EXTENSION +$cfg->setConfigEntry("php_extension", ".php"); + +// CFG: CLASS-PREFIX +$cfg->setConfigEntry("class_prefix", "class_"); + +// CFG: CLASS-SUFFIX +$cfg->setConfigEntry("class_suffix", ".php"); + +// CFG: RAW-TEMPLATE-EXTENSION +$cfg->setConfigEntry("raw_template_extension", ".tpl"); + +// CFG: CODE-TEMPLATE-EXTENSION +$cfg->setConfigEntry("code_template_extension", ".ctp"); + +// CFG: SELECTOR-GET +$cfg->setConfigEntry("app_selector_get", "app"); + +// CFG: APPLICATION-HELPER +$cfg->setConfigEntry("app_helper_class", "ApplicationHelper"); + +// CFG: SELECTOR-PATH +$cfg->setConfigEntry("selector_path", "selector"); + +// CFG: TEMPLATE-BASE-PATH +$cfg->setConfigEntry("tpl_base_path", "templates/"); // DON'T MISS THE TRAILING SLASH! + +// CFG: LANGUAGE-BASE-PATH +$cfg->setConfigEntry("lang_base_path", "inc/language/"); // DON'T MISS THE TRAILING SLASH! + +// CFG: COMPRESSOR-BASE-PATH +$cfg->setConfigEntry("compressor_base_path", "inc/classes/main/compressor/"); // DON'T MISS THE TRAILING SLASH! + +// CFG: APPLICATION-PATH +$cfg->setConfigEntry("application_path", "application"); + +// CFG: COMPILE-OUTPUT-PATH +$cfg->setConfigEntry("compile_output_path", "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH! + +// CFG: TEMPLATE-ENGINE +$cfg->setConfigEntry("tpl_engine", "TemplateEngine"); + +// CFG: DEBUG-ENGINE +$cfg->setConfigEntry("debug_engine", "DebugWebOutput"); + +// CFG: DEFAULT-LANGUAGE +$cfg->setConfigEntry("default_lang", "de"); // A two-char language string: de for german, en for english and so on + +// CFG: WEB-TEMPLATE-TYPE +$cfg->setConfigEntry("web_template_type", "html"); + +// CFG: EMAIL-TEMPLATE-TYPE +$cfg->setConfigEntry("email_template_type", "emails"); + +// CFG: CODE-TEMPLATE-TYPE +$cfg->setConfigEntry("code_template_type", "code"); + +// CFG: WEB-ENGINE +$cfg->setConfigEntry("web_engine", "WebOutput"); + +// CFG: SELECTOR-TEMPLATE-PREFIX +$cfg->setConfigEntry("tpl_selector_prefix", "selector"); + +// CFG: WEB-CONTENT-TYPE +$cfg->setConfigEntry("web_content_type", "text/html"); + +// CFG: VALID-TEMPLATE-VARIABLE +$cfg->setConfigEntry("tpl_valid_var", "content"); + +// CFG: META-AUTHOR +$cfg->setConfigEntry("meta_author", "Roland Häder"); + +// CFG: META-PUBLISHER +$cfg->setConfigEntry("meta_publisher", "Roland Häder"); + +// CFG: META-KEYWORDS +$cfg->setConfigEntry("meta_keywords", "test,test,test"); + +// CFG: META-DESCRIPTION +$cfg->setConfigEntry("meta_description", "A lame description for an application framework"); + +// CFG: LAUNCH-METHOD +$cfg->setConfigEntry("entry_method", "entryPoint"); + +// CFG: SELECTOR-MAIN-TEMPLATE +$cfg->setConfigEntry("selector_main_tpl", "selector_main"); + +// CFG: SELECTOR-APPS-TEMPLATE +$cfg->setConfigEntry("selector_apps_tpl", "selector_apps"); + +// CFG: SELECTOR-NAME +$cfg->setConfigEntry("selector_name", "selector"); + +// CFG: DEFAULT-APPLICATION +$cfg->setConfigEntry("default_application", "selector"); + +// CFG: VERBOSE-LEVEL +$cfg->setConfigEntry("verbose_level", 0); + +// Shall we include config-local.php where you can configure some things? Then +// We need to do some things: +// +// First generate FQFN +$localConfig = sprintf("%sinc/config-local%s", PATH, $cfg->readConfig("php_extension")); + +// Second is the file there and readable? +if ((file_exists($localConfig)) && (is_readable($localConfig))) { + // The third step to load it + require_once($localConfig); +} + +// [EOF] +?> diff --git a/inc/config/.htaccess b/inc/config/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/config/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/config/class_FrameworkConfiguration.php b/inc/config/class_FrameworkConfiguration.php new file mode 100644 index 000000000..a1ca42a3a --- /dev/null +++ b/inc/config/class_FrameworkConfiguration.php @@ -0,0 +1,299 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class FrameworkConfiguration { + /** + * Include files which shall be included before the main loader. + */ + private $moreIncPre = null; + + /** + * Include files which shall be included after the main loader. + */ + private $moreIncPost = null; + + /** + * The framework's main configuration array which will be initialized with + * hard-coded configuration data and might be overwritten/extended by + * config data from the database. + */ + private $config = array(); + + /** + * The configuration instance itself + */ + private static $cfgInstance = null; + + // Some constants for the configuration system + const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0xc00; + const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0xc01; + + /** + * Private constructor + */ + private function __construct () { + // Initialize both include lists + $this->moreIncPre = new ArrayObject(); + $this->moreIncPost = new ArrayObject(); + } + + /** + * "Create" a configuration instance + */ + public final static function createFrameworkConfiguration ($enableDebug = false) { + /** + * For singleton design pattern because we only need a one-time-run + * through the initial configuration. + */ + if (is_null(self::$cfgInstance)) { + // CFG: DEBUG-LEVEL + @error_reporting(E_ALL | E_STRICT); + + /** + * Shall we enable the debug mode? + */ + if ($enableDebug) { + define('DEBUG_MODE', true); + } + + /** + * Crate a config instance + */ + self::$cfgInstance = new FrameworkConfiguration(); + } + + /** + * Return the instance + */ + return self::$cfgInstance; + } + + /** + * Getter for an instance of this class + * + * @return $cfgInstance An instance of this class + */ + public final static function getInstance () { + return self::$cfgInstance; + } + + /** + * Setter for default time zone (must be correct!) + * + * @param $zone The time-zone string (e.g. Europe/Berlin) + * @return void + */ + public final function setDefaultTimezone ($zone) { + // At least 5.1.0 is required for this! + if (version_compare(phpversion(), "5.1.0")) { + @date_default_timezone_set($zone); + } + } + + /** + * Setter for runtime magic quotes + */ + public final function setMagicQuotesRuntime ($enableQuotes) { + // Cast it to boolean + $enableQuotes = (boolean) $enableQuotes; + + // Set it + @set_magic_quotes_runtime($enableQuotes); + } + + /** + * A private include loader + * + * @param $arrayObject The array object with all include files + * @return void + */ + private function loadIncludes (ArrayObject $arrayObject) { + // Load only if there are includes defined + if (!is_null($arrayObject)) { + for ($idx = $arrayObject->getIterator(); $idx->valid(); $idx->next()) { + // Get include file + $inc = $idx->current(); + + // Is the file name really set? + if (!empty($inc)) { + // Base path added? (Uni* / Windows) + if ((substr($inc, 0, 1) != "/") && (substr($inc, 1, 1) != ":")) { + // Generate FQFN + $fqfn = sprintf("%s/inc/extra/%s", PATH, $inc); + } else { + // Base path is already added + $fqfn = $inc; + } + } + + // Include them all here + require($fqfn); + } + } + } + + /** + * Load all includes before main loader and clears the array after usage + * + * @return void + */ + public function loadPreIncludes () { + $this->loadIncludes($this->moreIncPre); + unset($this->moreIncPre); + } + + /** + * Load all includes after main loader and clears the array after usage + * + * @return void + */ + public function loadPostIncludes () { + $this->loadIncludes($this->moreIncPost); + unset($this->moreIncPost); + } + + /** + * Define the database type which must be valid and will not be verified. + * + * @param $type The database type. See path inc/database/. + * @return void + */ + public function defineDatabaseType ($type) { + // Is it defined or not? + if (!defined('_DB_TYPE')) { + // Cast to string + $type = (string) $type; + + // Set the constant + define('_DB_TYPE', $type); + } else { + // Already defined! But we cannot throw an exception here... :( + ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the database type only once in your application!", + __CLASS__ + )); + } + } + + /** + * Define the local file path + * + * @param $path The database type. See path inc/database/. + * @return void + */ + public function definePath ($path) { + // Cast to string + $path = (string) $path; + + // Replace backslashes with slashes + $path = str_replace("\\", "/", $path); + + // Is it defined or not? + if ((!is_dir($path)) || (!is_readable($path))) { + // Is not a valid path + ApplicationEntryPoint::app_die(sprintf("[%s:] Invalid path (not found) specified. Please make sure it is created.", + __CLASS__ + )); + } elseif (!defined('PATH')) { + // Set the constant + define('PATH', $path); + } else { + // Already defined! But we cannot throw an exception here... :( + ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the local file path only once in your application.", + __CLASS__ + )); + } + } + + /** + * Read a configuration element. + * + * @param $cfgEntry The configuration element + * @return $cfgValue The fetched configuration value + * @throws ConfigEntryIsEmptyException If $cfgEntry is empty + * @throws ConfigEntryNotFoundException If a configuration element + * was not found + */ + public function readConfig ($cfgEntry) { + // Cast to string + $cfgEntry = (string) $cfgEntry; + + // Is a valid configuration entry provided? + if (empty($cfgEntry)) { + // Entry is empty + throw new ConfigEntryIsEmptyException(__CLASS__, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY); + } elseif (!isset($this->config[$cfgEntry])) { + // Entry was not found! + throw new ConfigEntryNotFoundException(array(__CLASS__, $cfgEntry), self::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND); + } + + // Debug message + if ((defined('DEBUG_CONFIG')) || (defined('DEBUG_ALL'))) { + echo "[".__METHOD__."] Configuration entry ".$cfgEntry." requested.
\n"; + } + + // Return the requested value + return $this->config[$cfgEntry]; + } + + /** + * Set a configuration entry. + * + * @param $cfgEntry The configuration entry we want to add/change + * @param $cfgValue The configuration value we want to set + * @return void + * @throws ConfigEntryIsEmptyException If $cfgEntry is empty + */ + public final function setConfigEntry ($cfgEntry, $cfgValue) { + // Cast to string + $cfgEntry = (string) $cfgEntry; + $cfgValue = (string) $cfgValue; + + // Is a valid configuration entry provided? + if (empty($cfgEntry)) { + // Entry is empty + throw new ConfigEntryIsEmptyException(__CLASS__, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY); + } + + // Set the configuration value + $this->config[$cfgEntry] = $cfgValue; + + // Resort the array + ksort($this->config); + } + + /** + * Compatiblity method to return this class' name + * + * @return __CLASS__ This class' name + */ + public function __toString () { + return get_class($this); + } +} // END - class + +// [EOF] +?> diff --git a/inc/database.php b/inc/database.php new file mode 100644 index 000000000..a8a9fcf41 --- /dev/null +++ b/inc/database.php @@ -0,0 +1,91 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Initialize layer +$layer = null; + +// Is the type defined? +if (!defined('_DB_TYPE')) { + // Abort here + ApplicationEntryPoint::app_die("[Main:] Please define a database type first!
+E.g.:
$GLOBALS['cfg']->defineDatabaseType("local");
+This will choose the local-file-based database type (layer)"); +} + +// Generate FQFN for the database layer +$INC = sprintf("%sinc/database/lib-%s%s", PATH, _DB_TYPE, FrameworkConfiguration::getInstance()->readConfig("php_extension")); + +// Load the database layer include +if ((file_exists($INC)) && (is_file($INC)) && (is_readable($INC))) { + // Load the layer + require_once($INC); +} else { + // Layer is missing! + ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer is missing! (%s) -> R.I.P.", + _DB_TYPE + )); +} + +// Clean it up +unset($INC); + +// Prepare database instance +try { + $db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layer); +} catch (NullPointerException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (InvalidDirectoryResourceException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (PathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (PathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (PathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} catch (DirPointerNotOpenedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + $e->getMessage() + )); +} + +// Datenbankobjekt debuggen +if (defined('DEBUG_DATABASE_OBJ')) { + DebugMiddleware::getInstance()->output(sprintf("Die Datenbank-Schicht sieht wie folgt aus:
+
%s
\n", + print_r($db, true) + )); +} + +// [EOF] +?> diff --git a/inc/database/.htaccess b/inc/database/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/database/lib-local.php b/inc/database/lib-local.php new file mode 100644 index 000000000..90b1c0733 --- /dev/null +++ b/inc/database/lib-local.php @@ -0,0 +1,51 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Zum Testen speichern wir in lokale Dateien (LocalFileDatabase) +try { + $layer = LocalFileDatabase::createLocalFileDatabase(PATH . "db/", FileIOHandler::getInstance()); +} catch (SavePathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} catch (SavePathNotFoundException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} catch (SavePathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} catch (SavePathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} catch (SavePathWriteProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: %s
\n", + $e->getMessage() + )); +} + +// [EOF] +?> diff --git a/inc/file_io.php b/inc/file_io.php new file mode 100644 index 000000000..92c96b6c4 --- /dev/null +++ b/inc/file_io.php @@ -0,0 +1,31 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Get the instance +$io = FileIOHandler::createFileIOHandler(); + +// [EOF] +?> diff --git a/inc/includes.php b/inc/includes.php new file mode 100644 index 000000000..b2533f852 --- /dev/null +++ b/inc/includes.php @@ -0,0 +1,60 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Include the class loader function +require(sprintf("%sinc/loader/class_ClassLoader%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); + +/** + * Is the devel package included? + */ +if (is_dir(sprintf("%sdevel", PATH))) { + /** + * Load all development includes + */ + ClassLoader::getInstance()->loadClasses("devel"); +} + +/** + * Load additional include files before main load + */ +FrameworkConfiguration::getInstance()->loadPreIncludes(); + +/** + * Load all main include files + * + * +++ MAIN LOADER! +++ + * + */ + +/////////////////////////////////////////////////// +// Maybe we need this place for future releases? // +/////////////////////////////////////////////////// + +/** + * Load additional include files after main load + */ +FrameworkConfiguration::getInstance()->loadPostIncludes(); + +// [EOF] +?> diff --git a/inc/language.php b/inc/language.php new file mode 100644 index 000000000..c80654539 --- /dev/null +++ b/inc/language.php @@ -0,0 +1,47 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +try { + $lang = LanguageSystem::createLanguageSystem(sprintf("%s%s", + PATH, + FrameworkConfiguration::getInstance()->readConfig("lang_base_path") + )); +} catch (LanguagePathIsEmptyException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + $e->getMessage() + )); +} catch (InvalidLanguagePathStringException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + $e->getMessage() + )); +} catch (LanguagePathIsNoDirectoryException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + $e->getMessage() + )); +} catch (LanguagePathReadProtectedException $e) { + ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + $e->getMessage() + )); +} + +// [EOF] +?> diff --git a/inc/language/.htaccess b/inc/language/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/language/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/loader/.htaccess b/inc/loader/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/inc/loader/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php new file mode 100644 index 000000000..cd065629b --- /dev/null +++ b/inc/loader/class_ClassLoader.php @@ -0,0 +1,276 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ---------------------------------- + * 1.1 + * - loadClasses rewritten to fix some notices + * 1.0 + * - Initial release + * ---------------------------------- + */ +class ClassLoader { + /** + * Configuration array + */ + private $cfg = array(); + + /** + * An ArrayObject for found classes + */ + private $classes = null; + + /** + * Suffix with extension for all class files + */ + private $prefix = "class_"; + + /** + * Suffix with extension for all class files + */ + private $suffix = ".php"; + + /** + * Length of the suffix. Will be overwritten later. + */ + private $sufLen = 0; + + /** + * Length of the prefix. Will be overwritten later. + */ + private $preLen = 0; + + /** + * A list for directory names (no leading/trailing slashes!) which not be scanned by the path scanner + * @see scanLocalPath + */ + private $ignoreList = array(); + + /** + * An ArrayList object for include directories + */ + private $dirList = null; + + /** + * Debug this class loader? (true = yes, false = no) + */ + private $debug = false; + + /** + * Counter for scanned directories (debug output) + */ + private $dirCnt = 0; + + /** + * Counter for loaded classes (debug output) + */ + private $classCnt = 0; + + /** + * Instance of this class + */ + private static $thisInstance = null; + + /** + * The *public* constructor + * + * @param $cfgInstance Configuration class instance + * @return void + */ + public function __construct (FrameworkConfiguration $cfgInstance) { + // Init the array list + $this->dirList = new ArrayObject(); + + // Set suffix and prefix from configuration + $this->suffix = $cfgInstance->readConfig("class_suffix"); + $this->prefix = $cfgInstance->readConfig("class_prefix"); + + // Estimate length of prefix and suffix for substr() function (cache) + $this->sufLen = strlen($this->suffix); + $this->preLen = strlen($this->prefix); + + // Set configuration instance + $this->cfgInstance = $cfgInstance; + + // Initialize the classes list + $this->classes = new ArrayObject(); + + // Set own instance + self::$thisInstance = $this; + } + + /** + * Getter for an instance of this class + * + * @return $thisInstance An instance of this class + */ + public final static function getInstance () { + return self::$thisInstance; + } + + /** + * Scans recursively a local path for class files which must have a prefix and a suffix as given by $this->suffix and $this->prefix + * + * @param $basePath The relative base path to PATH constant for all classes + * @param $ignoreList An optional list (array or string) of directory names which shall be ignored + * @return void + */ + public function loadClasses ($basePath, $ignoreList = array() ) { + // Convert string to array + if (!is_array($ignoreList)) $ignoreList = array($ignoreList); + + // Directories which our class loader ignores by default while + // deep-scanning the directory structure. See scanLocalPath() for + // details. + $ignoreList[] = "."; + $ignoreList[] = ".."; + $ignoreList[] = ".htaccess"; + + // Keep it in class for later usage + $this->ignoreList = $ignoreList; + + // Set base directory which holds all our classes, we should use an + // absolute path here so is_dir(), is_file() and so on will always + // find the correct files and dirs. + $basePath2 = realpath($basePath); + + // If the basePath is false it is invalid + if ($basePath2 === false) { + // TODO: Do not die here. + die("Cannot read {$basePath} !"); + } else { + // Set base path + $basePath = $basePath2; + } + + // Load all super classes (backward, why ever this name... :-? ) + // We don't support sub directories here... + $this->scanLocalPath($basePath); + + // While there are directories in our list scan them for classes + $cnt = 0; + while ($cnt != $this->dirList->count()) { + for ($idx = $this->dirList->getIterator(); $idx->valid(); $idx->next()) { + // Get current path + $currPath = $idx->current(); + + // Remove the current entry or else this will lead into a infinite loop + $this->dirList->offsetSet($idx->key(), ""); + + // Scan the directory + $this->scanLocalPath($currPath); + } + + // Check if we can leave + $cnt = 0; + for ($idx = $this->dirList->getIterator(); $idx->valid(); $idx->next()) { + if ($idx->current() == "") $cnt++; + } + } + } + + /** + * The local path scanner. A found class will be loaded immediately + * @param $localPath The local path which shall be recursively scanned for include files + * @return void + */ + private function scanLocalPath ($localPath) { + // Empty path names will be silently ignored + if (empty($localPath)) return; + + // TODO: No dies here, mayybe this should be rewritten to throw an exception? + $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($localPath); + while ($dirClass = $dirInstance->readDirectoryExcept($this->ignoreList)) { + // We need the relative dir name as an array index some lines below + $dirClass2 = $dirClass; + + // A nice replacement for a simple dot ;) + $dirClass = sprintf("%s/%s", $localPath, $dirClass); + + // Is a readable file with configured prefix and suffix? All other + // files will silently be ignored! + //* DEBUG: */ print "Prefix=".$this->prefix."(".substr($dirClass2, 0 , $this->preLen).")\n"; + //* DEBUG: */ print "Suffix=".$this->suffix."(".substr($dirClass2, -$this->sufLen, $this->sufLen).")\n"; + //* DEBUG: */ print "ENTRY={$dirClass}\n"; + if ( + (is_file($dirClass)) + && (is_readable($dirClass)) + && (substr($dirClass2, 0 , $this->preLen) == $this->prefix) + && (substr($dirClass2, -$this->sufLen, $this->sufLen) == $this->suffix) + ) { + // Class found so load it instantly + //* DEBUG: */ print "CLASS={$dirClass}\n"; + $this->classes->append($dirClass); + $this->classCnt++; + } elseif (is_dir($dirClass) && !in_array($dirClass2, $this->ignoreList)) { + // Directory found and added to list + //* DEBUG: */ print "DIR={$dirClass}\n"; + if ($dirClass2 == "interfaces") { + $this->scanLocalPath($dirClass); + } else { + $this->dirList->append($dirClass); + } + $this->dirCnt++; + } + //* DEBUG: */ print "LOOP!\n"; + } // END - while + + // Close directory handler + $dirInstance->closeDirectory(); + + // Output counter in debug mode + if (defined('DEBUG_MODE')) print(sprintf("[%s:] %d Klassendateien in %d Verzeichnissen gefunden und geladen.
\n", + __CLASS__, + $this->classCnt, + $this->dirCnt + )); + } + + /** + * Includes all found classes + * @return void + */ + public function includeAllClasses () { + if (is_object($this->classes)) { + // Load all classes + for ($idx = $this->classes->getIterator(); $idx->valid(); $idx->next()) { + // Load current class + //* DEBUG: */ print "Class=".$idx->current()."\n"; + require_once($idx->current()); + } + + // Re-initialize the classes list + $this->classes = new ArrayObject(); + } + } +} + +// Initial load of core classes and the FrameworkDirectoryPointer class +require_once(sprintf("%sinc/classes/interfaces/class_FrameworkInterface%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); +require_once(sprintf("%sinc/classes/main/class_BaseFrameworkSystem%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); +require_once(sprintf("%sinc/classes/main/io/class_FrameworkDirectoryPointer%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); + +// Initialize the class loader +$loader = new ClassLoader(FrameworkConfiguration::getInstance()); + +// [EOF] +?> diff --git a/inc/output.php b/inc/output.php new file mode 100644 index 000000000..275f13927 --- /dev/null +++ b/inc/output.php @@ -0,0 +1,32 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Debug-Ausgabe vorbereiten +$debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig("debug_engine")); + +// Leere Strings werden ignoriert und sollten zum Testen der Middleware genommen werden +DebugMiddleware::getInstance()->output(""); + +// [EOF] +?> diff --git a/inc/selector.php b/inc/selector.php new file mode 100644 index 000000000..23acabec7 --- /dev/null +++ b/inc/selector.php @@ -0,0 +1,92 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Does the user has an application specified? +if (!empty($_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")])) { + // Set the application from string + $application = (string) $_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")]; +} elseif (!empty($_SERVER['argv'][1])) { + // Set the application from string + $application = (string) $_SERVER['argv'][1]; + $app = explode("=", trim($application)); + if ($app[0] == FrameworkConfiguration::getInstance()->readConfig("app_selector_get")) { + // Application is valid! + $application = trim($app[1]); + } else { + // Invalid entry found, first must be "app"! + $application = FrameworkConfiguration::getInstance()->readConfig("default_application"); + } +} else { + // Set the "application selector" application + $application = FrameworkConfiguration::getInstance()->readConfig("default_application"); +} + +// Secure it, by keeping out tags +$application = htmlentities(strip_tags($application), ENT_QUOTES); + +// Secure it a little more with a reg.exp. +$application = preg_replace('/([^a-z_-])+/i', "", $application); + +// Try to load these includes in the given order +$configAppIncludes = array( + sprintf("class_%s", FrameworkConfiguration::getInstance()->readConfig("app_helper_class")), // The ApplicationHelper class + "config", // The application's own configuration + "init", // The application initializer + "loader", // The application's class loader + "debug", // Some debugging stuff + "exceptions", // The application's own exception handler + "starter", // The application starter (calls entryPoint(), etc.) +); + +// Load them all (try only) +foreach ($configAppIncludes as $inc) { + // Skip starter in test mode + if (($inc == "starter") && (defined('TEST'))) { + // Skip it here + continue; + } + + // Generate a FQFN for the helper class + $fqfn = sprintf("%s%s/%s/%s%s", + PATH, + FrameworkConfiguration::getInstance()->readConfig("application_path"), + $application, + $inc, + FrameworkConfiguration::getInstance()->readConfig("php_extension") + ); + + // Does the include file exists? + if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) { + // Load it + require_once($fqfn); + } elseif (FrameworkConfiguration::getInstance()->readConfig("verbose_level") > 0) { + // File is missing + trigger_error(sprintf("Cannot load application script %s! File is missing or read-protected.", + $inc . FrameworkConfiguration::getInstance()->readConfig("php_extension") + )); + } +} + +// [EOF] +?> diff --git a/index.php b/index.php new file mode 100644 index 000000000..86b8c446e --- /dev/null +++ b/index.php @@ -0,0 +1,150 @@ + + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class ApplicationEntryPoint { + /** + * The instances we want to remove after all is done + * + * @return void + */ + private static $instances = array ( + 'cfg', // The configuration system + 'loader', // The class loader system + 'debug', // Debug output + 'db', // Database layer + 'io', // Base I/O system (local file [or network]) + 'engine', // Template engine ( for ApplicationEntryPoint::app_die() ) + 'lang', // Language sub-system + 'app', // The ApplicationHelper instance + ); + + /** + * The application's emergency exit + * + * @param $message The optional message we shall output on exit + * @return void + */ + public static function app_die ($message = "") { + // Is a message set? + if (empty($message)) { + // No message provided + $message = "No message provided!"; + } + + // Get some instances + $tpl = FrameworkConfiguration::getInstance()->readConfig("tpl_engine"); + $lang = LanguageSystem::getInstance(); + $io = FileIOHandler::getInstance(); + + // Is the template engine loaded? + if ((class_exists($tpl)) && (is_object($lang)) && (is_object($io))) { + // Use the template engine for putting out (nicer look) the message + try { + $eval = sprintf("\$tplEngine = %s::create%s(\"%s%s\", LanguageSystem::getInstance(), FileIOHandler::getInstance());", + FrameworkConfiguration::getInstance()->readConfig("tpl_engine"), + FrameworkConfiguration::getInstance()->readConfig("tpl_engine"), + PATH, + FrameworkConfiguration::getInstance()->readConfig("tpl_base_path") + ); + eval($eval); + } catch (BasePathIsEmptyException $e) { + die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", + $e->getMessage() + )); + } catch (InvalidBasePathStringException $e) { + die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", + $e->getMessage() + )); + } catch (BasePathIsNoDirectoryException $e) { + die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", + $e->getMessage() + )); + } catch (BasePathReadProtectedException $e) { + die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: %s", + $e->getMessage() + )); + } + + // Assign message + $tplEngine->assignVariable("message", $message); + + // Load the template + $tplEngine->loadCodeTemplate("emergency_exit"); + + // Compile the template + $tplEngine->compileTemplate(); + + // Compile all variables + $tplEngine->compileVariables(); + + // Output all + $tplEngine->output(); + + // Good bye... + exit(); + } else { + // Output message and die + die(sprintf("[Main:] Emergency exit reached: %s", + $message + )); + } + } + + /** + * The application's main entry point. This class isolates some local + * variables which shall not become visible to outside because of security + * concerns. We are doing this here to "emulate" the well-known entry + * point in Java(tm). + * + * @return void + */ + public static function main () { + // Some non-global common arrays we need... + global $_SERVER; + + // Load config file + require(dirname(__FILE__) . "/inc/config.php"); + + // Load all include files + require(PATH . "inc/includes.php"); + + // Load all framework classes + require(PATH . "inc/classes.php"); + + // Include the application selector + require(PATH . "inc/selector.php"); + + } // END - main() + +} // END - class + +// Do not remove the following line: +ApplicationEntryPoint::main(); + +// [EOF] +?> diff --git a/rebuild_doc.sh b/rebuild_doc.sh new file mode 100755 index 000000000..697ed08af --- /dev/null +++ b/rebuild_doc.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +echo "$0: Cleaning up..." +find docs/html/ -type f -exec rm -f {} \; +rm -f docs/*.log +echo "$0: Done." + +doxygen Doxyfile diff --git a/ship-simu/Doxyfile b/ship-simu/Doxyfile deleted file mode 100644 index 5d5b89373..000000000 --- a/ship-simu/Doxyfile +++ /dev/null @@ -1,1321 +0,0 @@ -# Doxyfile 1.5.4 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file that -# follow. The default is UTF-8 which is also the encoding used for all text before -# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into -# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of -# possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = MXChangeHub - -# 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.0.0 - -# 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/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/ - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = YES - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = YES - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is -# documented as struct with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code where the coding convention is that all structs are -# typedef'ed and only the typedef is referenced never the struct's name. - -TYPEDEF_HIDES_STRUCT = NO - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = YES - -# If this flag is set to YES, the members of anonymous namespaces will be extracted -# and appear in the documentation as a namespace called 'anonymous_namespace{file}', -# where file will be replaced with the base name of the file that contains the anonymous -# namespace. By default anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = YES - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text " - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = /var/www/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/ship-simu/ - -# This tag can be used to specify the character encoding of the source files that -# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default -# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. -# See http://www.gnu.org/software/libiconv for the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.php - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = */docs/* \ - */ship-simu.org/* - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the output. -# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, -# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH -# then you must also enable this option. If you don't then doxygen will produce -# a warning and turn it on anyway - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 3 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = YES - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = YES - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to -# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to -# specify the directory where the mscgen tool resides. If left empty the tool is assumed to -# be found in the default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = NO - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = YES - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = YES - -# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. - -CALLER_GRAPH = YES - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the number -# of direct children of the root node in a graph is already larger than -# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = YES diff --git a/ship-simu/application/.htaccess b/ship-simu/application/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/.htaccess b/ship-simu/application/hub/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/class_ApplicationHelper.php b/ship-simu/application/hub/class_ApplicationHelper.php deleted file mode 100644 index 60409b70c..000000000 --- a/ship-simu/application/hub/class_ApplicationHelper.php +++ /dev/null @@ -1,182 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class 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 hub system - * - * @return void - */ - public final function entryPoint () { - // Get a core loop instance - $hubInstance = HubCoreLoop::createHubCoreLoop(); - - // Output some text - $hubInstance->outputIntro(); - - // Contact the master hub - $hubInstance->contactMasterHub(); - - // The main loop begins here - $hubInstance->coreLoop(); - - // Shutdown the hub - $hubInstance->shutdownHub(); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/config.php b/ship-simu/application/hub/config.php deleted file mode 100644 index 926ab2e18..000000000 --- a/ship-simu/application/hub/config.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Some hub-specific configuration like port hostname where we will listen, etc. -$cfg = FrameworkConfiguration::getInstance(); - -// CFG: HUB-LISTEN-ADDR -$cfg->setConfigEntry("hub_listen_addr", "0.0.0.0"); - -// CFG: HUB-LISTEN-PORT (zero = auto-choose) -$cfg->setConfigEntry("hub_listen_port", 9050); - -// CFG: TEMPLATE-ENGINE -$cfg->setConfigEntry("tpl_engine", "ConsoleOutput"); - -// CFG: WEB-ENGINE -$cfg->setConfigEntry("web_engine", "DebugConsoleOutput"); - -// CFG: DEBUG-ENGINE -$cfg->setConfigEntry("debug_engine", "DebugErrorLogOutput"); - -// CFG: WEB-CONTENT-TYPE -$cfg->setConfigEntry("web_content_type", ""); - -// CFG: HUB-INTRO-ENABLED -$cfg->setConfigEntry("hub_intro_enabled", "Y"); - -// CFG: HUB-MAX-AUTH-TRIES -$cfg->setConfigEntry("hub_max_auth_tries", 3); - -// CFG: HUB-MSG-AUTH-TRIES -$cfg->setConfigEntry("hub_msg_auth_tries", "AUTH_MAX_TRIES"); - -// CFG: HUB-MSG-SPOOFING -$cfg->setConfigEntry("hub_msg_spoofing", "SPOOFING"); - -// CFG: HUB-MSG-AUTH-REPLY -$cfg->setConfigEntry("hub_msg_auth_reply_timeout", "TIMEOUT_AUTH"); - -// CFG: HUB-MSG-BYE -$cfg->setConfigEntry("hub_msg_bye", "BYE"); - -// CFG: HUB-MASTER-IP -$cfg->setConfigEntry("hub_master_ip", "192.168.1.17"); - -// CFG: HUB-MASTER-PORT -$cfg->setConfigEntry("hub_master_port", 9050); - -// CFG: HUB-AUTH-REQUEST -$cfg->setConfigEntry("hub_auth_request", "AUTH"); - -// CFG: HUB-AUTH-REQUEST-TIMEOUT (5 seconds for whole auth procedure shall be fine) -$cfg->setConfigEntry("hub_auth_request_timeout", 5); - -// CFG: HUB-PEER-HELLO -$cfg->setConfigEntry("hub_peer_hello", "HELLO"); - -// CFG: HUB-HELLO-REPLY -$cfg->setConfigEntry("hub_hello_reply", "ELHO"); - -// CFG: HUB-HELLO-TIMEOUT -$cfg->setConfigEntry("hub_hello_timeout", 30); - -// CFG: HUB-HELLO-RETRIES -$cfg->setConfigEntry("hub_hello_retires", 3); - -// CFG: HUB-PEER-PING -$cfg->setConfigEntry("hub_peer_ping", "PING"); - -// CFG: HUB-PING-REPLY -$cfg->setConfigEntry("hub_ping_reply", "PONG"); - -// CFG: HUB-PING-TIMEOUT -$cfg->setConfigEntry("hub_ping_timeout", 10); - -// CFG: HUB-PING-MAXDROPS -$cfg->setConfigEntry("hub_ping_maxdrops", 3); - -// CFG: HUB-PEER-MISS-PONG -$cfg->setConfigEntry("hub_peer_miss_pong", "PONG_MISS"); - -// [EOF] -?> diff --git a/ship-simu/application/hub/debug.php b/ship-simu/application/hub/debug.php deleted file mode 100644 index 393601cdb..000000000 --- a/ship-simu/application/hub/debug.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Hub main loop debugging -define('HUB_DEBUG_MAIN', true); - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions.php b/ship-simu/application/hub/exceptions.php deleted file mode 100644 index 7b569dc18..000000000 --- a/ship-simu/application/hub/exceptions.php +++ /dev/null @@ -1,90 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// The hub's own exception handler -function hub_exception_handler ($exceptionInstance) { - // Is it an object and a valid instance? - if ((is_object($exceptionInstance)) && ($exceptionInstance instanceof FrameworkException)) { - // Get the regular trace - $trace = $exceptionInstance->getTrace(); - - // Get 3 call levels - $backTrace = ""; - for ($idx = 0; $idx < 3; $idx++) { - $traceArray = $trace[$idx]; - - // Convert arguments type into human-readable - $args = $traceArray['args']; - $argsString = ""; - foreach ($args as $arg) { - $argsString .= ", ".gettype($arg); - } - $argsString = substr($argsString, 2); - - $backTrace .= sprintf("---------- Pos %d: ---------- -Method : %s%s%s(%s) ------ Caller: ----- -File : %s -Line : %d\n", - ($idx + 1), - $traceArray['class'], - $traceArray['type'], - $traceArray['function'], - $argsString, - basename($traceArray['file']), - $traceArray['line'] - ); - } - - // Construct the message - $message = sprintf("-------------------------------------------------------------------------------- -Uncaught Exception : %s --------------------------------------------------------------------------------- -Message : %s -Code : %s -File : %s -Line : %d --------------------------------------------------------------------------------- -Backtrace: --------------------------------------------------------------------------------- -%s ---------------------------------------------------------------------------------\n", - trim(html_entity_decode(strip_tags($exceptionInstance->__toString()))), - trim(html_entity_decode(strip_tags($exceptionInstance->getMessage()))), - $exceptionInstance->getHexCode(), - $exceptionInstance->getFile(), - $exceptionInstance->getLine(), - trim($backTrace) - ); - - // Output the message - print $message; - } -} - -// Set the new handler -set_exception_handler('hub_exception_handler'); - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/.htaccess b/ship-simu/application/hub/exceptions/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/exceptions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/exceptions/class_HubException.php b/ship-simu/application/hub/exceptions/class_HubException.php deleted file mode 100644 index b665355bb..000000000 --- a/ship-simu/application/hub/exceptions/class_HubException.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -abstract class HubException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public function __construct ($message, $code) { - // For now just pipe all data through - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/client/.htaccess b/ship-simu/application/hub/exceptions/client/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/exceptions/client/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/exceptions/client/class_HubHelloException.php b/ship-simu/application/hub/exceptions/client/class_HubHelloException.php deleted file mode 100644 index 597af222a..000000000 --- a/ship-simu/application/hub/exceptions/client/class_HubHelloException.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class HubHelloException extends HubException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Peer %s has not replyed our %s request within %d retries.
\n", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['peer']->getValidatedIP(), - $msgArray['this']->getConfigInstance()->readConfig("hub_peer_hello"), - $msgArray['this']->getConfigInstance()->readConfig("hub_hello_retires") - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/client/class_HubPeerAuthorizationException.php b/ship-simu/application/hub/exceptions/client/class_HubPeerAuthorizationException.php deleted file mode 100644 index 9018eb290..000000000 --- a/ship-simu/application/hub/exceptions/client/class_HubPeerAuthorizationException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class HubPeerAuthorizationException extends HubException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Peer %s has reached the maximum of %d authorization tries. Disconnecting peer....
\n", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['peer']->getValidatedIP(), - $msgArray['max'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/client/class_HubPeerTimeoutException.php b/ship-simu/application/hub/exceptions/client/class_HubPeerTimeoutException.php deleted file mode 100644 index ead9caa6f..000000000 --- a/ship-simu/application/hub/exceptions/client/class_HubPeerTimeoutException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class HubPeerTimeoutException extends HubException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Peer %s is no longer responding. Trying to disconnect the peer...
\n", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['peer']->getValidatedIP() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/commands/.htaccess b/ship-simu/application/hub/exceptions/commands/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/exceptions/commands/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/exceptions/commands/class_UnexpectedAwaitCommandException.php b/ship-simu/application/hub/exceptions/commands/class_UnexpectedAwaitCommandException.php deleted file mode 100644 index df47f36ed..000000000 --- a/ship-simu/application/hub/exceptions/commands/class_UnexpectedAwaitCommandException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class UnexpectedAwaitCommandException extends HubException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Not awaiting command %s from peer %s
\n", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['msg'], - $msgArray['this']->getPeerInstance()->getValidedIP() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/master/.htaccess b/ship-simu/application/hub/exceptions/master/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/exceptions/master/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/exceptions/master/class_HubMasterDisconnectedException.php b/ship-simu/application/hub/exceptions/master/class_HubMasterDisconnectedException.php deleted file mode 100644 index 9164b5651..000000000 --- a/ship-simu/application/hub/exceptions/master/class_HubMasterDisconnectedException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class HubMasterDisconnectedException extends HubException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Raw message received: %s
\n", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['msg'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/.htaccess b/ship-simu/application/hub/exceptions/socket/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/exceptions/socket/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/exceptions/socket/class_SocketException.php b/ship-simu/application/hub/exceptions/socket/class_SocketException.php deleted file mode 100644 index 867c84ca3..000000000 --- a/ship-simu/application/hub/exceptions/socket/class_SocketException.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -abstract class SocketException extends HubException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public function __construct ($message, $code) { - // For now just pipe all data through - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/connector/.htaccess b/ship-simu/application/hub/exceptions/socket/connector/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/exceptions/socket/connector/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/exceptions/socket/connector/class_SocketAcceptException.php b/ship-simu/application/hub/exceptions/socket/connector/class_SocketAcceptException.php deleted file mode 100644 index 70b1b7ebc..000000000 --- a/ship-simu/application/hub/exceptions/socket/connector/class_SocketAcceptException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SocketAcceptException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] socket_accept() has failed. Reason: %s (Code: %d)", - $msgArray['this']->__toString(), - $this->getLine(), - socket_strerror($msgArray['code']), - $msgArray['code'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/connector/class_SocketSelectorException.php b/ship-simu/application/hub/exceptions/socket/connector/class_SocketSelectorException.php deleted file mode 100644 index 38234ae3a..000000000 --- a/ship-simu/application/hub/exceptions/socket/connector/class_SocketSelectorException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SocketSelectorException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] socket_select() has failed. Reason: %s (Code: %d)", - $msgArray['this']->__toString(), - $this->getLine(), - socket_strerror($msgArray['code']), - $msgArray['code'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/init/.htaccess b/ship-simu/application/hub/exceptions/socket/init/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/exceptions/socket/init/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/exceptions/socket/init/class_SocketBindException.php b/ship-simu/application/hub/exceptions/socket/init/class_SocketBindException.php deleted file mode 100644 index caef6f3f9..000000000 --- a/ship-simu/application/hub/exceptions/socket/init/class_SocketBindException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SocketBindException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Socket konnte nicht an %s:%d gebunden werden. Reason: %s (Code: %d)", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['host'], - $msgArray['port'], - socket_strerror($msgArray['code']), - $msgArray['code'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/init/class_SocketConnectException.php b/ship-simu/application/hub/exceptions/socket/init/class_SocketConnectException.php deleted file mode 100644 index 3059677e5..000000000 --- a/ship-simu/application/hub/exceptions/socket/init/class_SocketConnectException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SocketConnectException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] socket_connect() has failed. Reason: %s (Code: %d)", - $msgArray['this']->__toString(), - $this->getLine(), - socket_strerror($msgArray['code']), - $msgArray['code'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/init/class_SocketCreationException.php b/ship-simu/application/hub/exceptions/socket/init/class_SocketCreationException.php deleted file mode 100644 index 2991fc06e..000000000 --- a/ship-simu/application/hub/exceptions/socket/init/class_SocketCreationException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SocketCreationException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Socket konnte nicht erstellt werden. Reason: %s (Code: %d)", - $msgArray['this']->__toString(), - $this->getLine(), - socket_strerror($msgArray['code']), - $msgArray['code'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/init/class_SocketListeningException.php b/ship-simu/application/hub/exceptions/socket/init/class_SocketListeningException.php deleted file mode 100644 index 979b1b1dd..000000000 --- a/ship-simu/application/hub/exceptions/socket/init/class_SocketListeningException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SocketListeningException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] socket_listen() has failed. Reason: %s (Code: %d)", - $msgArray['this']->__toString(), - $this->getLine(), - socket_strerror($msgArray['code']), - $msgArray['code'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/init/class_SocketSetupException.php b/ship-simu/application/hub/exceptions/socket/init/class_SocketSetupException.php deleted file mode 100644 index 3f3f9141c..000000000 --- a/ship-simu/application/hub/exceptions/socket/init/class_SocketSetupException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SocketSetupException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Socket konnte nicht konfiguriert werden. Reason: %s (Code: %d)", - $msgArray['this']->__toString(), - $this->getLine(), - socket_strerror($msgArray['code']), - $msgArray['code'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/peer/.htaccess b/ship-simu/application/hub/exceptions/socket/peer/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/exceptions/socket/peer/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/exceptions/socket/peer/class_BrokenPipeException.php b/ship-simu/application/hub/exceptions/socket/peer/class_BrokenPipeException.php deleted file mode 100644 index 8f7d1a88f..000000000 --- a/ship-simu/application/hub/exceptions/socket/peer/class_BrokenPipeException.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class BrokenPipeException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Connection lost to peer %s. Error message: %s (Code: %d)
\n", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['this']->getValidatedIP(), - socket_strerror($msgArray['code']), - $msgArray['code'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/peer/class_IPSpoofingException.php b/ship-simu/application/hub/exceptions/socket/peer/class_IPSpoofingException.php deleted file mode 100644 index 85516133f..000000000 --- a/ship-simu/application/hub/exceptions/socket/peer/class_IPSpoofingException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class IPSpoofingException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Peer-IP hat sich von %s auf %s geändert.
\n", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['old_ip'], - $msgArray['new_ip'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/exceptions/socket/peer/class_PeerSocketException.php b/ship-simu/application/hub/exceptions/socket/peer/class_PeerSocketException.php deleted file mode 100644 index 9d1278d2f..000000000 --- a/ship-simu/application/hub/exceptions/socket/peer/class_PeerSocketException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class PeerSocketException extends SocketException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($msgArray, $code) { - // Construct the message - $message = sprintf("[%s:%d] Peer-Socket ist ungültig. Datentyp: %s
\n", - $msgArray['this']->__toString(), - $this->getLine(), - $msgArray['type'] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/application/hub/init.php b/ship-simu/application/hub/init.php deleted file mode 100644 index 4ac89d331..000000000 --- a/ship-simu/application/hub/init.php +++ /dev/null @@ -1,66 +0,0 @@ -isClass("ApplicationSelector"))) { return; } - * - * isset() is required to prevent a warning and is_object() is highly required - * when the application itself is requested in URL (hint: index.php?app=your_app) - * - * @author Roland Haeder - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// 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("MXChange Hub"); -$app->setAppVersion("0.0.0"); -$app->setAppShortName("mxhub"); - -// Get's our IP address -$_SERVER['SERVER_ADDR'] = ConsoleTools::aquireSelfIPAddress(); - -// 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(sprintf("%sinc/database%s", - PATH, - FrameworkConfiguration::getInstance()->readConfig("php_extension") -)); - -// [EOF] -?> diff --git a/ship-simu/application/hub/interfaces/.htaccess b/ship-simu/application/hub/interfaces/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/interfaces/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/loader.php b/ship-simu/application/hub/loader.php deleted file mode 100644 index 8464a8a93..000000000 --- a/ship-simu/application/hub/loader.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Is the instance variable set? -if (!isset($application)) { - // We need this! - ApplicationEntryPoint::app_die("[Main:] Interne Variable application nicht gefunden!"); -} - -// Load all classes for the application -foreach ($lowerClasses as $class) { - // Try to load the application classes - try { - ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application, $class)); - } catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Reason: %s", - $class, - $e->getMessage() - )); - } catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Reason: %s", - $class, - $e->getMessage() - )); - } catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Reason: %s", - $class, - $e->getMessage() - )); - } catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad %s nicht laden. Reason: %s", - $class, - $e->getMessage() - )); - } -} - -// Include all classes -ClassLoader::getInstance()->includeAllClasses(); - -// Clean up the global namespace -unset($lowerClasses); -unset($class); - -// [EOF] -?> diff --git a/ship-simu/application/hub/main/.htaccess b/ship-simu/application/hub/main/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/main/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/main/class_HubCommandProcessor.php b/ship-simu/application/hub/main/class_HubCommandProcessor.php deleted file mode 100644 index c325928eb..000000000 --- a/ship-simu/application/hub/main/class_HubCommandProcessor.php +++ /dev/null @@ -1,196 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class HubCommandProcessor extends BaseFrameworkSystem { - /** - * An instance of a HubPeer class - */ - private $peerInstance = null; - - /** - * A list of sent commands but not replied (yet) - */ - private $sentCommandsAwaitingAnswer = array(); - - /** - * Queued commands from the master hub - */ - private $masterCommands = array(); - - // Exceptions - const EXCEPTION_COMMAND_AWAIT_INVALID = 0xc00; - - /** - * The private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Hub-Command-Processor"); - - // Set unique ID - $this->createUniqueID(); - - // Tidy up a little - $this->removeSystemArray(); - $this->removeNumberFormaters(); - } - - /** - * Creates an instance of a HubCommandProcessor class by a HubPeer class - * - * @param $peerInstance An instance of a HubPeer class - * @return $command An instance of this class - */ - public final static function createHubCommandProcessor (HubPeer $peerInstance) { - // Get a new instance of this class - $command = new HubCommandProcessor(); - - // Set the hub instance - $command->setPeerInstance($peerInstance); - - // Return the instance - return $command; - } - - /** - * Setter for HubPeer instances - * - * @param $peerInstance An instance of a HubPeer class - * @return void - */ - public final function setPeerInstance(HubPeer $peerInstance) { - $this->peerInstance = $peerInstance; - } - - /** - * Getter for HubPeer instances - * - * @return $peerInstance An instance of a HubPeer class - */ - public final function getPeerInstance() { - return $this->peerInstance; - } - - /** - * Handles simple commands which require an answer command from the peer without any parameters - * - * @param $sendCommand The command we shall send to the peer - * @param $expectCommand The command we except from the peer - * @return void - */ - public function simpleExecute ($sendCommand, $expectCommand) { - // Remember the command - $this->sentCommandsAwaitingAnswer[$expectCommand] = $sendCommand; - - // Debug message - $this->getPeerInstance()->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Sending command %s to peer %s", - $this->__toString(), - $sendCommand, - $this->getPeerInstance()->getValidatedIP() - )); - - // Execute the command - $this->getPeerInstance()->sendMessage($sendCommand); - } - - /** - * Awaits a specified command from the peer and returns TRUE if received or FALSE if not. - * - * @param $exceptCommand The command we are expecting from the peer - * @return $await Wether the awaited command has been received - * @throws UnexpectedAwaitCommandException If the awaited command is not being awaited... - */ - public function ifAwaitsCommand ($expectCommand) { - $await = false; - - // Do we wait for this command? - if (!isset($this->sentCommandsAwaitingAnswer[$expectCommand])) { - // We are not waiting for this command - throw new UnexpectedAwaitCommandException ( - array( - 'this' => $this, - 'await' => $expectCommand - ), self::EXCEPTION_COMMAND_AWAIT_INVALID - ); - } // END - if - - // Then process it... :-) - $readCommand = $this->getPeerInstance()->readFromSocket(); - - // Is the command not empty? - if (!empty($readCommand)) { - // Debug message - $this->getPeerInstance()->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Raw command %s received from peer %s", - $this->__toString(), - $readCommand, - $this->getPeerInstance()->getValidatedIP() - )); - } // END - if - - if ($readCommand == $expectCommand) { - // Debug message - $this->getPeerInstance()->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Awaited command %s received from peer %s", - $this->__toString(), - $expectCommand, - $this->getPeerInstance()->getValidatedIP() - )); - - // Expected command has been received! - unset($this->sentCommandsAwaitingAnswer[$expectCommand]); - $await = true; - - } // END - if - - // Return the result - return $await; - } - - /** - * Awaits any command from the peer - * - * @return $command The sent command from the peer - */ - public function awaitAnyCommand () { - $command = false; - $readCommand = $this->getPeerInstance()->readFromSocket(); - if (!empty($readCommand)) { - // Remember this command - // TODO Add some validation here! - $this->masterCommands[] = $readCommand; - - // A command is in the queue - $command = true; - } // END - if - - // Return status - return $command; - } - -} // END - class - -// [EOF] -?> diff --git a/ship-simu/application/hub/main/class_HubConnector.php b/ship-simu/application/hub/main/class_HubConnector.php deleted file mode 100644 index 2b775c031..000000000 --- a/ship-simu/application/hub/main/class_HubConnector.php +++ /dev/null @@ -1,185 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class HubConnector extends BaseFrameworkSystem { - /** - * The socket we shall use for communication - */ - private $socketResource = null; - - /** - * The peer instance (HubPeer class) - */ - private $peerInstance = null; - - /** - * The private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Hub-Connector"); - - // Set unique ID - $this->createUniqueID(); - - // Tidy up a little - $this->removeSystemArray(); - $this->removeNumberFormaters(); - } - - /** - * Creates an instance based on the (IP) address and port number of this - * class. Next it tries to connect to the specified peer and communicates - * to it over a socket - * - * @param $address The peer's IP address - * @param $port The peer's port number - * @param $hubInstance An instance of a HubCoreLoop class - * @return $connector An instance of this class - * @throws HubHelloException If HELLO retries reached maximum - */ - public final static function createHubConnectorByAddressPort ($address, $port, HubCoreLoop $hubInstance) { - // Get a new instance of this class - $connector = new HubConnector(); - - // Connect to the given address and IP number - $connector->aquireConnectionToAddress($address, $port); - - // Message to console - $hubInstance->getOutputInstance()->output(sprintf("[%s] Sending %s request to hub %s:%d...", - __METHOD__, - $connector->getConfigInstance()->readConfig("hub_peer_hello"), - $address, - $port - )); - - // Get a HubPeer instance - $peerInstance = HubPeer::createHubPeerBySocket($connector->getSocketResource(), $hubInstance); - - // Send a HELLO to the master hub - $helloed = 0; $retries = 0; - while (!$peerInstance->ifHelloReplied()) { - // Within timeout? - if ((time() - $helloed) >= $connector->getConfigInstance()->readConfig("hub_hello_timeout")) { - // Send HELLOs out in periodic times - $peerInstance->sendMessage($connector->getConfigInstance()->readConfig("hub_peer_hello")); - $helloed = time(); $retries++; - if ($retries == $connector->getConfigInstance()->readConfig("hub_hello_retires")) { - // Maximum retries reached - throw new HubHelloException( - array( - 'this' => $connector, - 'peer' => $peerInstance - ), HubCoreLoop::EXCEPTION_HELLO_TIMED_OUT - ); - } - } // END - if - } // END - while - - // Set the peer instance - $connector->setPeerInstance($peerInstance); - - // Return the instance - return $connector; - } - - /** - * Aquires a socket link to a specified IP address and port number. It - * throws subclasses of SocketException-s if the peer is down or not - * responding. If the connection is up it writes it's resource into - * the attribute $socketResource and waits for incoming data packages. - * - * @param $address The peer's IP address - * @param $port The peer's port number - * @return void - * @throws SocketCreationException If creation of the socket wents wrong - * @throws SocketConnectException If the connection was not established - */ - public function aquireConnectionToAddress ($address, $port) { - // Create a socket for binding to the address - $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - - // Was it a success? - if (!is_resource($socket)) { - // This fails! :( - throw new SocketCreationException( - array( - 'this' => $this, - 'code' => socket_last_error() - ), HubCoreLoop::EXCEPTION_SOCKET_PROBLEM - ); - } // END - fi - - // Now connect to the peer - if (@socket_connect($socket, $address, $port) === false) { - // Something wents wrong! - throw new SocketConnectException ( - array( - 'this' => $this, - 'code' => socket_last_error() - ), HubCoreLoop::EXCEPTION_SOCKET_PROBLEM - ); - } // END - if - - // Set non-blocking mode - @socket_set_nonblock($socket); - - // Set the socket - $this->socketResource = $socket; - } - - /** - * Getter for current socket - * - * @return $socketResource The current socket resource or null if not set - */ - public final function getSocketResource() { - return $this->socketResource; - } - - /** - * Setter for a HubPeer instance - * - * @param $peerInstance An instance of a HubPeer class - * @return void - */ - public final function setPeerInstance (HubPeer $peerInstance) { - $this->peerInstance = $peerInstance; - } - - /** - * Handles any incoming master requests - * - * @return void - */ - public function handleMasterRequests () { - // Just ask the peer instance - $command = $this->peerInstance->handleMasterRequests(); - } - -} // END - class -?> diff --git a/ship-simu/application/hub/main/class_HubCoreLoop.php b/ship-simu/application/hub/main/class_HubCoreLoop.php deleted file mode 100644 index 86f496f5d..000000000 --- a/ship-simu/application/hub/main/class_HubCoreLoop.php +++ /dev/null @@ -1,713 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class HubCoreLoop extends BaseFrameworkSystem { - /** - * Wether the hub is active and running - */ - private $hubActivated = false; - - /** - * Wether the hub is shutting down - */ - private $hubShutsDown = false; - - /** - * A list of all connected peers (sockets) - */ - private $connectedPeers = null; - - /** - * A console output handler - */ - private $outputInstance = null; - - /** - * Reading peers - */ - private $readPeers = array(); - - /** - * Writing peers - */ - private $writePeers = array(); - - /** - * The main socket (listening) for this hub - */ - private $main_socket = null; - - /** - * A list of authenticated peers - */ - private $authPeers = null; - - /** - * Last peer instance - */ - private $lastPeerInstance = null; - - /** - * Wether this hub is a master hub - */ - private $hubIsMaster = false; - - /** - * Maximum auth retries (cached) - */ - private $authRetries = 0; - - /** - * Auth request message - */ - private $authRequest = ""; - - /** - * Cached timeout for auth requests - */ - private $authRequestTimeout = 0; - - /** - * An instance to the HubConnector class for master hub connection - */ - private $masterConnector = null; - - // Exception codes - const EXCEPTION_SOCKET_PROBLEM = 0xb00; - const EXCEPTION_HUB_PEER_TIMEOUT = 0xb01; - const EXCEPTION_HUB_PEER_FAILED_AUTH = 0xb02; - const EXCEPTION_HELLO_TIMED_OUT = 0xb03; - - /** - * The private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Hub-Core Loop"); - - // Set unique ID - $this->createUniqueID(); - - // Tidy up a little - $this->removeSystemArray(); - $this->removeNumberFormaters(); - - // Init the peer list - $this->initPeerList(); - } - - /** - * Factory for main loop - * - * @return $hubInstance An instance of this class - */ - public final static function createHubCoreLoop () { - // Get an instance - $hubInstance = new HubCoreLoop(); - - // Try to setup the socket - $hubInstance->setupHub(); - - // Get the configuration variable - $outEngine = $hubInstance->getConfigInstance()->readConfig("tpl_engine"); - - // Setup the console output handler - $eval = sprintf("\$hubInstance->setOutputInstance(%s::create%s(\"%s\"));", - $outEngine, - $outEngine, - $hubInstance->getConfigInstance()->readConfig("web_content_type") - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $hubInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: %s", - $hubInstance->__toString(), - htmlentities($eval) - )); - @eval($eval); - - // Return the prepared instance - return $hubInstance; - } - - /** - * Initializes the peer list - * - * @return void - */ - private final function initPeerList () { - $this->connectedPeers = new FrameworkArrayObject(); - $this->authPeers = new FrameworkArrayObject(); - } - - /** - * Get total number of connected peers - * - * @return $num The total number of connected peers - */ - private final function getTotalConnectedPeers () { - $read = array($this->connectedPeers->getIterator()->current()); - $write = array(); - $except = array(); - - // Get socket number - $num = socket_select( - $read, - $write, - $except, - 0 - ); - - // Transfer readers and writers - $this->readPeers = $read; - $this->writePeers = $write; - - // Return the number - return $num; - } - - /** - * Handle newly connected peers - * - * @return void - */ - private final function handleNewPeers () { - // Output message - $this->getOutputInstance()->output(sprintf("[%s] Validating peer...", __METHOD__)); - - // Is the main socket in the array? - if (in_array($this->main_socket, $this->readPeers)) { - // Accept the connection and add him to the list - $peer_socket = socket_accept($this->main_socket); - - // Get a new peer instance - $this->setCurrPeerInstance(HubPeer::createHubPeerBySocket($peer_socket, $this)); - - // Register the new peer - $this->getOutputInstance()->output(sprintf("[%s] Registering new peer with IP %s.", - __METHOD__, - $this->getCurrPeerInstance()->getValidatedIP() - )); - $this->connectedPeers->append($this->lastPeerInstance); - - // A new peer has connected - $this->getOutputInstance()->output(sprintf("[%s] New peer with IP %s has been registered.", - __METHOD__, - $this->getCurrPeerInstance()->getValidatedIP() - )); - - // Remove him from the list - $key = array_search($this->main_socket, $this->readPeers); - unset($this->readPeers[$key]); - } // END - if - } - - /** - * Handles unauthenticated peers - * - * @return void - * @throws HubPeerTimeoutException If the peer times out to answer a request - * @throws HubPeerAuthorizationException If the peer fails to authorize himself (to many retries) - */ - private final function handleUnauthPeers () { - // Are there some peers? - if ($this->connectedPeers->count() > 1) { - // Iterate through all connected peers - for ($idx = $this->connectedPeers->getIterator(); $idx->valid(); $idx->next()) { - // Get current peer - $this->lastPeerInstance = $idx->current(); - - // Ignore own socket and invalid entries - if (($this->getCurrPeerInstance() !== $this->main_socket) && (is_object($this->getCurrPeerInstance())) && ($this->getCurrPeerInstance() instanceof HubPeer)) { - // Is this peer already authorized or is this the master hub? - // If this is the master hub then there is no auth required - if ((!$this->getCurrPeerInstance()->ifPeerIsAuthorized()) && (!$this->getCurrPeerInstance()->ifPeerIsLocalAdmin()) && (!$this->hubIsMaster)) { - // This peer waits for authorization, so does he have some tries left? - if ($this->getCurrPeerInstance()->getAuthRetries() <= $this->authRetries) { - // This peer is still allowed to try his authorization - if ($this->getCurrPeerInstance()->getLastSentMessage() == $this->authRequest) { - // Already asked so maybe timed out? - if ((time() - $this->getCurrPeerInstance()->getLastSentMessageStamp()) >= $this->authRequestTimeout) { - // Timed out so disconnect the peer - throw new HubPeerTimeoutException ( - array( - 'this' => $this, - 'peer' => $this->getCurrPeerInstance() - ), self::EXCEPTION_HUB_PEER_TIMEOUT - ); - } // END - if - } elseif ($this->getCurrPeerInstance()->ifHelloReceived()) { - // HELLO received so we need to sent the AUTH request - $this->getCurrPeerInstance()->askAuthorizationKey(); - } - } else { - // This peer needs disconnecting! - throw new HubPeerAuthorizationException ( - array( - 'this' => $this, - 'peer' => $this->getCurrPeerInstance(), - 'max' => $this->authRetries - ), self::EXCEPTION_HUB_PEER_FAILED_AUTH - ); - } // END - else - } elseif ((!$this->getCurrPeerInstance()->ifPeerIsAuthorized()) && ($this->getCurrPeerInstance()->ifPeerIsLocalAdmin())) { - // This peer is a local admin so he is always authorized! - $this->getCurrPeerInstance()->enableLocalAdmin(); - - // Output debug message - $this->getOutputInstance()->output(sprintf("[%s] A local admin has connected.", - $this->__toString() - )); - - // Say "hi" to the admin - $this->getCurrPeerInstance()->sayHi2Admin(); - } elseif (($this->hubIsMaster) && ($this->getCurrPeerInstance()->ifHelloReceived()) && (!$this->getCurrPeerInstance()->ifELHOsent())) { - // Is the master hub so authorize the peer here... - $this->getCurrPeerInstance()->enableIsAuthorized(); - $this->authPeers->append($this->getCurrPeerInstance()); - - // Reply the HELLO request - $this->getCurrPeerInstance()->replyHelloMessage(); - } - } // END - if - } // END - for - } // END - if - } - - /** - * Handles only authorized peers - * - * @return void - */ - public function handleAuthPeers () { - // Are there some peers? - if (($this->connectedPeers->count() > 1) && ($this->authPeers->count() > 0)) { - // Iterate through all connected peers - for ($idx = $this->authPeers->getIterator(); $idx->valid(); $idx->next()) { - // Get current peer - $this->lastPeerInstance = $idx->current(); - - // Do the ping and update our authPeer list (LATER!) - $this->lastPeerInstance->handlePingPeer(); - } // END - for - } // END - for - } - - /** - * Setup the hub: Create a socket for listening on incoming requests, - * try to bind to a port, etc. - * - * @return void - * @throws SocketCreationException If a socket cannot be created - * @throws SocketSetupException If a socket cannot be setuped - * @throws SocketBindException If a socket cannot be bind to - * an address and port - * @throws SocketListeningException If listening to a socket fails - */ - private final function setupHub () { - // Create a new TCP socket - $main_socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - - // Was it a success? - if (!is_resource($main_socket)) { - // This fails! :( - throw new SocketCreationException( - array( - 'this' => $this, - 'code' => socket_last_error() - ), self::EXCEPTION_SOCKET_PROBLEM - ); - } - - // Set socket options - if (!socket_set_option($main_socket, SOL_SOCKET, SO_REUSEADDR, 1)) { - // Close the socket - $this->closeSocket($main_socket); - - // Problems setting socket options - throw new SocketSetupException ( - array( - 'this' => $this, - 'code' => socket_last_error() - ), self::EXCEPTION_SOCKET_PROBLEM - ); - } - - // Set to non-blocking - socket_set_nonblock($main_socket); - - // Bind the socket to an address - if (!socket_bind($main_socket, $this->getConfigInstance()->readConfig("hub_listen_addr"), $this->getConfigInstance()->readConfig("hub_listen_port"))) { - // Bind failed - throw new SocketBindException ( - array( - 'this' => $this, - 'host' => $this->getConfigInstance()->readConfig("hub_listen_addr"), - 'port' => $this->getConfigInstance()->readConfig("hub_listen_port"), - 'code' => socket_last_error() - ), self::EXCEPTION_SOCKET_PROBLEM - ); - } - - // Listen to ... the socket ;-) - if (!socket_listen($main_socket)) { - // Opps, that didn't work. Next time better listen to your heart... Roxette - throw new SocketListeningException( - array( - 'this' => $this, - 'code' => socket_last_error() - ), self::EXCEPTION_SOCKET_PROBLEM - ); - } - - // Ignore user abort and do not time out - @set_time_limit(0); - @ignore_user_abort(true); - - // Cache more configuration stuff - $this->authRetries = $this->getConfigInstance()->readConfig("hub_max_auth_tries"); - $this->authRequest = $this->getConfigInstance()->readConfig("hub_auth_request"); - $this->authRequestTimeout = $this->getConfigInstance()->readConfig("hub_auth_request_timeout"); - - // The hub is running now! - $this->hubActivated = true; - - // Append the main hub - $this->main_socket = $main_socket; - $this->connectedPeers->append($main_socket); - } - - /** - * Removes the current peer from the list - * - * @return void - */ - public final function removePeerFromConnectList () { - // Iterate through all connected peers - for ($idx = $this->connectedPeers->getIterator(); $idx->valid(); $idx->next()) { - // Get current peer from list - $peer = $idx->current(); - - // Is it a peer instance? - if (($peer !== $this->main_socket) && (is_object($peer)) && ($peer instanceof HubPeer)) { - // Okay, we have a peer instance so is it the same? - if ($this->getCurrPeerInstance()->equals($peer)) { - // Remove him! - $idx->offsetUnset($idx->key()); - $this->lastPeerInstance = null; - break; - } - } - } - } - - /** - * Getter for console output handler - * - * @return $outputInstance An instance of the output handler - */ - public final function getOutputInstance () { - return $this->outputInstance; - } - - /** - * Setter for console output handler - * - * @param $outputInstance An instance of the output handler - */ - public final function setOutputInstance ($outputInstance) { - $this->outputInstance = $outputInstance; - } - - /** - * Getter for current peer instance to HubPeer class - * - * @return $lastPeerInstance Last peer instance - */ - public final function getCurrPeerInstance () { - return $this->lastPeerInstance; - } - - /** - * Setter for current peer instance to HubPeer class - * - * @param $lastPeerInstance Last peer instance - * @return void - */ - public final function setCurrPeerInstance (HubPeer $lastPeerInstance) { - $this->lastPeerInstance = $lastPeerInstance; - } - - /** - * Checks wether the hub is running and not in shutdown phase - * - * @return $isRunning If the hub is running and not in shutdown phase - */ - public function ifHubIsRunning () { - return ((($this->hubActivated) || (!$this->hubShutsDown)) && ($this->connectedPeers->count() > 0)); - } - - /** - * Output the intro text - * - * @return void - */ - public final function outputIntro () { - if ($this->getConfigInstance()->readConfig("hub_intro_enabled") == "Y") { - // Output intro text - $this->getOutputInstance()->output(sprintf("%s v%s Copyright (c) 2007, 2008 by Roland Häder", - ApplicationHelper::getInstance()->getAppName(), - ApplicationHelper::getInstance()->getAppVersion() - )); - $this->getOutputInstance()->output(""); - $this->getOutputInstance()->output("This software is free software licensed under the GNU GPL. In telnet session enter "/license" to read the license."); - $this->getOutputInstance()->output("This software uses the MXChange Framework, Copyright (c) 2007, 2008 by Roland Häder which is licensed under the GNU GPL."); - $this->getOutputInstance()->output("Enter "/framework" in telnet session to read that license."); - $this->getOutputInstance()->output(""); - $this->getOutputInstance()->output("All core systems are initialized. Input on *this* console will currently be ignored!"); - $this->getOutputInstance()->output(""); - $this->getOutputInstance()->output(sprintf("[%s] Listening on: %s:%d", - $this->__toString(), - $this->getConfigInstance()->readConfig("hub_listen_addr"), - $this->getConfigInstance()->readConfig("hub_listen_port") - )); - $this->getOutputInstance()->output("----------------------------------------------------------------------------------------------------------------------------"); - } - } - - /** - * Do the main loop - * - * @return void - * @throws SocketCreationException If the main socket is not a resource - */ - public function coreLoop () { - // Is the main socket vailid? - if (!is_resource($this->main_socket)) { - // Is not valid! - throw new SocketCreationException( - array( - 'this' => $this, - 'code' => socket_last_error() - ), self::EXCEPTION_SOCKET_PROBLEM - ); - } // END - if - - // We are ready to serve requests - $this->getOutputInstance()->output(sprintf("[%s] Ready to serve requests.", - $this->__toString() - )); - - // Wait until the hub is shutting down - while ($this->ifHubIsRunning()) { - // Get number of total connected peers - $num = $this->getTotalConnectedPeers(); - - try { - // Handle the master hub connection - if ($this->masterConnector instanceof HubConnector) { - $this->masterConnector->handleMasterRequests(); - } - - // Check for unauthorized peers - $this->handleUnauthPeers(); - - // Handle authorized peers - $this->handleAuthPeers(); - } catch (HubPeerAuthorizationException $e) { - // Authorization has failed - $this->disconnectPeerWithReason("hub_msg_auth_tries"); - - // Get new total connected peers - $num = $this->getTotalConnectedPeers(); - } catch (HubPeerTimeoutException $e) { - // Disconnect and remove the peer - $this->disconnectPeerWithReason("hub_msg_auth_reply_timeout"); - - // Get new total connected peers - $num = $this->getTotalConnectedPeers(); - } catch (HubMasterDisconnectedException $e) { - // The master hub has disconnected us... :( - $this->masterConnector = null; - $this->getOutputInstance()->output(sprintf("[%s] The master has disconnected us. Reason given: %s", - $this->__toString(), - $e->getMessage() - )); - } catch (BrokenPipeException $e) { - // Broken pipes are bad for us... :( - $this->removePeerFromConnectList(); - $this->getOutputInstance()->output(sprintf("[%s] A peer has closed the connection unexpected: %s", - $this->__toString(), - $e->getMessage() - )); - - // Get new total connected peers - $num = $this->getTotalConnectedPeers(); - } catch (FrameworkException $e) { - // Catch all other exceptions and output them - echo "CATCH".__LINE__.":".$e->__toString()."\n"; - hub_exception_handler($e); - - // Get new total connected peers - $num = $this->getTotalConnectedPeers(); - } - - // Are there some peers? - if ($num < 1) { - // Wait for more peers - continue; - } // END - if - - // A new peer has connected - $this->getOutputInstance()->output(sprintf("[%s] A new peer is connecting.", - $this->__toString() - )); - - try { - // Check for new peers - $this->handleNewPeers(); - } catch (IPSpoofingException $e) { - // Output message - $this->getOutputInstance()->output(sprintf("[%s] The peer's IP number has changed!", - $this->__toString() - )); - - // Output debug message - $this->getDebugInstance()->output(sprintf("[%s] Peer spoofes IP number: %s", - $this->__toString(), - $e->getMessage() - )); - - // Disconnect the peer first - $this->disconnectPeerWithReason("hub_msg_spoofing"); - - // Get new total connected peers - $num = $this->getTotalConnectedPeers(); - } catch (FrameworkException $e) { - // Catch all exceptions and output them to avoid aborting the program unexpectly - echo "CATCH".__LINE__.":".$e->__toString()."\n"; - hub_exception_handler($e); - - // Get new total connected peers - $num = $this->getTotalConnectedPeers(); - } - - } // END - while - } - - /** - * Tries to contact the master server or simply reports that we are the master server - * - * @return void - */ - public function contactMasterHub () { - // Checks wether we are the master hub - if ($_SERVER['SERVER_ADDR'] == $this->getConfigInstance()->readConfig("hub_master_ip")) { - // We are master! - $this->hubIsMaster = true; - $this->getOutputInstance()->output(sprintf("[%s] Our IP %s matches the master IP. Becoming master hub...", - $this->__toString(), - $_SERVER['SERVER_ADDR'] - )); - } else { - // A regular hub or ultra hub so let's contact the master - $this->getOutputInstance()->output(sprintf("[%s] Contacting the master hub at %s:%d...", - $this->__toString(), - $this->getConfigInstance()->readConfig("hub_master_ip"), - $this->getConfigInstance()->readConfig("hub_master_port") - )); - - // Try to aquire a connection to the master... - try { - // Announce us to the master hub - $this->announceToMasterHub(); - } catch (FrameworkException $e) { - // Catch all exceptions and output them - echo "CATCH".__LINE__.":".$e->__toString()."\n"; - hub_exception_handler($e); - } - } // END - else - } - - /** - * Disconnects the current with a configurable reason - * - * @param $reasonEntry The entry with the disconnection reason aka. message to the peer - * @return void - */ - public function disconnectPeerWithReason ($reasonEntry) { - $ip = "0.0.0.0"; - - // Try to disconnect here - try { - // First get the raw IP number - $ip = $this->getCurrPeerInstance()->getValidatedIP(); - - // Disconnect the peer... - $this->getCurrPeerInstance()->disconnectWithReason($this->getConfigInstance()->readConfig($reasonEntry)); - } catch (FrameworkException $e) { - // Catch all exceptions and output them - echo "CATCH".__LINE__.":".$e->__toString()."\n"; - hub_exception_handler($e); - } - - // Remove him from the list anyway - $this->removePeerFromConnectList(); - - // Output the message - $this->getOutputInstance()->output(sprintf("[%s] Peer %s has been disconnected.", - $this->__toString(), - $ip - )); - } - - /** - * Announces this hub to the master hub. This is being done by connecting to it and asking for auth request - * - * @return void - */ - public function announceToMasterHub () { - try { - // Create a new instance for communicating to the master hub - $this->masterConnector = HubConnector::createHubConnectorByAddressPort( - $this->getConfigInstance()->readConfig("hub_master_ip"), - $this->getConfigInstance()->readConfig("hub_master_port"), - $this - ); - - // Send all our accepted objects to the master hub - $this->masterConnector->sendAllAcceptedObjects(); - } catch (SocketConnectException $e) { - // The master hub is down! - ApplicationEntryPoint::app_die($e->getMessage()); - } - } - -} // END - class - -// [EOF] -?> diff --git a/ship-simu/application/hub/main/class_HubPeer.php b/ship-simu/application/hub/main/class_HubPeer.php deleted file mode 100644 index a457b1e1a..000000000 --- a/ship-simu/application/hub/main/class_HubPeer.php +++ /dev/null @@ -1,656 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class HubPeer extends BaseFrameworkSystem { - /** - * This peer's socket resource - */ - private $peerSocket = null; - - /** - * Timestamp for connection - */ - private $connectTime = 0; - - /** - * Timestamp of last received message - */ - private $lastReceivedMessageStamp = 0; - - /** - * Last received message - */ - private $lastReceivedMessage = ""; - - /** - * Timestamp of last sent message - */ - private $lastSentMessageStamp = 0; - - /** - * Last sent message - */ - private $lastSentMessage = ""; - - /** - * Number of tries for authorization - */ - private $authRetries = 0; - - /** - * Wether the peer is authorized (DO NEVER SET THIS TO "true"!) - */ - private $isAuthorized = false; - - /** - * Wether this peer needs to be requested for the AUTH command - */ - private $needAuthRequest = true; - - /** - * The peer's IP number - */ - private static $peerIP = "0.0.0.0"; - - /** - * Wether the peer has "hello-ed" to the other - */ - private $helloSent = false; - - /** - * Wether the peer has replied our HELLO - */ - private $helloReplied = false; - - /** - * Wether we have sent our ELHO - */ - private $elhoSent = false; - - /** - * An instance of HubCoreLoop - */ - private $hubInstance = null; - - /** - * When the last ping was - */ - private $lastPinged = 0; - - /** - * When the last pong was - */ - private $lastPonged = 0; - - /** - * Number of missing pongs from the other peer - */ - private $missingPongs = 0; - - /** - * An instance of a HubCommandProcessor class - */ - private $commandInstance = null; - - /** - * A queue for reading data in non-blocking mode - */ - private $queues = ""; - - /** - * Line ends - */ - const LINE_END = "\n"; - - //---------------------------------------------------------- - // Exceptions - //---------------------------------------------------------- - const EXCEPTION_PEER_SOCKET_INVALID = 0x200; - const EXCEPTION_PEER_IP_CHANGED = 0x201; - const EXCEPTION_PEER_SOCKET_BROKEN = 0x202; - //---------------------------------------------------------- - - /** - * The private constructor - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Hub-Peer"); - - // Set unique ID - $this->createUniqueID(); - - // Tidy up a little - $this->removeSystemArray(); - $this->removeNumberFormaters(); - - // Get a command processor - $this->commandInstance = HubCommandProcessor::createHubCommandProcessor($this); - } - - /** - * Creates an instance of a HubPeer by a provided valid socket resource - * - * @param $peerSocket The socket resource for the peer - * @param $hubInstance An instance of HubCoreLoop - * @return $peerInstance An instance of HubPeer - */ - public final static function createHubPeerBySocket ($peerSocket, HubCoreLoop $hubInstance) { - // Get a new instance - $peerInstance = new HubPeer(); - - // Is the peer socket fine? - if (!is_resource($peerSocket)) { - // There is a problem with the socket - throw new PeerSocketException ( - array( - 'this' => $peerInstance, - 'type' => gettype($peerSocket) - ), self::EXCEPTION_PEER_SOCKET_INVALID - ); - } - - // Set the socket - $peerInstance->setPeerSocket($peerSocket); - - // Set connection timestamp - $peerInstance->setConnectionTimestamp(); - - // Set the hub instance - $peerInstance->setHubInstance($hubInstance); - - // Return the instance - return $peerInstance; - } - - //---------------------------------------------------------- - // Public getter/setter - //---------------------------------------------------------- - - /** - * Setter for peer socket - * - * @param $peerSocket The peer's socket - * @return void - */ - public final function setPeerSocket ($peerSocket) { - if (is_resource($peerSocket)) { - $this->peerSocket = $peerSocket; - } else { - $this->peerSocket = null; - } - } - - /** - * Setter for connection timestamp only once - * - * @return void - */ - public final function setConnectionTimestamp () { - if ($this->connectTime == 0) $this->connectTime = time(); - } - - /** - * Getter for a raw IP number - * - * @return $ip The peer's IP number - * @throws BrokenPipeException If a socket has lost its connection to the peer - */ - public final function getRawIP () { - if (is_resource($this->peerSocket)) { - // Get IP from socket - @socket_getpeername($this->peerSocket, $ip); - - // Connection problems? - if (socket_last_error() > 0) { - // Throw an exception - throw new BrokenPipeException( - array( - 'this' => $this, - 'code' => socket_last_error() - ), self::EXCEPTION_PEER_SOCKET_BROKEN - ); - } - } else { - // Without a socket we cannot determine the right IP - $ip = "0.0.0.0"; - } - - // And return it... - return $ip; - } - - /** - * Getter for a validated peer IP - * - * @return $peerIP The peer's IP number - */ - public final function getValidatedIP() { - // Is the socket valid and IP not set? - if ((is_resource($this->peerSocket)) && (socket_last_error() == 0) && (self::$peerIP == "0.0.0.0")) { - // Get peer's IP number - self::$peerIP = $this->getRawIP(); - } elseif ((is_resource($this->peerSocket)) && (socket_last_error() == 0)) { - // Get current raw IP number for validation - $ip = $this->getRawIP(); - - // Check if the IP has changed - if ($ip !== self::$peerIP) { - // The IP number has changed! - throw new IPSpoofingException( - array( - 'this' => $this, - 'old_ip' => self::$peerIP, - 'new_ip' => $ip - ), self::EXCEPTION_PEER_IP_CHANGED - ); - } - } - - return self::$peerIP; - } - - /** - * Getter for number of authorization tries - * @return $authRetries Authorization tries - */ - public final function getAuthRetries () { - return $this->authRetries; - } - - //---------------------------------------------------------- - // Public methods - //---------------------------------------------------------- - - /** - * Setter for HubCoreLoop instances - * - * @param $hubInstance An instance of a HubCoreLoop class - * @return void - */ - public final function setHubInstance(HubCoreLoop $hubInstance) { - $this->hubInstance = $hubInstance; - } - - /** - * Getter for HubCoreLoop instances - * - * @return $hubInstance An instance of a HubCoreLoop class - */ - public final function getHubInstance() { - return $this->hubInstance; - } - - /** - * Getter for last sent message timestamp - * - * @return $lastSentMessageStamp Timestamp of last sent message - */ - public final function getLastSentMessageStamp () { - return $this->lastSentMessageStamp; - } - - /** - * Getter for last sent message - * - * @return $lastSentMessage Last sent message to this peer - */ - public final function getLastSentMessage () { - return $this->lastSentMessage; - } - - /** - * Determines wether the peer is authorized - * - * @return void - */ - public final function ifPeerIsAuthorized () { - return (($this->isAuthorized === true) && ($this->ifPeerNeedsAuthRequest() === false)); - } - - /** - * Returns wether this peer needs to receive the AUTH command - */ - public final function ifPeerNeedsAuthRequest () { - return $this->needAuthRequest; - } - - /** - * Disconnects the peer with a special reason (status) - * - * @param $reason The special reason - * @return void - */ - public final function disconnectWithReason ($reason) { - // Is the message set? - if (!empty($reason)) { - // Send the given message - $this->sendMessage($reason); - } else { - // Send default "good bye" - $this->sendMessage($this->getConfigInstance()->readConfig("hub_msg_bye")); - } - - // Disconnect the client - socket_shutdown($this->peerSocket, 2); - socket_close($this->peerSocket); - } - - /** - * Sends a specified message to the peer's socket - * - * @param $message The special message - * @return void - * @throws BrokenPipeException If a pipe to a socket peer is lost - */ - public final function sendMessage ($message) { - if (empty($message)) { - // Set default message - $message = $this->getConfigInstance()->readConfig("hub_msg_bye"); - } - - // Debug message - $this->getDebugInstance()->output(sprintf("[%s] Sending message \"%s\" to peer %s.
\n", - __METHOD__, - $message, - $this->getValidatedIP() - )); - - // Send it to the peer - if (socket_write($this->peerSocket, $message."\n") !== false) { - // Set the timestamp and message - $this->lastSentMessage = $message; - $this->lastSentMessageStamp = time(); - } else { - // Message could not be sent - throw new BrokenPipeException ( - array( - 'this' => $this, - 'code' => socket_last_error() - ), self::EXCEPTION_PEER_SOCKET_BROKEN - ); - } - } - - /** - * Asks the connected new peer for the authorization key - * - * @return void - */ - public final function askAuthorizationKey () { - if ($this->ifPeerNeedsAuthRequest()) { - // This peer needs to receive the AUTH command so send it to him - $this->sendMessage($this->getConfigInstance()->readConfig("hub_auth_request")); - - // Set it to done - $this->needAuthRequest = false; - } - } - - /** - * Determines wether the peer is a local admin (localhost connection) - * - * @return $isLocalAdmin Wether the peer is a local admin - */ - public function ifPeerIsLocalAdmin () { - // Get the remote IP and extract only the first three numbers - $remoteArray = explode(".", self::$peerIP); - - // Is the peer a local admin? - return (($remoteArray[0].".".$remoteArray[1].".".$remoteArray[2]) == "127.0.0"); - } - - /** - * Enables the local admin and authorizes this peer - * - * @return void - */ - public function enableLocalAdmin() { - // Is this IP really local? - if (($this->ifPeerIsLocalAdmin()) && (!$this->ifPeerIsAuthorized())) { - // Then authorize him - $this->isAuthorized = true; - $this->needAuthRequest = false; - } // END - if - } - - /** - * Says "hi" to the local admin - * - * @return void - */ - public function sayHi2Admin () { - // Send a message to him... ;-) - $this->sendMessage("Local admin console is ready. Enter HELP for instructions."); - } - - /** - * Enables wether the peer is authorized - * - * @param $isAuthValid Wether the authorization wents fine - * @return void - */ - public function enableIsAuthorized ($isAuthValid = true) { - $this->isAuthorized = true; - } - - /** - * Checks wether a HELLO has been sent and if not it will be send to the other peer - * - * @return $helloSent Wether a HELLO has been sent - */ - public function ifHelloReceived () { - // HELLO has been sent? - if (!$this->helloSent) { - // Read some data - $read = $this->readFromSocket(); - - // Is this a HELLO? - if ($read == $this->getConfigInstance()->readConfig("hub_peer_hello")) { - // All right! A HELLO has been received - $this->helloSent = true; - $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Peer %s said HELLO to us.", - __METHOD__, - $this->getValidatedIP() - )); - } // END - if - } // END - if - - // Return status - return $this->helloSent; - } - - /** - * Wether this hub has replied our HELLO request - * - * @return $helloReplied Wether this hub has replied our HELLO request - */ - public function ifHelloReplied () { - if ((!$this->helloReplied) && ($this->lastSentMessage == $this->getConfigInstance()->readConfig("hub_peer_hello"))) { - // Read some data - $read = $this->readFromSocket(); - - // Is this a HELLO? - if ($read == $this->getConfigInstance()->readConfig("hub_hello_reply")) { - // Is this the master IP? - if ($this->getValidatedIP() == $this->getConfigInstance()->readConfig("hub_master_ip")) { - // All right! A HELLO has been received - $this->helloReplied = true; - $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] The master hub at %s:%d replied our %s.", - __METHOD__, - $this->getValidatedIP(), - $this->getConfigInstance()->readConfig("hub_master_port"), - $this->getConfigInstance()->readConfig("hub_peer_hello") - )); - } else { - // ELHOs from non-masters are not valid! - $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Peer %s replied our %s but is not the master hub!", - __METHOD__, - $this->getValidatedIP(), - $this->getConfigInstance()->readConfig("hub_peer_hello") - )); - } - } // END - if - } // END - if - - // Return status - return $this->helloReplied; - } - - /** - * Returns wether a ELHO (HELLO reply has been sent) - * - * @return $elhoSent Wether a ELHO has been sent to the peer - */ - public final function ifELHOsent () { - return $this->elhoSent; - } - - /** - * Replies a HELLO message with a ELHO message - * - * @return void - */ - public function replyHelloMessage () { - $this->sendMessage($this->getConfigInstance()->readConfig("hub_hello_reply")); - $this->elhoSent = true; - } - - /** - * Handles pinging this peer - * - * @return void - */ - public function handlePingPeer () { - $lost = false; - - // Do we need to ping? - if ((time() - $this->lastPinged) > $this->getConfigInstance()->readConfig("hub_ping_timeout")) { - // Don't ping any masters! ;-) - if ($this->getValidatedIP() != $this->getConfigInstance()->readConfig("hub_master_ip")) { - // Debug message - $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Sending ping to peer %s...", - $this->__toString(), - $this->getValidatedIP() - )); - - // Send out a PING and await a PONG - $this->commandInstance->simpleExecute( - $this->getConfigInstance()->readConfig("hub_peer_ping"), - $this->getConfigInstance()->readConfig("hub_ping_reply") - ); - - // PONG received within last ping? - if (($this->lastPonged < time()) && (($this->lastPonged - $this->lastPinged) < 0)) { - // Not replied so far - $this->missingPongs++; - - // Debug message - $this->getHubInstance()->getOutputInstance()->output(sprintf("[%s] Ping not replied! Try: %d", - $this->__toString(), - $this->missingPongs - )); - - // Limit reached? - if ($this->missingPongs == $this->getConfigInstance()->readConfig("hub_ping_maxdrops")) { - // This peer is lost - $this->getHubInstance()->disconnectPeerWithReason("hub_peer_miss_pong"); - $lost = true; - } // END - if - } // END - if - - // Last time we pinged is now. - $this->lastPinged = time(); - - } // END - if - } // END - if - - // Connection is lost? - if ($lost === true) return false; - - // Awaiting PONG here - if ($this->commandInstance->ifAwaitsCommand($this->getConfigInstance()->readConfig("hub_ping_reply"))) { - // PONG received! :-) So reset all counters... - $this->lastPonged = time(); - $this->missingPongs = 0; - - // Notify the loop about the ping-pong-time - $this->getHubInstance()->updatePeerEntry($this, (time() - $this->lastPinged)); - } // END - if - } - - /** - * Handles any incoming commands from the master hub - * - * @return void - */ - public function handleMasterRequests () { - // Read the raw socket for data packages - if ($this->commandInstance->awaitAnyCommand()) { - // A command has been received from the master hub - $command = $this->commandInstance->pull(); - - // TODO Handle a command from the master here... - } // END - if - } - - /** - * Reads raw data from the socket and trims leading/trailing spaces away. - * Returns an empty string if no data has been received. - * - * @return $data Raw data from the underlaying socket - * @throws BrokenPipeException If a socket has lost its connection to the peer - */ - public function readFromSocket () { - $data = ""; - $read = array($this->peerSocket); - $write = null; - $except = null; - $num = socket_select($read, $write, $except, 0); - if ($num > 0) { - // Something has changed on a socket - foreach ($read as $socket) { - if (is_resource($socket)) { - $data = trim(@socket_read($socket, 1024, PHP_NORMAL_READ)); - if (socket_last_error() > 0) { - // Throw an exception - throw new BrokenPipeException( - array( - 'this' => $this, - 'code' => socket_last_error() - ), self::EXCEPTION_PEER_SOCKET_BROKEN - ); - } - break; - } // END - if - } // END - foreach - } // END - if - return $data; - } - -} // END - class - -// [EOF] -?> diff --git a/ship-simu/application/hub/middleware/.htaccess b/ship-simu/application/hub/middleware/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/application/hub/middleware/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/application/hub/starter.php b/ship-simu/application/hub/starter.php deleted file mode 100644 index 286e2b881..000000000 --- a/ship-simu/application/hub/starter.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// 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 %s kann nicht gestartet werden, da die Hilfsklasse %s nicht geladen ist!", - $application, - FrameworkConfiguration::getInstance()->readConfig("app_helper_class") - )); -} elseif (!is_object($app)) { - // No object! - ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die 'app' kein Objekt ist!", - $application - )); -} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) { - // Method not found! - ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation %s kann nicht gestartet werden, da die Methode %s fehlt!", - $application, - FrameworkConfiguration::getInstance()->readConfig("entry_method") - )); -} - -// Call the entry point method -try { - $eval = sprintf("%s::getInstance()->%s();", - FrameworkConfiguration::getInstance()->readConfig("app_helper_class"), - FrameworkConfiguration::getInstance()->readConfig("entry_method") - ); - eval($eval); -} catch (SocketCreationException $e) { - // Problems while creating sockets - ApplicationEntryPoint::app_die(sprintf("[Main:] Das Hub konnte nicht initialisiert werden. Reason: %s, Code: %s", - $e->getMessage(), - $e->getHexCode() - )); -} catch (SocketSetupException $e) { - // Problems while setting up sockets - ApplicationEntryPoint::app_die(sprintf("[Main:] Das Hub konnte nicht initialisiert werden. Reason: %s, Code: %s", - $e->getMessage(), - $e->getHexCode() - )); -} catch (SocketBindException $e) { - // Problems while binding to address/port - ApplicationEntryPoint::app_die(sprintf("[Main:] Das Hub konnte nicht initialisiert werden. Reason: %s, Code: %s", - $e->getMessage(), - $e->getHexCode() - )); -} catch (SocketListeningException $e) { - // Problems while starting listen to the socket - ApplicationEntryPoint::app_die(sprintf("[Main:] Das Hub konnte nicht initialisiert werden. Reason: %s, Code: %s", - $e->getMessage(), - $e->getHexCode() - )); -} - -// [EOF] -?> diff --git a/ship-simu/chat-server.php b/ship-simu/chat-server.php deleted file mode 100644 index 8c0afd8f1..000000000 --- a/ship-simu/chat-server.php +++ /dev/null @@ -1,164 +0,0 @@ - 0) { - // create a copy, so $clients doesn't get modified by socket_select() - $read = $clients; - - // get a list of all the clients that have data to be read from - // if there are no clients with data, go to next iteration - $left = @socket_select($read, $write = null, $except = null, 0); - if ($left < 1) { - continue; - } - - // check if there is a client trying to connect - if (in_array($main_sock, $read)) { - // accept the client, and add him to the $clients array - $new_sock = socket_accept($main_sock); - $clients[] = $new_sock; - - // send the client a welcome message - socket_write($new_sock, "no noobs, but ill make an exception :)\n". - "There are ".(count($clients) - 1)." client(s) connected to the server\n"); - - socket_getpeername($new_sock, $ip); - print "[".date("m/d/Y:H:i:s", time())."]:New client connected: {$ip}\n"; - - // Notify all chatter - if (count($clients) > 2) { - foreach ($clients as $send_sock) { - if ($send_sock != $main_sock && $send_sock != $new_sock) { - socket_write($send_sock, "Server: Chatter has joined from {$ip}. There are now ".(count($clients) - 1)." clients.\n"); - } - } - } - - // remove the listening socket from the clients-with-data array - $key = array_search($main_sock, $read); - unset($read[$key]); - } - - // loop through all the clients that have data to read from - foreach ($read as $read_sock) { - // Get client data - socket_getpeername($read_sock, $ip); - - // read until newline or 1024 bytes - // socket_read while show errors when the client is disconnected, so silence the error messages - $data = @socket_read($read_sock, 1024, PHP_NORMAL_READ); - - // check if the client is disconnected - if (($data === false) || (in_array(strtolower(trim($data)), $leaving))) { - - // remove client for $clients array - $key = array_search($read_sock, $clients); - unset($clients[$key]); - print "[".date("m/d/Y:H:i:s", time())."]:Client from {$ip} disconnected. Left: ".(count($clients) - 1)."\n"; - - // Notify all chatter - if (count($clients) > 1) { - foreach ($clients as $send_sock) { - if ($send_sock != $main_sock) { - socket_write($send_sock, "Server: Chatter from {$ip} has logged out. ".(count($clients) - 1)." left.\n"); - } - } - } - - // continue to the next client to read from, if any - socket_write($read_sock, "Server: Good bye.\n"); - socket_shutdown($read_sock, 2); - socket_close($read_sock); - continue; - } elseif (in_array(trim($data), $shutdown)) { - // Is he allowed to shutdown? - if (!in_array($ip, $masters)) { - print "[".date("m/d/Y:H:i:s", time())."]:Client $ip has tried to shutdown the server!\n"; - socket_write($read_sock, "Server: You are not allowed to shutdown the server!\n"); - $data = ""; - continue; - } - - // Close all connections a leave here - foreach ($clients as $client) { - // Send message to client - if ($client !== $main_sock && $client != $read_sock) { - socket_write($client, "Server: Shutting down! Thank you for joining us.\n"); - } - - // Quit him - socket_shutdown($client, 2); - socket_close($client); - } // end foreach - - // Leave the loop - $data = ""; - $clients = array(); - continue; - } - - // trim off the trailing/beginning white spaces - $data = trim($data); - - // Test for HTML codes - $tags = strip_tags($data); - - // check if there is any data after trimming off the spaces - if (!empty($data) && $tags == $data && count($clients) > 2) { - // send this to all the clients in the $clients array (except the first one, which is a listening socket) - foreach ($clients as $send_sock) { - - // if its the listening sock or the client that we got the message from, go to the next one in the list - if ($send_sock == $main_sock || $send_sock == $read_sock) - continue; - - // write the message to the client -- add a newline character to the end of the message - socket_write($send_sock, "{$ip}:{$data}\n"); - - } // end of broadcast foreach - - // Send confirmation to "chatter" - socket_write($read_sock, "\nServer: Message accepted.\n"); - } elseif ($tags != $data) { - // HTML codes are not allowed - print "[".date("m/d/Y:H:i:s", time())."]:Client $ip has entered HTML code!\n"; - socket_write($read_sock, "Server: HTML is forbidden!\n"); - } elseif ((count($clients) == 2) && ($read_sock != $main_sock)) { - // No one else will hear the "chatter" - print "[".date("m/d/Y:H:i:s", time())."]:Client $ip speaks with himself.\n"; - socket_write($read_sock, "Server: No one will hear you!\n"); - } - } // end of reading foreach -} - -// close the listening socket -socket_close($main_sock); - -?> - \ No newline at end of file diff --git a/ship-simu/devel/.htaccess b/ship-simu/devel/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/devel/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/devel/class_Debug.php b/ship-simu/devel/class_Debug.php deleted file mode 100644 index 1adbe5a70..000000000 --- a/ship-simu/devel/class_Debug.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class Debug { - // Constructor - public function __construct () { - // Konstruktoren debuggen (nur im Zusammenhang mit den folgenden Schaltern effektiv) - // VIELE DEBUG-MELDUNGEN!!! - //define('DEBUG_CONSTRUCT', true); - // eval()-Befehle debuggen - //define('DEBUG_EVAL', true); - // Systeme debuggen - //define('DEBUG_SYSTEM', true); - // SimulatorBase debuggen (VORSICHT! SEHR VIELE DEBUG-MELDUNGEN!!!) - //define('DEBUG_CORE', true); - //////// Objekte debuggen (ausgeben) //////// - // Datenbank-Objekt debuggen - //define('DEBUG_DATABASE_OBJ', true); - //////// Alles unteren debuggen //////// - //define('DEBUG_ALL', true); - // Kompressor debuggen - //define('DEBUG_COMPRESSOR', true); - // Datenbankschichten debuggen - //define('DEBUG_DATABASE', true); - // Template-System debuggen - //define('DEBUG_TEMPLATE', true); - // Konfiguration debuggen - //define('DEBUG_CONFIG', true); - } -} - -/** - * Initialize the dummy debug class - */ -$dummy = new Debug(); -unset($dummy); - -// -?> diff --git a/ship-simu/docs/COPYING b/ship-simu/docs/COPYING deleted file mode 100644 index 94a9ed024..000000000 --- a/ship-simu/docs/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/ship-simu/docs/NEWS b/ship-simu/docs/NEWS deleted file mode 100644 index 9ad0e8539..000000000 --- a/ship-simu/docs/NEWS +++ /dev/null @@ -1,6 +0,0 @@ -NEWS -==== - -[2008-01-26] ------------- -- First complete SVN import announced diff --git a/ship-simu/docs/README b/ship-simu/docs/README deleted file mode 100644 index f196a1dac..000000000 --- a/ship-simu/docs/README +++ /dev/null @@ -1,4 +0,0 @@ -README ------- - -This file needs some extending... ;) diff --git a/ship-simu/docs/THANKS b/ship-simu/docs/THANKS deleted file mode 100644 index bd56a2cfa..000000000 --- a/ship-simu/docs/THANKS +++ /dev/null @@ -1,6 +0,0 @@ -Special Thanks goes to: - - Daff - - toms - - And all the others I have not listed here. - -If you think your name is missing here please ICQ me: 8809296 diff --git a/ship-simu/inc/.htaccess b/ship-simu/inc/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes.php b/ship-simu/inc/classes.php deleted file mode 100644 index fb00ebf2c..000000000 --- a/ship-simu/inc/classes.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Lower framework classes -$lowerClasses = array( - 0 => "exceptions", // Exceptions - 1 => "interfaces", // Interfaces - 2 => "main", // General main classes - 3 => "middleware" // The middleware -); - -// Load all classes -foreach ($lowerClasses as $class) { - // Try to load the framework classes - try { - ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $class)); - } catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", - $class - )); - } catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", - $class - )); - } catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", - $class - )); - } catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", - $class - )); - } -} - -// Include all classes -ClassLoader::getInstance()->includeAllClasses(); - -// Clean up the global namespace -unset($lowerClasses[3]); // Applications shall not have any middleware -unset($class); - -////// Until here the framework classes are loaded ////// - -// [EOF] -?> diff --git a/ship-simu/inc/classes/.htaccess b/ship-simu/inc/classes/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/.htaccess b/ship-simu/inc/classes/exceptions/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/class_FrameworkException.php b/ship-simu/inc/classes/exceptions/class_FrameworkException.php deleted file mode 100644 index 46a034242..000000000 --- a/ship-simu/inc/classes/exceptions/class_FrameworkException.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -abstract class FrameworkException extends ReflectionException { - /** - * Array for the backtrace - */ - private $backTrace = array(); - - /** - * The super constructor for all exceptions - * - * @param $message The non-optional message for the exception - * @param $code An optional code for better debugging - * @return void - */ - public function __construct($message, $code = 0) { - // Extract backtrace - $this->saveBackTrace(); - - // Cast all data - $message = (string) $message; - $code = (int) $code; - - // make sure everything is assigned properly - parent::__construct($message, $code); - } - - /** - * Save the current backtrace - * - * @return void - */ - private final function saveBackTrace () { - $this->backTrace = debug_backtrace(); - } - - /** - * Get saved backtrace - * - * @return $backTrace The full backtrace in an array - */ - public final function getBackTrace () { - return $this->backTrace; - } - - /** - * Returns the name of the thrown exception - * - * @return $toString The name of the thrown exception - */ - public function __toString() { - return get_class($this); - } - - /** - * Getter for hex-decimal code - * - * @return $hexCode The exception code in hex-decimal format - */ - public final function getHexCode () { - // Get the decimal code - $code = $this->getCode(); - - // Format it to hex-decimal, 0x as prefix and 3 chars - $hexCode = sprintf("0x%03s", dechex($code)); - - // Return it - return $hexCode; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/compressor/.htaccess b/ship-simu/inc/classes/exceptions/compressor/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/compressor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php b/ship-simu/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php deleted file mode 100644 index f6196019d..000000000 --- a/ship-simu/inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class MismatchingCompressorsException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Kompressor %s zu den geladenen Daten aus %s und der aktuell verwendete Kompressor %s stimmen nicht überein!", - $array[0]->__toString(), - $this->getLine(), - strtoupper($array[1]), - sprintf("%s:%s", - basename(dirname($array[2])), - basename($array[2]) - ), - strtoupper($array[3]) - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/container/.htaccess b/ship-simu/inc/classes/exceptions/container/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/container/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php b/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php deleted file mode 100644 index ae3dfad6d..000000000 --- a/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ContainerItemIsNoArrayException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Ein Container-Item ist kein Array.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNullException.php b/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNullException.php deleted file mode 100644 index 3d7014477..000000000 --- a/ship-simu/inc/classes/exceptions/container/class_ContainerItemIsNullException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ContainerItemIsNullException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Ein Container-Item ist auf null gesetzt.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php b/ship-simu/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php deleted file mode 100644 index f5e77acf1..000000000 --- a/ship-simu/inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ContainerMaybeDamagedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Ein Container ist möglicherweise beschädigt.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/database/.htaccess b/ship-simu/inc/classes/exceptions/database/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/database/local_file/.htaccess b/ship-simu/inc/classes/exceptions/database/local_file/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php b/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php deleted file mode 100644 index 938edc54f..000000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SavePathIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Speicherpfad ist leer.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php b/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php deleted file mode 100644 index fa59a43ee..000000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SavePathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der angegebene Speicherpfad %s ist ungütig (kein Pfad).", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php b/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php deleted file mode 100644 index 8647da18c..000000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SavePathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der Pfad %s ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php b/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php deleted file mode 100644 index 7236f56bc..000000000 --- a/ship-simu/inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SavePathWriteProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der angegebene Speicherpfad %s ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/.htaccess b/ship-simu/inc/classes/exceptions/io/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/io/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php b/ship-simu/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php deleted file mode 100644 index a8a616f59..000000000 --- a/ship-simu/inc/classes/exceptions/io/class_DirPointerNotOpenedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class DirPointerNotOpenedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Für den Pfad %s konnte kein Pointer initialisiert werden.", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php b/ship-simu/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php deleted file mode 100644 index da5e8fe57..000000000 --- a/ship-simu/inc/classes/exceptions/io/class_FilePointerNotOpenedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class FilePointerNotOpenedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Für die Datei %s konnte kein Pointer initialisiert werden. Möglicherweise ist die Datei nicht lesbar oder fehlt!", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_InvalidDataLengthException.php b/ship-simu/inc/classes/exceptions/io/class_InvalidDataLengthException.php deleted file mode 100644 index 7952be81b..000000000 --- a/ship-simu/inc/classes/exceptions/io/class_InvalidDataLengthException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidDataLengthException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Eine unerwartete Datenlänge von %s Byte ist aufgetreten. %s wurden erwartet!", - $array[0]->__toString(), - $this->getLine(), - $array[1], - $array[2] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php b/ship-simu/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php deleted file mode 100644 index caabc3240..000000000 --- a/ship-simu/inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidDirectoryResourceException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - if (is_null($class)) { - $message = "[???:] Ungütige Verzeichnis-Resource."; - } elseif (is_object($class)) { - $message = sprintf("[%s:%d] Ungütige Verzeichnis-Resource.", - $class->__toString(), - $this->getLine() - ); - } - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php b/ship-simu/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php deleted file mode 100644 index 349e7132e..000000000 --- a/ship-simu/inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidMD5ChecksumException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Die MD5-Prüfsummen %s und %s stimmen nicht überein!", - $array[0]->__toString(), - $this->getLine(), - $array[1], - $array[2] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_PathIsEmptyException.php b/ship-simu/inc/classes/exceptions/io/class_PathIsEmptyException.php deleted file mode 100644 index cd6010c44..000000000 --- a/ship-simu/inc/classes/exceptions/io/class_PathIsEmptyException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class PathIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - if (is_null($class)) { - $message = "[???:] Der Verzeichnisname ist leer."; - } elseif (is_object($class)) { - $message = sprintf("[%s:%d] Der Verzeichnisname ist leer.", - $class->__toString(), - $this->getLine() - ); - } - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php b/ship-simu/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php deleted file mode 100644 index b458387ad..000000000 --- a/ship-simu/inc/classes/exceptions/io/class_PathIsNoDirectoryException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class PathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der angegebene Pfad %s ist ungütig (kein Pfad).", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/io/class_PathReadProtectedException.php b/ship-simu/inc/classes/exceptions/io/class_PathReadProtectedException.php deleted file mode 100644 index d630daf15..000000000 --- a/ship-simu/inc/classes/exceptions/io/class_PathReadProtectedException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class PathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($path, $code) { - // Add a message around the missing class - $message = sprintf("Der Pfad %s ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/language/.htaccess b/ship-simu/inc/classes/exceptions/language/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/language/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php b/ship-simu/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php deleted file mode 100644 index f9656d8b9..000000000 --- a/ship-simu/inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidLanguagePathStringException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] %s ist keine Zeichenkette!", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php b/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php deleted file mode 100644 index 01068d82d..000000000 --- a/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class LanguagePathIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Sprachen-Basispfad ist leer.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php b/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php deleted file mode 100644 index 1761298b8..000000000 --- a/ship-simu/inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class LanguagePathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Sprach-Basispfad %s existiert nicht oder ist eine Datei!", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php b/ship-simu/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php deleted file mode 100644 index f803c4275..000000000 --- a/ship-simu/inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class LanguagePathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Sprach-Basispfad %s ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/.htaccess b/ship-simu/inc/classes/exceptions/main/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/main/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/main/class_ClassMismatchException.php b/ship-simu/inc/classes/exceptions/main/class_ClassMismatchException.php deleted file mode 100644 index 5f73e055a..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_ClassMismatchException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ClassMismatchException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($classArray, $code) { - // Add a message around the missing class - $message = sprintf("Die Klasse %s ist ungleich %s.", - $classArray[0], - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ClassNotFoundException.php b/ship-simu/inc/classes/exceptions/main/class_ClassNotFoundException.php deleted file mode 100644 index 0d3918c0d..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_ClassNotFoundException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ClassNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("Die interne Script-Klasse %s konnte nicht gefunden werden!", $class); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php b/ship-simu/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php deleted file mode 100644 index 497438e6e..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ConfigEntryIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Leeren Konfigurationseintrag angegeben!", - $class, - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php b/ship-simu/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php deleted file mode 100644 index 14244c8bc..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ConfigEntryNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct (array $classArray, $code) { - // Cast the array - $classArray = (array) $classArray; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Konfigurationseintrag %s nicht gefunden.", - $classArray[0], - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php b/ship-simu/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php deleted file mode 100644 index 7407c507b..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_DimNotFoundInArrayException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class DimNotFoundInArrayException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - if (is_object($class)) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Abmasse konnten nicht extrahiert werden!", - $class->__toString(), - $this->getLine() - ); - } else { - // No class given - $message = sprintf("Please provide a class for %s", __CLASS__); - } - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ExceptionNotChangedException.php b/ship-simu/inc/classes/exceptions/main/class_ExceptionNotChangedException.php deleted file mode 100644 index d6d0635b0..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_ExceptionNotChangedException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @deprecated - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ExceptionNotChangedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Exception(s) wurde(n) nicht geändert.", - $class, - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_ExceptionNotFoundException.php b/ship-simu/inc/classes/exceptions/main/class_ExceptionNotFoundException.php deleted file mode 100644 index 04b268506..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_ExceptionNotFoundException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ExceptionNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct (array $classArray, $code) { - // Cast the array - $classArray = (array) $classArray; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Exception %s nicht gefunden.", - $classArray[0], - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_GetterNotFoundException.php b/ship-simu/inc/classes/exceptions/main/class_GetterNotFoundException.php deleted file mode 100644 index 95ecc95e0..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_GetterNotFoundException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class GetterNotFoundException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($dataArray, $code) { - // Cast the array - $dataArray = (array) $dataArray; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Getter-Methode für Attribut %s nicht gefunden.", - $dataArray[0]->__toString(), - $this->getLine(), - $dataArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_InvalidArrayCountException.php b/ship-simu/inc/classes/exceptions/main/class_InvalidArrayCountException.php deleted file mode 100644 index 3c1a7e66f..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_InvalidArrayCountException.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidArrayCountException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] %s hat %d Elemente, soll aber %d enthalten!", - $array[0]->__toString(), - $this->getLine(), - $array[1], - $array[2], - $array[3] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_InvalidObjectException.php b/ship-simu/inc/classes/exceptions/main/class_InvalidObjectException.php deleted file mode 100644 index c847c2294..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_InvalidObjectException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidObjectException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: %s)", - $class->__toString(), - $this->getLine(), - $class->getPartDescr() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_MissingArrayElementsException.php b/ship-simu/inc/classes/exceptions/main/class_MissingArrayElementsException.php deleted file mode 100644 index aee6090a0..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_MissingArrayElementsException.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class MissingArrayElementsException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($classArray, $code) { - // Cast the array - $classArray = (array) $classArray; - - // Extract all elements - $elements = ""; - if ((isset($classArray[2])) && (is_array($classArray[2]))) { - // Convert into strings - $elements = implode("
, ", $classArray[2]); - } else { - // Invalid data - $elements = "invalid_data"; - } - - // Add a message around the missing class - $message = sprintf("[%s:%d] Das Array %s() keine Elemente %s auf!", - $classArray[0]->__toString(), - $this->getLine(), - $classArray[1], - $elements - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php b/ship-simu/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php deleted file mode 100644 index 392474d23..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @deprecated - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class MissingDecimalsThousandsSeperatorException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($instance, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Die Dezimal- und Tausendertrenner fehlen!", - $instance->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_MissingMethodException.php b/ship-simu/inc/classes/exceptions/main/class_MissingMethodException.php deleted file mode 100644 index f8c5a683f..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_MissingMethodException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class MissingMethodException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($classArray, $code) { - // Cast the array - $classArray = (array) $classArray; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Weisst keine Methode %s() auf!", - $classArray[0]->__toString(), - $this->getLine(), - $classArray[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_NoArrayCreatedException.php b/ship-simu/inc/classes/exceptions/main/class_NoArrayCreatedException.php deleted file mode 100644 index 69e4ad245..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_NoArrayCreatedException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class NoArrayCreatedException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] %s ist kein erstelltes Objekt.", - $array[0]->__toString(), - $this->getLine(), - $array[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_NoArrayException.php b/ship-simu/inc/classes/exceptions/main/class_NoArrayException.php deleted file mode 100644 index 490a6c0d6..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_NoArrayException.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class NoArrayException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($string, $code) { - // Add a message around the missing class - $message = sprintf("%s ist kein Array!", - $string - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_NoObjectException.php b/ship-simu/inc/classes/exceptions/main/class_NoObjectException.php deleted file mode 100644 index 7c7b519c1..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_NoObjectException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * @deprecated - * @see InvalidObjectException - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class NoObjectException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($string, $code) { - // Add a message around the missing class - $message = sprintf("%s ist kein Objekt!", - $string - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_NullPointerException.php b/ship-simu/inc/classes/exceptions/main/class_NullPointerException.php deleted file mode 100644 index c43f466ec..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_NullPointerException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class NullPointerException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Eine Instanz/Pointer ist auf null gesetzt.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/main/class_VariableIsNotSetException.php b/ship-simu/inc/classes/exceptions/main/class_VariableIsNotSetException.php deleted file mode 100644 index 821dfb40a..000000000 --- a/ship-simu/inc/classes/exceptions/main/class_VariableIsNotSetException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class VariableIsNotSetException extends FrameworkException { - /** - * The constructor - * - * @param $message Message from the exception - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($array, $code) { - // Cast the array - $array = (array) $array; - - // Add a message around the missing class - $message = sprintf("[%s:%d] Bei der Initialisierung der Applikation %s wurde keine Variable %s erzeugt.", - $array[0]->__toString(), - $this->getLine(), - $array[1], - $array[2] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/.htaccess b/ship-simu/inc/classes/exceptions/template/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/exceptions/template/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/exceptions/template/class_BasePathIsEmptyException.php b/ship-simu/inc/classes/exceptions/template/class_BasePathIsEmptyException.php deleted file mode 100644 index 4c6cbc541..000000000 --- a/ship-simu/inc/classes/exceptions/template/class_BasePathIsEmptyException.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class BasePathIsEmptyException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Template-Basispfad ist leer.", - $class->__toString(), - $this->getLine() - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php b/ship-simu/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php deleted file mode 100644 index 4c6de810a..000000000 --- a/ship-simu/inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class BasePathIsNoDirectoryException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Template-Basispfad %s existiert nicht oder ist eine Datei!", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_BasePathReadProtectedException.php b/ship-simu/inc/classes/exceptions/template/class_BasePathReadProtectedException.php deleted file mode 100644 index ea35cfe10..000000000 --- a/ship-simu/inc/classes/exceptions/template/class_BasePathReadProtectedException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class BasePathReadProtectedException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Template-Basispfad %s ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_InvalidBasePathStringException.php b/ship-simu/inc/classes/exceptions/template/class_InvalidBasePathStringException.php deleted file mode 100644 index 36f200260..000000000 --- a/ship-simu/inc/classes/exceptions/template/class_InvalidBasePathStringException.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidBasePathStringException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] %s ist keine Zeichenkette!", - $class[0]->__toString(), - $this->getLine(), - $class[1] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php b/ship-simu/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php deleted file mode 100644 index 7683d2c34..000000000 --- a/ship-simu/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class InvalidTemplateVariableNameException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Die im Template %s gefundene Variable %s ist nicht gültig! Gültige Variablennamen sind nur %s.", - $class[0]->__toString(), - $this->getLine(), - basename($class[1]), - $class[2], - $class[3]->readConfig("tpl_valid_var") - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php b/ship-simu/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php deleted file mode 100644 index 5cbe2bed5..000000000 --- a/ship-simu/inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class UnexpectedTemplateTypeException extends FrameworkException { - /** - * The constructor - * - * @param $class An array holding our informations - * @param $code Code number for the exception - * @return void - */ - public final function __construct ($class, $code) { - // Add a message around the missing class - $message = sprintf("[%s:%d] Der Template-Typ %s entspricht nicht dem erwartetem Template-Typ %s.", - $class[0]->__toString(), - $this->getLine(), - $class[1], - $class[2] - ); - - // Call parent constructor - parent::__construct($message, $code); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/.htaccess b/ship-simu/inc/classes/interfaces/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/application/.htaccess b/ship-simu/inc/classes/interfaces/application/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/application/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/application/class_ManageableApplication.php b/ship-simu/inc/classes/interfaces/application/class_ManageableApplication.php deleted file mode 100644 index 60584f833..000000000 --- a/ship-simu/inc/classes/interfaces/application/class_ManageableApplication.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface ManageableApplication extends FrameworkInterface { - /** - * Getter for application's version number - * - * @return $appVersion The application's version number - */ - function getAppVersion (); - /** - * Setter for application's version number - * - * @param $appVersion The application's version number - * @return void - */ - function setAppVersion ($appVersion); - - /** - * Getter for application's human-readable name - * - * @return $appName The application's name readable for humans - */ - function getAppName (); - - /** - * Setter for application's human-readable name - * - * @param $appName The application's name readable for humans - * @return void - */ - function setAppName ($appName); - - /** - * Getter for application's short uni*-like name - * - * @return $shortName The application's name readable for humans - */ - function getAppShortName (); - - /** - * Setter for application's short uni*-like name - * - * @param $shortName The application's name readable for humans - * @return void - */ - function setAppShortName ($shortName); - - /** - * Launches the application - * - * @return void - */ - function entryPoint (); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/class_FrameworkInterface.php b/ship-simu/inc/classes/interfaces/class_FrameworkInterface.php deleted file mode 100644 index 3c9d5ff52..000000000 --- a/ship-simu/inc/classes/interfaces/class_FrameworkInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface FrameworkInterface { -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/compressor/.htaccess b/ship-simu/inc/classes/interfaces/compressor/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/compressor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/compressor/class_Compressor.php b/ship-simu/inc/classes/interfaces/compressor/class_Compressor.php deleted file mode 100644 index 5f42ec323..000000000 --- a/ship-simu/inc/classes/interfaces/compressor/class_Compressor.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface Compressor extends FrameworkInterface { - /** - * A compression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object - */ - function compressStream ($streamData); - - /** - * A decompression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object - */ - function decompressStream ($streamData); - - /** - * Getter for the file extension of this compressor - * - * @return $string The compressor's file extension - */ - function getCompressorExtension (); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/database/.htaccess b/ship-simu/inc/classes/interfaces/database/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php b/ship-simu/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php deleted file mode 100644 index 0b0629800..000000000 --- a/ship-simu/inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php +++ /dev/null @@ -1,69 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface FrameworkDatabaseInterface extends FrameworkInterface { - /** - * Saves a whole object by serializing it entirely or some specifyable - * parts. Specifying parts must be done before this method is called. If - * it is not done this method will serialize the whole object. - * - * @param $object An instance to the object we want to save - * @return void - * @see limitObject(ObjectLimits) limitObject - */ - function saveObject ($object); - - /** - * Analyses if a unique ID has already been used or not. This method does - * only pass the given ID through to the "real" database layer. - * - * @param $uniqueID A unique ID number which shall be checked - * before it will be used - * @param $inConstructor If called from a constructor or from - * somewhere else - * @return $isUnused true = The unique ID was not found in the database, - * false = It is already in use by an other object - * @throws NullPointerException If $dbInstance is null - * @throws NoObjectException If $dbInstance is not an object - * @throws MissingMethodException If the required method - * isUniqueIdUsed() was not found - */ - function isUniqueIdUsed ($uniqueID, $inConstructor = false); - - /** - * Gets cached data from the database layer and if not found fetch it from - * the database again. This method does not return the header stuff because - * The underlaying database class will return only the requested content. - * - * @param $idNumber The ID number which we need for looking up - * the requested data - * @return $cachedArray The maybe cached data from the database - * @throws NullPointerException If $dbInstance is null - * @throws NoObjectException If $dbInstance is not an object - * @throws MissingMethodException If the required method - * isUniqueIdUsed() was not found - */ - function getObjectFromCachedData ($idNumber); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/database/frontend/.htaccess b/ship-simu/inc/classes/interfaces/database/frontend/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/database/frontend/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php b/ship-simu/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php deleted file mode 100644 index 839ba634c..000000000 --- a/ship-simu/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface DatabaseFrontendInterface extends FrameworkDatabaseInterface { - /** - * Loads data saved with saveObject from the database and re-creates a - * full object from it. - * If limitObject() was called before a new object ObjectContainer with - * all requested attributes will be returned instead. - * - * @return Object The fully re-created object or instance to - * ObjectContainer - */ - function loadObject (); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/database/middleware/.htaccess b/ship-simu/inc/classes/interfaces/database/middleware/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/database/middleware/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php b/ship-simu/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php deleted file mode 100644 index 0182ef87f..000000000 --- a/ship-simu/inc/classes/interfaces/database/middleware/class_DatabaseConnector.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface DatabaseConnector extends FrameworkDatabaseInterface { -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/debug/.htaccess b/ship-simu/inc/classes/interfaces/debug/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/debug/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/debug/class_Debugger.php b/ship-simu/inc/classes/interfaces/debug/class_Debugger.php deleted file mode 100644 index 46cdeb44a..000000000 --- a/ship-simu/inc/classes/interfaces/debug/class_Debugger.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface Debugger extends FrameworkInterface { - /** - * Outputs the given data - * - * @param $output Debug text for output - * @return void - */ - function outputStream ($output); -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/extended/.htaccess b/ship-simu/inc/classes/interfaces/extended/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/extended/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/extended/class_LimitableObject.php b/ship-simu/inc/classes/interfaces/extended/class_LimitableObject.php deleted file mode 100644 index 8ed5eb955..000000000 --- a/ship-simu/inc/classes/interfaces/extended/class_LimitableObject.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface LimitableObject extends FrameworkInterface { - /** - * Reduces the volume of a processed object. - * - * @param $limitInstance An instance to ObjectLimits which holds - * attribute names that we want to include - * in the processing phase. Other attributes - * except $uniqueID and $realClass will be - * ignored and keept out. - * @return void - */ - function limitObject (ObjectLimits $limitInstance); -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/io/.htaccess b/ship-simu/inc/classes/interfaces/io/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/io/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/io/class_Streamable.php b/ship-simu/inc/classes/interfaces/io/class_Streamable.php deleted file mode 100644 index 1392564ea..000000000 --- a/ship-simu/inc/classes/interfaces/io/class_Streamable.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface Streamable extends FrameworkInterface { -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/io/file/.htaccess b/ship-simu/inc/classes/interfaces/io/file/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/io/file/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/io/file/class_FileInputStreamer.php b/ship-simu/inc/classes/interfaces/io/file/class_FileInputStreamer.php deleted file mode 100644 index 6204e34c6..000000000 --- a/ship-simu/inc/classes/interfaces/io/file/class_FileInputStreamer.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface FileInputStreamer extends Streamable { - /** - * Reads from a local or remote file - * - * @param $fqfn The file's FQFN we shall load - * @return $array An array containing all read lines - * @throws NullPointerException If an instance is null - * @throws NoObjectException If the instance is not an object - * instance - * @throws MissingMethodException If a required method is missing. - * @throws InvalidArrayCountException If an array has not the - * expected size - * @throws InvalidMD5ChecksumException If two MD5 hashes did not match - */ - function loadFileContents ($fqfn); -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/io/file/class_FileOutputStreamer.php b/ship-simu/inc/classes/interfaces/io/file/class_FileOutputStreamer.php deleted file mode 100644 index 55bc37e59..000000000 --- a/ship-simu/inc/classes/interfaces/io/file/class_FileOutputStreamer.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface FileOutputStreamer extends Streamable { - /** - * Saves streamed (that are mostly serialized objects) data to files or - * external servers. - * - * @param $fileName The local file's name including full path - * @param $dataArray Array containing the compressor's extension - * and streamed data - * @return void - * @throws NullPointerException If an instance is null - * @throws NoObjectException If the instance is not an object - * instance - * @throws MissingMethodException If a required method is missing. - */ - function saveFile ($fileName, $dataArray); -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/io/output/.htaccess b/ship-simu/inc/classes/interfaces/io/output/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/io/output/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/io/output/class_OutputStreamer.php b/ship-simu/inc/classes/interfaces/io/output/class_OutputStreamer.php deleted file mode 100644 index 6e4431f92..000000000 --- a/ship-simu/inc/classes/interfaces/io/output/class_OutputStreamer.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface OutputStreamer extends Streamable { - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - function assignVariable($var, $value); - - /** - * Output the code - * - * @return void - */ - function output($outStream=false); -} - -// -?> diff --git a/ship-simu/inc/classes/interfaces/language/.htaccess b/ship-simu/inc/classes/interfaces/language/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/language/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/language/class_ManageableLanguage.php b/ship-simu/inc/classes/interfaces/language/class_ManageableLanguage.php deleted file mode 100644 index 77f3fbc1f..000000000 --- a/ship-simu/inc/classes/interfaces/language/class_ManageableLanguage.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface ManageableLanguage extends FrameworkInterface { - /** - * Initialize the array-object for all later language strings - * - * @return void - */ - function initLanguageStrings(); -} // END - class - -// [EOF] -?> diff --git a/ship-simu/inc/classes/interfaces/template/.htaccess b/ship-simu/inc/classes/interfaces/template/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/interfaces/template/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/interfaces/template/class_CompileableTemplate.php b/ship-simu/inc/classes/interfaces/template/class_CompileableTemplate.php deleted file mode 100644 index 1477f74ba..000000000 --- a/ship-simu/inc/classes/interfaces/template/class_CompileableTemplate.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface CompileableTemplate extends FrameworkInterface { - /** - * Assign variables for templates - * - * @param $var The "variable" we want to assign - * @param $value The value we want to store in the variable - * @return void - */ - function assignVariable ($var, $value); - - /** - * Assign a configuration variables for templates - * - * @param $var The configuration "variable" we want to assign - * @param $value The value we want to store in the variable - * @return void - */ - function assignConfigVariable ($var, $value); - - /** - * Load a specified web template into the engine - * - * @param $template The web template we shall load which is - * located in "html" by default - * @return void - */ - function loadWebTemplate ($template); - - /** - * Load a specified code template into the engine for later compilation - * with other code/web/email templates. - * - * @param $template The code template we shall load which is - * located in "html" by default - * @return void - */ - function loadCodeTemplate ($template); - - /** - * Load a specified email template into the engine - * - * @param $template The email template we shall load which is - * located in "emails" by default - * @return void - */ - function loadEmailTemplate ($template); - - /** - * Compile all variables by inserting their respective values - * - * @return void - */ - function compileVariables (); - - - /** - * Compile all required code/web/email-templates into the current one - * - * @return void - */ - function compileTemplate (); - - /** - * Output the compiled template to the outside world. In case of web - * templates this would be vaild (X)HTML code. And in case of email - * templates this would store a prepared email body inside the template - * engine. - * - * @return void - */ - function output (); -} // END - class - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/.htaccess b/ship-simu/inc/classes/main/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/main/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/class_BaseFrameworkSystem.php b/ship-simu/inc/classes/main/class_BaseFrameworkSystem.php deleted file mode 100644 index 3721f6399..000000000 --- a/ship-simu/inc/classes/main/class_BaseFrameworkSystem.php +++ /dev/null @@ -1,765 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class BaseFrameworkSystem extends stdClass implements FrameworkInterface { - /** - * The instance to the debug output handler (should be DebugConsoleOutput or DebugWebOutput) - * - * @see DebugConsoleOutput - * @see DebugWebOutput - */ - private static $debug = null; - - /** - * The instance to the web output handler (should be WebOutput) - * - * @see WebOutput - */ - private static $webOutput = null; - - /** - * The instance to the compression layer which should be CompressorChannel - */ - private static $compressor = null; - - /** - * The configuration instance which shall be FrameworkConfiguration - */ - private static $cfgInstance = null; - - /** - * The instance to the database layer which should be DatabaseConnection - */ - private $dbInstance = null; - - /** - * The real class name - */ - private $realClass = "FrameworkSystem"; - - /** - * A human-readable description for this simulator part - */ - private $partDescr = "Namenlose Framework-Einheit"; - - /** - * The unique ID string for identifying all type of classes - */ - private $uniqueID = ""; - - /** - * Thousands seperator - */ - private $thousands = "."; // German - - /** - * Decimal seperator - */ - private $decimals = ","; // German - - /*********************** - * Exception codes.... * - ***********************/ - - const EXCEPTION_IS_NULL_POINTER = 0x001; - const EXCEPTION_IS_NO_OBJECT = 0x002; - const EXCEPTION_IS_NO_ARRAY = 0x003; - const EXCEPTION_MISSING_METHOD = 0x004; - const EXCEPTION_CLASSES_NOT_MATCHING = 0x005; - const EXCEPTION_INDEX_OUT_OF_BOUNDS = 0x006; - const EXCEPTION_DIMENSION_ARRAY_INVALID = 0x007; - const EXCEPTION_ITEM_NOT_TRADEABLE = 0x008; - const EXCEPTION_ITEM_NOT_IN_PRICE_LIST = 0x009; - const EXCEPTION_GENDER_IS_WRONG = 0x00a; - const EXCEPTION_BIRTH_DATE_IS_INVALID = 0x00b; - const EXCEPTION_EMPTY_STRUCTURES_ARRAY = 0x00c; - const EXCEPTION_HAS_ALREADY_PERSONELL_LIST = 0x00d; - const EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES = 0x00e; - const EXCEPTION_TOTAL_PRICE_NOT_CALCULATED = 0x00f; - const EXCEPTION_HARBOR_HAS_NO_SHIPYARDS = 0x010; - const EXCEPTION_CONTRACT_PARTNER_INVALID = 0x011; - const EXCEPTION_CONTRACT_PARTNER_MISMATCH = 0x012; - const EXCEPTION_CONTRACT_ALREADY_SIGNED = 0x013; - const EXCEPTION_UNEXPECTED_EMPTY_STRING = 0x014; - const EXCEPTION_PATH_NOT_FOUND = 0x015; - const EXCEPTION_INVALID_PATH_NAME = 0x016; - const EXCEPTION_READ_PROTECED_PATH = 0x017; - const EXCEPTION_WRITE_PROTECED_PATH = 0x018; - const EXCEPTION_DIR_POINTER_INVALID = 0x019; - const EXCEPTION_FILE_POINTER_INVALID = 0x01a; - const EXCEPTION_INVALID_DIRECTORY_POINTER = 0x01b; - const EXCEPTION_UNEXPECTED_OBJECT = 0x01c; - const EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED = 0x01d; - const EXCEPTION_GETTER_IS_MISSING = 0x01e; - const EXCEPTION_ARRAY_EXPECTED = 0x01f; - const EXCEPTION_ARRAY_HAS_INVALID_COUNT = 0x020; - const EXCEPTION_ID_IS_INVALID_FORMAT = 0x021; - const EXCEPTION_MD5_CHECKSUMS_MISMATCH = 0x022; - const EXCEPTION_UNEXPECTED_STRING_SIZE = 0x023; - const EXCEPTION_SIMULATOR_ID_INVALID = 0x024; - const EXCEPTION_MISMATCHING_COMPRESSORS = 0x025; - const EXCEPTION_CONTAINER_ITEM_IS_NULL = 0x026; - const EXCEPTION_ITEM_IS_NO_ARRAY = 0x027; - const EXCEPTION_CONTAINER_MAYBE_DAMAGED = 0x028; - const EXCEPTION_INVALID_STRING = 0x029; - const EXCEPTION_VARIABLE_NOT_SET = 0x02a; - const EXCEPTION_ATTRIBUTES_ARE_MISSING = 0x02b; - const EXCEPTION_ARRAY_ELEMENTS_MISSING = 0x02c; - - /** - * In the super constructor these system classes shall be ignored or else - * we would get an endless calling loop. - * - *--------------------------------------------------------------------* - * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL SHOOT YOUR SERVER!!! * - *--------------------------------------------------------------------* - */ - private $systemClasses = array( - "DebugMiddleware", // Debug middleware output sub-system - "DebugWebOutput", // Debug web output sub-system - "DebugConsoleOutput", // Debug console output sub-system - "DebugErrorLogOutput", // Debug error_log() output sub-system - "CompressorChannel", // Compressor sub-system - "FrameworkDirectoryPointer", // Directory handler sub-system - "NullCompressor", // Null compressor - "Bzip2Compressor", // BZIP2 compressor - "GzipCompressor", // GZIP compressor - "WebOutput", // Web output sub-system - ); - - /** - * Private super constructor - * - * @return void - */ - private function __construct ($class) { - // Set real class - $this->setRealClass($class); - } - - /** - * Destructor reached... - * - * @return void - */ - public function __destruct() { - // Is this object already destroyed? - if ($this->__toString() != "DestructedObject") { - // Debug message - if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { - $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wird zerstört.
\n", - __CLASS__, $this->__toString() - )); - } - - // Destroy all informations about this class but keep some text about it alive - $this->setPartDescr(sprintf("Entferntes Objekt %s", $this->__toString())); - $this->setRealClass("DestructedObject"); - $this->resetUniqueID(); - } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { - // Already destructed object - $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s wurde bereits zerstört.
\n", - __CLASS__, $this->__toString() - )); - } - } - - /** - * The call method where all non-implemented methods end up - * - * @return void - */ - public final function __call ($methodName, $args) { - // Implode all given arguments - $argsString = implode("|", $args); - if (empty($argsString)) $argsString = "NULL"; - - $this->getDebugInstance()->output(sprintf("[%s::%s] Stub! Args: %s", - $this->__toString(), - $methodName, - $argsString - )); - - // Return nothing - return null; - } - - /** - * Public constructor (for initializing things, etc.) - * - * @return void - */ - public function constructor ($class) { - // Call constructor - $this->__construct($class); - - // Get the current (singleton) configuration instance - $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration()); - - // Is the class weather debug nor compressor channel? - if (!in_array($class, $this->systemClasses)) { - // Initialize debug instance - if (is_null($this->getDebugInstance())) { - // Set the debug output system if it is not debug class ;) - $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig("debug_engine"))); - } - - // Initialize web instance - if (is_null($this->getWebOutputInstance())) { - // Generate the eval() command - $eval = sprintf("\$this->setWebOutputInstance(%s::create%s(\"%s\"));", - $this->getConfigInstance()->readConfig("web_engine"), - $this->getConfigInstance()->readConfig("web_engine"), - $this->getConfigInstance()->readConfig("web_content_type") - ); - - // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", - $this->__toString(), - htmlentities($eval) - )); - - // Run the command - eval($eval); - } - - // Initialize compressor channel - if (is_null($this->getCompressorChannel())) { - // Set the compressor channel - $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s", - PATH, - $this->getConfigInstance()->readConfig("compressor_base_path") - ))); - } - - // Initialize database middleware - if (is_null($this->getDatabaseInstance())) { - // Get the middleware instance - $db = DatabaseConnection::getInstance(); - if (is_object($db)) { - // Set the database middleware - $this->setDatabaseInstance($db); - } - } - - // Debug output - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Alle Sub-Systeme sind initialisiert.
\n", - $this->__toString() - )); - } - } - - /** - * Setter for language instance - * - * @param $configInstance The configuration instance which shall - * be FrameworkConfiguration - * @return void - */ - public final function setConfigInstance (FrameworkConfiguration $configInstance) { - $this->cfgInstance = $configInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler auf %s gesetzt.
\n", - $this->__toString(), - $configInstance->__toString() - )); - } - - /** - * Getter for configuration instance - * - * @return $cfhInstance - Configuration instance - */ - public final function getConfigInstance () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler %s angefordert.
\n", - $this->__toString(), - $this->cfgInstance->__toString() - )); - return $this->cfgInstance; - } - - /** - * Setter for debug instance - * - * @param $debugInstance The instance for debug output class - * @return void - */ - public final function setDebugInstance (DebugMiddleware $debugInstance) { - self::$debug = $debugInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Debug-Handler auf %s gesetzt.
\n", - $this->__toString(), - $this->getDebugInstance()->__toString() - )); - } - - /** - * Getter for debug instance - * - * @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput - */ - public final function getDebugInstance () { - return self::$debug; - } - - /** - * Setter for web output instance - * - * @param $webInstance The instance for web output class - * @return void - */ - public final function setWebOutputInstance (OutputStreamer $webInstance) { - self::$webOutput = $webInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Web-Handler auf %s gesetzt.
\n", - $this->__toString(), - $this->getWebOutputInstance()->__toString() - )); - } - - /** - * Getter for web output instance - * - * @return $webOutput - Instance to class WebOutput - */ - public final function getWebOutputInstance () { - return self::$webOutput; - } - - /** - * Static setter for database instance - * - * @param $dbInstance The instance for the database connection - * (forced DatabaseConnection) - * @return void - */ - public final function setDatabaseInstance (DatabaseConnection $dbInstance) { - if ((defined('DEBUG_SYSTEM')) && (is_object($dbInstance->getDebugInstance()))) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Datenbankschicht gesetzt.
\n", - $dbInstance->__toString() - )); - $this->dbInstance = $dbInstance; - } - - /** - * Getter for $realClass - * - * @return $realClass The name of the real class (not BaseFrameworkSystem) - */ - public final function __toString () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] __toString() erreicht.
\n", - $this->realClass - )); - return $this->realClass; - } - - /** - * Setter for the real class name - * - * @param $realClass Class name (string) - * @return void - */ - public final function setRealClass ($realClass) { - // Cast to string - $realClass = (string) $realClass; - - // Set real class - $this->realClass = $realClass; - } - - /** - * Generate unique ID from a lot entropy - * - * @return void - */ - public final function createUniqueID () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID aufgerufen.
\n", - $this->__toString() - )); - - // Existiert noch keine? - if (empty($this->uniqueID)) { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID erzeugt neue Unique-ID.
\n", - $this->__toString() - )); - - // Correct missing class name - $corrected = false; - if ($this->__toString() == "") { - $this->setRealClass(__CLASS__); - $corrected = true; - } - - // Neue ID erstellen - $tempID = false; - while (true) { - // Generate a unique ID number - $tempID = $this->generateIdNumber(); - $isUsed = false; - - // Try to figure out if the ID number is not yet used - try { - if (is_object($this->getDatabaseInstance())) { - $isUsed = $this->getDatabaseInstance()->isUniqueIdUsed($tempID, true); - } - } catch (FrameworkException $e) { - // Catches all and ignores all ;-) - } - - if ( - ( - $tempID !== false - ) && ( - ( - $this->getDatabaseInstance() === null - ) || ( - ( - is_object($this->getDatabaseInstance()) - ) && ( - !$isUsed - ) - ) - ) - ) { - // Abort the loop - break; - } - } - - // Debug message - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] uniqueID ist auf %s gesetzt.
\n", - $this->__toString(), - $tempID - )); - - // Apply the new ID - $this->setUniqueID($tempID); - - // Revert maybe corrected class name - if ($corrected) { - $this->setRealClass(""); - } - - // Remove system classes if we are in a system class - if ((isset($this->systemClasses)) && (in_array($this->__toString(), $this->systemClasses))) { - // This may save some RAM... - $this->removeSystemArray(); - } - } - } - - /** - * Generates a new ID number for classes based from the class' real name, - * the description and some random data - * - * @return $tempID The new (temporary) ID number - */ - private final function generateIdNumber () { - return sprintf("%s@%s", - $this->__toString(), - md5(sprintf("%s:%s:%s:%s:%s:%s", - $this->__toString(), - $this->getPartDescr(), - time(), - getenv('REMOTE_ADDR'), - getenv('SERVER_ADDR'), - mt_rand() - )) - ); - } - - /** - * Setter for unique ID - * - * @param $uniqueID The newly generated unique ID number - * @return void - */ - private final function setUniqueID ($uniqueID) { - // Cast to string - $uniqueID = (string) $uniqueID; - - // Debug message - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID gesetzt auf %s.
\n", - $this->__toString(), - $uniqueID - )); - - // Set the ID number - $this->uniqueID = $uniqueID; - } - - /** - * Getter for unique ID - * - * @return $uniqueID The unique ID of this class - */ - public final function getUniqueID () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID angefordert.
\n", - $this->__toString() - )); - return $this->uniqueID; - } - - /** - * Resets or recreates the unique ID number - * - * @return void - */ - public final function resetUniqueID() { - // Sweet and simple... ;-) - $newUniqueID = $this->generateIdNumber(); - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID zurückgesetzt auf %s.
\n", - $this->__toString(), - $newUniqueID - )); - $this->setUniqueID($newUniqueID); - } - - /** - * Getter for simulator description - * - * @return $partDescr The description of this simulation part - */ - public final function getPartDescr () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] getPartDescr erreicht.
\n", - $this->__toString() - )); - if (isset($this->partDescr)) { - return $this->partDescr; - } else { - return null; - } - } - - /** - * Setter for simulation part description - * - * @param $partDescr The description as string for this simulation part - * @return void - */ - public final function setPartDescr ($partDescr) { - $this->partDescr = (String) $partDescr; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Teilbeschreibung wird auf %s gesetzt.
\n", - $this->__toString(), - $this->partDescr - )); - } - - /** - * Validate if given object is the same as current - * - * @param $object An object instance for comparison with this class - * @return boolean The result of comparing both's unique ID - */ - public final function equals ($object) { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Ist %s=%s?
\n", - $this->__toString(), - $this->__toString(), - $object->__toString() - )); - return ($this->getUniqueID() == $object->getUniqueID()); - } - - /** - * Compare if both simulation part description and class name matches - * (shall be enougth) - * - * @param $itemInstance An object instance to an other class - * @return boolean The result of comparing class name simulation part description - */ - public function itemMatches ($itemInstance) { - return ( - ($this->__toString() == $itemInstance->__toString()) - && ($this->getPartDescr() == $itemInstance->getPartDescr()) - ); - } - - /** - * Compare class name of this and given class name - * - * @param $class The class name as string from the other class - * @return boolean The result of comparing both class names - */ - public final function isClass ($class) { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] %s=%s?
\n", - $this->__toString(), - $this->__toString(), - $class - )); - return ($this->__toString() == $class); - } - - /** - * Stub method (only real cabins shall override it) - * - * @return boolean false = is no cabin, true = is a cabin - */ - public function isCabin () { - return false; - } - - /** - * Stub method for tradeable objects - * - * @return boolean false = is not tradeable by the Merchant class, - * true = is a tradeable object - */ - public function isTradeable () { - return false; - } - - /** - * Formats computer generated price values into human-understandable formats - * with thousand and decimal seperators. - * - * @param $value The in computer format value for a price - * @param $currency The currency symbol (use HTML-valid characters!) - * @param $decNum Number of decimals after commata - * @return $price The for the current language formated price string - * @throws MissingDecimalsThousandsSeperatorException If decimals or - * thousands seperator - * is missing - */ - public function formatCurrency ($value, $currency = "€", $decNum = 2) { - // Are all required attriutes set? - if ((!isset($this->decimals)) || (!isset($this->thousands))) { - // Throw an exception - throw new MissingDecimalsThousandsSeperatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING); - } - - // Cast the number - $value = (float) $value; - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] %d wird umformatiert.
\n", - $this->__toString(), - $value - )); - - // Reformat the US number - $price = sprintf("%s %s", - number_format($value, $decNum, $this->decimals, $this->thousands), - $currency - ); - - // Return as string... - return $price; - } - - /** - * Removes number formating characters - * - * @return void - */ - public final function removeNumberFormaters () { - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Zahlenumformatierungszeichen werden entfernt.
\n", - $this->__toString() - )); - unset($this->thousands); - unset($this->decimals); - } - - /** - * Getter for database layer - * - * @return $dbInstance The database layer instance - */ - public final function getDatabaseInstance () { - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Datenbank-Instanz %s angefordert.
\n", - $this->__toString(), - $this->dbInstance - )); - return $this->dbInstance; - } - - /** - * Setter for compressor channel - * - * @param $compressorChannel An instance of CompressorChannel - * @return void - */ - public final function setCompressorChannel (CompressorChannel $compressorChannel) { - self::$compressor = $compressorChannel; - } - - /** - * Getter for compressor channel - * - * @return $compressor The compressor channel - */ - public final function getCompressorChannel () { - return self::$compressor; - } - - /** - * Remove the $systemClasses array from memory - * - * @return void - */ - public final function removeSystemArray () { - unset($this->systemClasses); - } - - /** - * Create a file name and path name from the object's unique ID number. - * The left part of the ID shall always be a valid class name and the - * right part an ID number. - * - * @return $pfn The file name with a prepended path name - * @throws NoArrayCreatedException If explode() fails to create an array - * @throws InvalidArrayCountException If the array contains less or - * more than two elements - */ - public function getPathFileNameFromObject () { - // Get the main object's unique ID. We use this as a path/filename combination - $pathFile = $this->getUniqueID(); - - // Split it up in path and file name - $pathFile = explode("@", $pathFile); - - // Are there two elements? Index 0 is the path, 1 the file name + global extension - if (!is_array($pathFile)) { - // No array found - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); - } elseif (count($pathFile) != 2) { - // Invalid ID returned! - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - - // Auto-append missing trailing slash - $pathFile[0] = $this->addMissingTrailingSlash($pathFile[0]); - - // Create the file name and return it - $pfn = ($pathFile[0] . $pathFile[1]); - return $pfn; - } - - /** - * Appends a trailing slash to a string - * - * @param $str A string (maybe) without trailing slash - * @return $str A string with an auto-appended trailing slash - */ - public final function addMissingTrailingSlash ($str) { - // Is there a trailing slash? - if (substr($str, -1, 1) != "/") $str .= "/"; - return $str; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/class_FrameworkArrayObject.php b/ship-simu/inc/classes/main/class_FrameworkArrayObject.php deleted file mode 100644 index e73f8a8d8..000000000 --- a/ship-simu/inc/classes/main/class_FrameworkArrayObject.php +++ /dev/null @@ -1,47 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class FrameworkArrayObject extends ArrayObject { - /** - * Constructor for smooth coding style ;-) - * - * @param $class The class's real name - * @return void - */ - public function constructor ($class) { - // $class will be ignored for backward compatiblity - } - - /** - * Get real class' name back - * - * @return $realClass The class' real name - */ - public function __toString () { - return get_class($this); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/compressor/.htaccess b/ship-simu/inc/classes/main/compressor/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/main/compressor/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/compressor/class_Bzip2Compressor.php b/ship-simu/inc/classes/main/compressor/class_Bzip2Compressor.php deleted file mode 100644 index 56e704c3d..000000000 --- a/ship-simu/inc/classes/main/compressor/class_Bzip2Compressor.php +++ /dev/null @@ -1,122 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Set description - $this->setPartDescr("BZIP2-Kompressor"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Create a new compressor channel based a given compression handler - * - * @return $cInstance An instance of this class - */ - public final static function createBzip2Compressor () { - // Get new instance - if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) { - // Compressor can maybe be used - $cInstance = new Bzip2Compressor(); - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompression wird verwendet.
\n", - $cInstance->__toString() - )); - } else { - // Routines not found! - $cInstance = null; - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompressionsroutinen nicht gefunden.
\n", - $cInstance->__toString() - )); - } - - // Return the compressor instance - return $cInstance; - } - - /** - * BZIP2 compression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function compressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the compressed stream - return bzcompress($streamData, 1); - } - - /** - * BZIP2 decompression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function decompressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the decompressed stream - return bzdecompress($streamData); - } - - /** - * Getter for the file extension of this compressor - * - * @return $string Returns always "bz2" - */ - public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); - return "bz2"; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/compressor/class_GzipCompressor.php b/ship-simu/inc/classes/main/compressor/class_GzipCompressor.php deleted file mode 100644 index f00b2d032..000000000 --- a/ship-simu/inc/classes/main/compressor/class_GzipCompressor.php +++ /dev/null @@ -1,122 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class GzipCompressor extends BaseFrameworkSystem implements Compressor { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Set description - $this->setPartDescr("GZIP-Kompressor"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Create a new compressor channel based a given compression handler - * - * @return $cInstance An instance of this class - */ - public final static function createGzipCompressor () { - // Get new instance - if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) { - // Compressor can maybe be used - $cInstance = new GzipCompressor(); - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompression wird verwendet.
\n", - $cInstance->__toString() - )); - } else { - // Routines not found! - $cInstance = null; - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompressionsroutinen nicht gefunden.
\n", - $cInstance->__toString() - )); - } - - // Return the compressor instance - return $cInstance; - } - - /** - * GZIP compression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function compressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the compressed stream - return gzcompress($streamData, 1); - } - - /** - * GZIP decompression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function decompressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the decompressed stream - return gzuncompress($streamData); - } - - /** - * Getter for the file extension of this compressor - * - * @return $string Returns always "gz" - */ - public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); - return "gz"; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/compressor/class_NullCompressor.php b/ship-simu/inc/classes/main/compressor/class_NullCompressor.php deleted file mode 100644 index b4a123637..000000000 --- a/ship-simu/inc/classes/main/compressor/class_NullCompressor.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class NullCompressor extends BaseFrameworkSystem implements Compressor { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Set description - $this->setPartDescr("Null-Kompressor"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Create a new compressor channel based a given compression handler - * - * @return $cInstance An instance of this class - */ - public final static function createNullCompressor () { - // Get new instance - $cInstance = new NullCompressor(); - - // Return the compressor instance - return $cInstance; - } - - /** - * Null compression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function compressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the compressed stream - return $streamData; - } - - /** - * Null decompression stream - * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data - * @throws InvalidObjectException If the stream is an object - */ - public function decompressStream ($streamData) { - if (is_object($streamData)) { - // Throw an exception - throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT); - } - - // Return the decompressed stream - return $streamData; - } - - /** - * Getter for the file extension of this compressor - * - * @return $string Returns always "bz2" - */ - public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); - return "null"; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/console/.htaccess b/ship-simu/inc/classes/main/console/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/main/console/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/console/class_ConsoleTools.php b/ship-simu/inc/classes/main/console/class_ConsoleTools.php deleted file mode 100644 index 97f1bc233..000000000 --- a/ship-simu/inc/classes/main/console/class_ConsoleTools.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ConsoleTools extends BaseFrameworkSystem { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Console-Tools"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Aquires the IP address of this host by reading the /etc/hostname file and solving it - * - * @return $ip The resolved IP address - */ - public static function aquireSelfIPAddress () { - // Local IP by default - $ip = "127.0.0.1"; - - // Get a new instance - $helper = new ConsoleTools(); - - try { - // Get a file pointer - $io = FrameworkFileInputPointer::createFrameworkFileInputPointer("/etc/hostname"); - - // Read the file - $hostname = trim($io->readFromFile()); - $helper->getDebugInstance()->output(sprintf("[%s:] Our host name is: %s
\n", - $helper->__toString(), - $hostname - )); - - // Close the file - $io->closeFile(); - - // Resolve it - $ipResolved = gethostbyname($hostname); - if (($ipResolved !== false) && ($ipResolved != $hostname)) { - // Okay, this works! - $ip = $ipResolved; - - // Debug message - $helper->getDebugInstance()->output(sprintf("[%s:] Resolved IP address is: %s
\n", - $helper->__toString(), - $ip - )); - } - } catch (FrameworkException $e) { - // Do nothing here - } - - // Return the IP address - return $ip; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/database/.htaccess b/ship-simu/inc/classes/main/database/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/main/database/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/database/class_BaseDatabaseFrontend.php b/ship-simu/inc/classes/main/database/class_BaseDatabaseFrontend.php deleted file mode 100644 index 7d6f8a0dc..000000000 --- a/ship-simu/inc/classes/main/database/class_BaseDatabaseFrontend.php +++ /dev/null @@ -1,105 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject { - /** - * The limiter instance - */ - private $limitInstance = null; - - /** - * Private constructor - * - * @return void - */ - private function __construct($class) { - // Call parent constructor - parent::constructor($class); - - // Debug message - if (((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); - - // Clean up a little - $this->removeNumberFormaters(); - } - - /** - * The public constructor - * - * @return void - */ - public function constructor ($class) { - // Calls just the private one - $this->__construct($class); - } - - /** - * Getter for limitation instance - * - * @return $limitInstance The instance to the object ObjectLimits - */ - public final function getLimitInstance () { - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s angefordert.
\n", - $this->__toString(), - $this->limitInstance->__toString() - )); - return $this->limitInstance; - } - - /** - * Setup limitation for the saving process - * - * @param $limitInstance An instance of ObjectLimits which contains - * elements we shall exclusivly include in - * saving process - * @return void - */ - public final function limitObject (ObjectLimits $limitInstance) { - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s soll verwendet werden.
\n", - $this->__toString(), - $limitInstance->__toString() - )); - - // Get limitArray for validation - $array = $limitInstance->getLimitArray(); - - // Sanity-check if some limitations are in the object - if ($array->count() > 0) { - // Okay, there is enougth - $this->limitInstance = $limitInstance; - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s wird verwendet und beinhaltet %s Einträge.
\n", - $this->__toString(), - $limitInstance->__toString(), - $array->count() - )); - } - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/database/classes/.htaccess b/ship-simu/inc/classes/main/database/classes/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/main/database/classes/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/database/classes/class_LocalFileDatabase.php b/ship-simu/inc/classes/main/database/classes/class_LocalFileDatabase.php deleted file mode 100644 index ff5f1dde0..000000000 --- a/ship-simu/inc/classes/main/database/classes/class_LocalFileDatabase.php +++ /dev/null @@ -1,515 +0,0 @@ - - * @version 0.1 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface { - /** - * Save path for "file database" - */ - private $savePath = ""; - - /** - * The file's extension - */ - private $fileExtension = "serialized"; - - /** - * The IO handler for file handling which should be FileIOHandler. - */ - private $ioInstance = null; - - /** - * The last read file's name - */ - private $lastFile = ""; - - /** - * The last read file's content including header information - */ - private $lastContents = array(); - - /** - * The private constructor. Do never instance from outside! - * You need to set a local file path. The class will then validate it. - * - * @return void - */ - private function __construct() { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Dateidatenbankschicht"); - - // Create unique ID - $this->createUniqueID(); - - // Clean up a little - $this->removeSystemArray(); - } - - /** - * Create an object of LocalFileDatabase and set the save path for local files. - * This method also validates the given file path. - * - * @param $savePath The local file path string - * @param $ioInstance The input/output handler. This - * should be FileIOHandler - * @return $dbInstance An instance of LocalFileDatabase - * @throws SavePathIsEmptyException If the given save path is an - * empty string - * @throws SavePathIsNoDirectoryException If the save path is no - * path (e.g. a file) - * @throws SavePathReadProtectedException If the save path is read- - * protected - * @throws SavePathWriteProtectedException If the save path is write- - * protected - */ - public final static function createLocalFileDatabase ($savePath, FileIOHandler $ioInstance) { - // Get an instance - $dbInstance = new LocalFileDatabase(); - - if (empty($savePath)) { - // Empty string - throw new SavePathIsEmptyException($dbInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!is_dir($savePath)) { - // Is not a dir - throw new SavePathIsNoDirectoryException($savePath, self::EXCEPTION_INVALID_PATH_NAME); - } elseif (!is_readable($savePath)) { - // Path not readable - throw new SavePathReadProtectedException($savePath, self::EXCEPTION_READ_PROTECED_PATH); - } elseif (!is_writeable($savePath)) { - // Path not writeable - throw new SavePathWriteProtectedException($savePath, self::EXCEPTION_WRITE_PROTECED_PATH); - } - - // Debug output - if (defined('DEBUG_DATABASE')) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Es werden lokale Dateien zum Speichern von Objekten verwendet.
\n", - $dbInstance->__toString() - )); - - // Set save path and IO instance - $dbInstance->setSavePath($savePath); - $dbInstance->setIOInstance($ioInstance); - - // Return database instance - return $dbInstance; - } - - /** - * Setter for save path - * - * @param $savePath The local save path where we shall put our serialized classes - * @return void - */ - public final function setSavePath ($savePath) { - // Secure string - $savePath = (string) $savePath; - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Lokaler Speicherpfad %s wird verwendet.
\n", - $this->__toString(), - $savePath - )); - - // Set save path - $this->savePath = $savePath; - } - - /** - * Getter for save path - * - * @return $savePath The local save path where we shall put our serialized classes - */ - public final function getSavePath () { - return $this->savePath; - } - - /** - * Getter for file extension - * - * @return $fileExtension The file extension for all file names - */ - public final function getFileExtension () { - return $this->fileExtension; - } - - /** - * Saves a given object to the local file system by serializing and - * transparently compressing it - * - * @param $object The object we shall save to the local file system - * @return void - * @throws NullPointerException If the object instance is null - * @throws NoObjectException If the parameter $object is not - * an object - */ - public final function saveObject ($object) { - // Some tests on the parameter... - if (is_null($object)) { - // Is null, throw exception - throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($object)) { - // Is not an object, throw exception - throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($object, '__toString')) { - // A highly required method was not found... :-( - throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD); - } - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s soll in eine lokale Datei gespeichert werden.
\n", - $this->__toString(), - $object->__toString() - )); - - // Get a string containing the serialized object. We cannot exchange - // $this and $object here because $object does not need to worry - // about it's limitations... ;-) - $serialized = $this->serializeObject($object); - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s ist nach der Serialisierung %s Byte gross.
\n", - $this->__toString(), - $object->__toString(), - strlen($serialized) - )); - - // Get a path name plus file name and append the extension - $fqfn = $this->getSavePath() . $object->getPathFileNameFromObject() . "." . $this->getFileExtension(); - - // Save the file to disc we don't care here if the path is there, - // this must be done in later methods. - $this->getIOInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized)); - } - - /** - * Get a serialized string from the given object - * - * @param $object The object we want to serialize and transparently - * compress - * @return $serialized A string containing the serialzed/compressed object - * @see ObjectLimits An object holding limition information - * @see SerializationContainer A special container class for e.g. - * attributes from limited objects - */ - private function serializeObject ($object) { - // If there is no limiter instance we serialize the whole object - // otherwise only in the limiter object (ObjectLimits) specified - // attributes summarized in a special container class - if ($this->getLimitInstance() === null) { - // Serialize the whole object. This tribble call is the reason - // why we need a fall-back implementation in CompressorChannel - // of the methods compressStream() and decompressStream(). - $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($object)); - } else { - // Serialize only given attributes in a special container - $container = SerializationContainer::createSerializationContainer($this->getLimitInstance(), $object); - - // Serialize the container - $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($container)); - } - - // Return the serialized object string - return $serialized; - } - - /** - * Analyses if a unique ID has already been used or not by search in the - * local database folder. - * - * @param $uniqueID A unique ID number which shall be checked - * before it will be used - * @param $inConstructor If we got called in a de/con-structor or - * from somewhere else - * @return $isUnused true = The unique ID was not found in the database, - * false = It is already in use by an other object - * @throws NoArrayCreatedException If explode() fails to create an array - * @throws InvalidArrayCountException If the array contains less or - * more than two elements - */ - public function isUniqueIdUsed ($uniqueID, $inConstructor = false) { - // Currently not used... ;-) - $isUsed = false; - - // Split the unique ID up in path and file name - $pathFile = explode("@", $uniqueID); - - // Are there two elements? Index 0 is the path, 1 the file name + global extension - if (!is_array($pathFile)) { - // No array found - if ($inConstructor) { - return false; - } else { - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); - } - } elseif (count($pathFile) != 2) { - // Invalid ID returned! - if ($inConstructor) { - return false; - } else { - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - } - - // Create full path name - $pathName = $this->getSavePath() . $pathFile[0]; - - // Check if the file is there with a file handler - if ($inConstructor) { - // No exceptions in constructors and destructors! - $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName, true); - - // Has an object being created? - if (!is_object($dirInstance)) return false; - } else { - // Outside a constructor - try { - $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName); - } catch (PathIsNoDirectoryException $e) { - // Okay, path not found - return false; - } - } - - // Initialize the search loop - $isValid = false; - while ($dataFile = $dirInstance->readDirectoryExcept(array(".", ".."))) { - // Generate FQFN for testing - $fqfn = sprintf("%s/%s", $pathName, $dataFile); - $this->setLastFile($fqfn); - - // Get instance for file handler - $inputHandler = $this->getIOInstance(); - - // Try to read from it. This makes it sure that the file is - // readable and a valid database file - $this->setLastFileContents($inputHandler->loadFileContents($fqfn)); - - // Extract filename (= unique ID) from it - $ID = substr(basename($fqfn), 0, -(strlen($this->getFileExtension()) + 1)); - - // Is this the required unique ID? - if ($ID == $pathFile[1]) { - // Okay, already in use! - $isUsed = true; - } - } - - // Close the directory handler - $dirInstance->closeDirectory(); - - // Now the same for the file... - return $isUsed; - } - - /** - * Getter for the file IO instance - * - *�@return $ioInstance An instance for IO operations - * @see FileIOHandler The concrete handler for IO operations - */ - public final function getIOInstance () { - return $this->ioInstance; - } - - /** - * Setter for the file IO instance - * - * @param $ioInstance An instance for IO operations (should be - * FileIOHandler) - * @return void - */ - public final function setIOInstance (FileIOHandler $ioInstance) { - $this->ioInstance = $ioInstance; - } - - /** - * Setter for the last read file - * - * @param $fqfn The FQFN of the last read file - * @return void - */ - private function setLastFile ($fqfn) { - // Cast string - $fqfn = (string) $fqfn; - $this->lastFile = $fqfn; - } - - /** - * Getter for last read file - * - * @return $lastFile The last read file's name with full path - */ - public final function getLastFile () { - return $this->lastFile; - } - - /** - * Setter for contents of the last read file - * - * @param $contents An array with header and data elements - * @return void - */ - private function setLastFileContents ($contents) { - // Cast array - $contents = (array) $contents; - $this->lastContents = $contents; - } - - /** - * Getter for last read file's content as an array - * - * @return $lastContent The array with elements 'header' and 'data'. - */ - public final function getLastContents () { - return $this->lastContents; - } - - /** - * Get cached (last fetched) data from the local file database - * - * @param $uniqueID The ID number for looking up the data - * @return $object The restored object from the maybe compressed - * serialized data - * @throws MismatchingCompressorsException If the compressor from - * the loaded file - * mismatches with the - * current used one. - * @throws NullPointerException If the restored object - * is null - * @throws NoObjectException If the restored "object" - * is not an object instance - * @throws MissingMethodException If the required method - * toString() is missing - */ - public function getObjectFromCachedData ($uniqueID) { - // Get instance for file handler - $inputHandler = $this->getIOInstance(); - - // Get last file's name and contents - $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID); - $contents = $this->repairContents($this->getLastContents(), $fqfn); - - // Let's decompress it. First we need the instance - $compressInstance = $this->getCompressorChannel(); - - // Is the compressor's extension the same as the one from the data? - if ($compressInstance->getCompressorExtension() != $contents['header'][0]) { - /** - * @todo For now we abort here but later we need to make this a little more dynamic. - */ - throw new MismatchingCompressorsException(array($this, $contents['header'][0], $fqfn, $compressInstance->getCompressorExtension()), self::EXCEPTION_MISMATCHING_COMPRESSORS); - } - - // Decompress the data now - $serialized = $compressInstance->getCompressor()->decompressStream($contents['data']); - - // And unserialize it... - $object = unserialize($serialized); - - // This must become a valid object, so let's check it... - if (is_null($object)) { - // Is null, throw exception - throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER); - } elseif (!is_object($object)) { - // Is not an object, throw exception - throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($object, '__toString')) { - // A highly required method was not found... :-( - throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD); - } - - // And return the object - return $object; - } - - /** - * Private method for re-gathering (repairing) the FQFN - * - * @param $fqfn The current FQFN we shall validate - * @param $uniqueID The unique ID number - * @return $fqfn The repaired FQFN when it is empty - * @throws NoArrayCreatedException If explode() has not - * created an array - * @throws InvalidArrayCountException If the array count is not - * as the expected - */ - private function repairFQFN ($fqfn, $uniqueID) { - // Cast both strings - $fqfn = (string) $fqfn; - $uniqueID = (string) $uniqueID; - - // Is there pre-cached data available? - if (empty($fqfn)) { - // Split the unique ID up in path and file name - $pathFile = explode("@", $uniqueID); - - // Are there two elements? Index 0 is the path, 1 the file name + global extension - if (!is_array($pathFile)) { - // No array found - throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED); - } elseif (count($pathFile) != 2) { - // Invalid ID returned! - throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT); - } - - // Create full path name - $pathName = $this->getSavePath() . $pathFile[0]; - - // Nothing cached, so let's create a FQFN first - $fqfn = sprintf("%s/%s.%s", $pathName, $pathFile[1], $this->getFileExtension()); - $this->setLastFile($fqfn); - } - - // Return repaired FQFN - return $fqfn; - } - - /** - * Private method for re-gathering the contents of a given file - * - * @param $contents The (maybe) already cached contents as an array - * @param $fqfn The current FQFN we shall validate - * @return $contents The repaired contents from the given file - */ - private function repairContents ($contents, $fqfn) { - // Is there some content and header (2 indexes) in? - if ((!is_array($contents)) || (count($contents) != 2) || (!isset($contents['header'])) || (!isset($contents['data']))) { - // No content found so load the file again - $contents = $inputHandler->loadFileContents($fqfn); - - // And remember all data for later usage - $this->setLastContents($contents); - } - - // Return the repaired contents - return $contents; - } - - /* DUMMY */ public final function loadObject () {} -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/debug/.htaccess b/ship-simu/inc/classes/main/debug/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/main/debug/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/debug/class_DebugConsoleOutput.php b/ship-simu/inc/classes/main/debug/class_DebugConsoleOutput.php deleted file mode 100644 index d92648eaf..000000000 --- a/ship-simu/inc/classes/main/debug/class_DebugConsoleOutput.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class DebugConsoleOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Debug-Ausgabe auf Konsole"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Creates an instance of this class - * - * @return $debugInstance The prepared debug instance - */ - public final static function createDebugConsoleOutput () { - // Get a new instance - $debugInstance = new DebugConsoleOutput(); - - // Return it - return $debugInstance; - } - - /** - * Outputs the given data without HTML tags - * - * @param $output The HTML'ed output - * @return void - */ - public final function outputStream ($output) { - print html_entity_decode(strip_tags($output)); - } - - /** - * Outputs the given data without HTML tags - * - * @param $output The HTML'ed output - * @return void - */ - public final function output ($outStream=false) { - // false will be silently ignored - if ($outStream !== false) { - $this->outputStream($outStream); - } - } - - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - public final function assignVariable ($var, $value) { - trigger_error(__METHOD__.": Stub!"); - } -} - -// -?> diff --git a/ship-simu/inc/classes/main/debug/class_DebugErrorLogOutput.php b/ship-simu/inc/classes/main/debug/class_DebugErrorLogOutput.php deleted file mode 100644 index 8916b057e..000000000 --- a/ship-simu/inc/classes/main/debug/class_DebugErrorLogOutput.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Debug-Ausgabe in error_log()"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Creates an instance of this class - * - * @return $debugInstance The prepared debug instance - */ - public final static function createDebugErrorLogOutput () { - // Get a new instance - $debugInstance = new DebugErrorLogOutput(); - - // Return it - return $debugInstance; - } - - /** - * Outputs the given data without HTML tags - * - * @param $output The HTML'ed output - * @return void - */ - public final function outputStream ($output) { - // Split multiple lines into and array to put them out line-by-line - $errorLines = explode("\n", $output); - foreach ($errorLines as $err) { - $err = trim($err); - // Log only none-empty lines - if (!empty($err)) { - // Log this line - error_log(html_entity_decode(strip_tags($err)), 0); - } - } - } - - /** - * Assigns a variable for output - * - * @param $var The variable we shall assign - * @param $value The value to store in the variable - * @return void - */ - public final function assignVariable ($var, $value) { - trigger_error(__METHOD__.": Stub!"); - } - - /** - * Output the code - * - * @return void - */ - public final function output ($outStream=false) { - // false will be silently ignored - if ($outStream !== false) { - $this->outputStream($outStream); - } - } -} - -// -?> diff --git a/ship-simu/inc/classes/main/debug/class_DebugWebOutput.php b/ship-simu/inc/classes/main/debug/class_DebugWebOutput.php deleted file mode 100644 index 062b2ccab..000000000 --- a/ship-simu/inc/classes/main/debug/class_DebugWebOutput.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class DebugWebOutput extends BaseFrameworkSystem implements Debugger { - /** - * Private constructor - * - * @return void - */ - private function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set description - $this->setPartDescr("Debug-Ausgabe auf Konsole"); - - // Create an unique ID - $this->createUniqueID(); - } - - /** - * Creates an instance of this class - * - * @return $debugInstance The prepared debug instance - */ - public final static function createDebugWebOutput () { - // Get a new instance - $debugInstance = new DebugWebOutput(); - - // Return it - return $debugInstance; - } - - /** - * Outputs the given data directly - * - * @param $output The HTML output - * @return void - */ - public final function outputStream ($output) { - trigger_error($output); - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/extended/.htaccess b/ship-simu/inc/classes/main/extended/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/ship-simu/inc/classes/main/extended/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/ship-simu/inc/classes/main/extended/class_ObjectLimits.php b/ship-simu/inc/classes/main/extended/class_ObjectLimits.php deleted file mode 100644 index 8cfb0ec6c..000000000 --- a/ship-simu/inc/classes/main/extended/class_ObjectLimits.php +++ /dev/null @@ -1,130 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ObjectLimits extends BaseFrameworkSystem { - /** - * Limitation array for storing all attribute names we will use later - * only. - */ - private $limitArray = null; - - /** - * Private constructor - * - * @return void - */ - private final function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Set part description - $this->setPartDescr("Limitierungsobjekt"); - - // Create unique ID number - $this->createUniqueID(); - - // Clean up a little - $this->removeNumberFormaters(); - } - - /** - * Create a new ObjectLimits object and (maybe prepare it a little) - * - * @param $limitationArray The limitation array we "walk" through - * @return $limitInstance The instance to an ObjectLimits object - */ - public final static function createObjectLimits (array $limitationArray) { - // Is there a limitation array given? - if (count($limitationArray) > 0) { - // Get instance - $limitInstance = new ObjectLimits(); - - // Get all limitations and do them - foreach ($limitationArray as $limit) { - // What shall we limitate? - if ($limit instanceof FrameworkInterface) { - // Add an object - $limitInstance->addObject($limit); - } elseif (is_string($limit)) { - // Add a string - $limitInstance->addString($limit); - } else { - // Others are not supported (yet) - throw new UnsupportedLimitationPartException($limit, self::EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED); - } - } - - // Return instance - return $limitInstance; - } else { - // No limitation given so we send "null" back - return null; - } - } - - /** - * Add an object's name to the limitation list - * - * @param $object The object's name we shall add to the list - * @return void - */ - private final function addObject (FrameworkInterface $object) { - // Auto-initialization - if (is_null($this->limitArray)) { - // Initialize this array - $this->limitArray = new FrameworkArrayObject(); - } - - // Add the object's name to it - $this->limitArray->append($object->__toString()); - } - - /** - * Add a string directly to the limitation list - * - * @param $str The string we want to add directly - * @return void - */ - private final function addString ($str) { - // Auto-initialization - if (is_null($this->limitArray)) { - // Initialize this array - $this->limitArray = new FrameworkArrayObject(); - } - - // Add the direct string to ArrayObject - $this->limitArray->append($str); - } - - /** - * Getter for limitArray - * - * @return $limitArray The object ArrayObject which holds limitations - */ - public final function getLimitArray () { - return $this->limitArray; - } -} - -// [EOF] -?> diff --git a/ship-simu/inc/classes/main/extended/class_SerializationContainer.php b/ship-simu/inc/classes/main/extended/class_SerializationContainer.php deleted file mode 100644 index b8790ea64..000000000 --- a/ship-simu/inc/classes/main/extended/class_SerializationContainer.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @version 0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software - * @license GNU GPL 3.0 or any newer version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class SerializationContainer extends FrameworkArrayObject { - /** - * Public constructor, if you like to have an object of this class... - * - * @return void - */ - public function __construct () { - // Call parent constructor - parent::constructor(__CLASS__); - - // Debug message - if ((defined('DEBUG_CONTAINER')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[SerializationContainer:] Konstruktor erreicht.
\n"); - } - - /** - * Create a SerializationContainer object by applying the limitations - * in $limitInstance on $object. The resulting data container will only - * hold the attributed and their values which we have specified in - * the limitation object. - * - * @param $limitInstance The instance to the object ObjectLimits - * @param $object The origin object. We don't touch it here. - * @return $containerInstance An instance of SerializationContainer - * @throws GetterNotFoundException If a getter was not found - */ - public final static function createSerializationContainer (ObjectLimits $limitInstance, $object) { - // Get an instance - $containerInstance = new SerializationContainer(); - - // Iterate through the whole limitation array - for ($idx = $limitInstance->getLimitArray()->getIterator(); $idx->valid(); $idx->next()) { - // Get current item from list - $curr = ucfirst($idx->current()); - - // Is the required method available? - if (method_exists($object, sprintf("get%s", $curr))) { - // Generate a command for getting it - $eval = sprintf("\$value = \$object->get%s();", - $curr - ); - - // Debug eval command - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $limitInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

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

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

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

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