* text=auto !eol
+/Doxyfile -text
+application/mxchange/.htaccess -text
+application/mxchange/class_ApplicationHelper.php -text
+application/mxchange/config.php -text
+application/mxchange/debug.php -text
+application/mxchange/exceptions.php -text
+application/mxchange/exceptions/.htaccess -text
+application/mxchange/init.php -text
+application/mxchange/interfaces/.htaccess -text
+application/mxchange/loader.php -text
+application/mxchange/main/.htaccess -text
+application/mxchange/starter.php -text
+application/mxchange/templates/.htaccess -text
+db/.htaccess -text
+devel/.htaccess -text
+devel/class_Debug.php -text
+docs/THANKS -text
+inc/.htaccess -text
+inc/classes.php -text
+inc/classes/.htaccess -text
+inc/classes/exceptions/.htaccess -text
+inc/classes/exceptions/class_FrameworkException.php -text
+inc/classes/exceptions/compressor/.htaccess -text
+inc/classes/exceptions/compressor/class_MismatchingCompressorsException.php -text
+inc/classes/exceptions/container/.htaccess -text
+inc/classes/exceptions/container/class_ContainerItemIsNoArrayException.php -text
+inc/classes/exceptions/container/class_ContainerItemIsNullException.php -text
+inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php -text
+inc/classes/exceptions/database/.htaccess -text
+inc/classes/exceptions/database/local_file/.htaccess -text
+inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php -text
+inc/classes/exceptions/database/local_file/class_SavePathIsNoDirectoryException.php -text
+inc/classes/exceptions/database/local_file/class_SavePathReadProtectedException.php -text
+inc/classes/exceptions/database/local_file/class_SavePathWriteProtectedException.php -text
+inc/classes/exceptions/io/.htaccess -text
+inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text
+inc/classes/exceptions/io/class_FilePointerNotOpenedException.php -text
+inc/classes/exceptions/io/class_InvalidDataLengthException.php -text
+inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php -text
+inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php -text
+inc/classes/exceptions/io/class_PathIsEmptyException.php -text
+inc/classes/exceptions/io/class_PathIsNoDirectoryException.php -text
+inc/classes/exceptions/io/class_PathReadProtectedException.php -text
+inc/classes/exceptions/language/.htaccess -text
+inc/classes/exceptions/language/class_InvalidLanguagePathStringException.php -text
+inc/classes/exceptions/language/class_LanguagePathIsEmptyException.php -text
+inc/classes/exceptions/language/class_LanguagePathIsNoDirectoryException.php -text
+inc/classes/exceptions/language/class_LanguagePathReadProtectedException.php -text
+inc/classes/exceptions/main/.htaccess -text
+inc/classes/exceptions/main/class_ClassMismatchException.php -text
+inc/classes/exceptions/main/class_ClassNotFoundException.php -text
+inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php -text
+inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php -text
+inc/classes/exceptions/main/class_DimNotFoundInArrayException.php -text
+inc/classes/exceptions/main/class_ExceptionNotChangedException.php -text
+inc/classes/exceptions/main/class_ExceptionNotFoundException.php -text
+inc/classes/exceptions/main/class_GetterNotFoundException.php -text
+inc/classes/exceptions/main/class_InvalidArrayCountException.php -text
+inc/classes/exceptions/main/class_InvalidObjectException.php -text
+inc/classes/exceptions/main/class_MissingArrayElementsException.php -text
+inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php -text
+inc/classes/exceptions/main/class_MissingMethodException.php -text
+inc/classes/exceptions/main/class_NoArrayCreatedException.php -text
+inc/classes/exceptions/main/class_NoArrayException.php -text
+inc/classes/exceptions/main/class_NoObjectException.php -text
+inc/classes/exceptions/main/class_NullPointerException.php -text
+inc/classes/exceptions/main/class_VariableIsNotSetException.php -text
+inc/classes/exceptions/template/.htaccess -text
+inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text
+inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -text
+inc/classes/exceptions/template/class_BasePathReadProtectedException.php -text
+inc/classes/exceptions/template/class_InvalidBasePathStringException.php -text
+inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php -text
+inc/classes/exceptions/template/class_UnexpectedTemplateTypeException.php -text
+inc/classes/interfaces/.htaccess -text
+inc/classes/interfaces/application/.htaccess -text
+inc/classes/interfaces/application/class_ManageableApplication.php -text
+inc/classes/interfaces/class_FrameworkInterface.php -text
+inc/classes/interfaces/compressor/class_Compressor.php -text
+inc/classes/interfaces/database/.htaccess -text
+inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php -text
+inc/classes/interfaces/database/frontend/.htaccess -text
+inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php -text
+inc/classes/interfaces/database/middleware/.htaccess -text
+inc/classes/interfaces/database/middleware/class_DatabaseConnector.php -text
+inc/classes/interfaces/debug/.htaccess -text
+inc/classes/interfaces/debug/class_Debugger.php -text
+inc/classes/interfaces/extended/.htaccess -text
+inc/classes/interfaces/extended/class_LimitableObject.php -text
+inc/classes/interfaces/io/.htaccess -text
+inc/classes/interfaces/io/class_Streamable.php -text
+inc/classes/interfaces/io/file/.htaccess -text
+inc/classes/interfaces/io/file/class_FileInputStreamer.php -text
+inc/classes/interfaces/io/file/class_FileOutputStreamer.php -text
+inc/classes/interfaces/io/output/.htaccess -text
+inc/classes/interfaces/io/output/class_OutputStreamer.php -text
+inc/classes/interfaces/language/.htaccess -text
+inc/classes/interfaces/language/class_ManageableLanguage.php -text
+inc/classes/interfaces/template/.htaccess -text
+inc/classes/interfaces/template/class_CompileableTemplate.php -text
+inc/classes/main/.htaccess -text
+inc/classes/main/class_BaseFrameworkSystem.php -text
+inc/classes/main/class_FrameworkArrayObject.php -text
+inc/classes/main/compressor/.htaccess -text
+inc/classes/main/compressor/class_Bzip2Compressor.php -text
+inc/classes/main/compressor/class_GzipCompressor.php -text
+inc/classes/main/compressor/class_NullCompressor.php -text
+inc/classes/main/console/.htaccess -text
+inc/classes/main/console/class_ConsoleTools.php -text
+inc/classes/main/database/.htaccess -text
+inc/classes/main/database/class_BaseDatabaseFrontend.php -text
+inc/classes/main/database/classes/.htaccess -text
+inc/classes/main/database/classes/class_LocalFileDatabase.php -text
+inc/classes/main/debug/.htaccess -text
+inc/classes/main/debug/class_DebugConsoleOutput.php -text
+inc/classes/main/debug/class_DebugErrorLogOutput.php -text
+inc/classes/main/debug/class_DebugWebOutput.php -text
+inc/classes/main/extended/.htaccess -text
+inc/classes/main/extended/class_ObjectLimits.php -text
+inc/classes/main/extended/class_SerializationContainer.php -text
+inc/classes/main/io/.htaccess -text
+inc/classes/main/io/class_FileIOStream.php -text
+inc/classes/main/io/class_FrameworkDirectoryPointer.php -text
+inc/classes/main/io/class_FrameworkFileInputPointer.php -text
+inc/classes/main/io/class_FrameworkFileOutputPointer.php -text
+inc/classes/main/language/.htaccess -text
+inc/classes/main/language/class_LanguageSystem.php -text
+inc/classes/main/output/.htaccess -text
+inc/classes/main/output/class_ConsoleOutput.php -text
+inc/classes/main/output/class_WebOutput.php -text
+inc/classes/main/template/.htaccess -text
+inc/classes/main/template/class_TemplateEngine.php -text
+inc/classes/middleware/.htaccess -text
+inc/classes/middleware/class_BaseMiddleware.php -text
+inc/classes/middleware/compressor/.htaccess -text
+inc/classes/middleware/compressor/class_CompressorChannel.php -text
+inc/classes/middleware/database/.htaccess -text
+inc/classes/middleware/database/class_DatabaseConnection.php -text
+inc/classes/middleware/debug/.htaccess -text
+inc/classes/middleware/debug/class_DebugMiddleware.php -text
+inc/classes/middleware/io/.htaccess -text
+inc/classes/middleware/io/class_FileIOHandler.php -text
+inc/config.php -text
+inc/config/.htaccess -text
+inc/config/class_FrameworkConfiguration.php -text
+inc/database.php -text
+inc/database/.htaccess -text
+inc/database/lib-local.php -text
+inc/file_io.php -text
+inc/includes.php -text
+inc/language.php -text
+inc/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
--- /dev/null
+# Doxyfile 1.5.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file that
+# follow. The default is UTF-8 which is also the encoding used for all text before
+# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into
+# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of
+# possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = MXChange Mail-Exchange
+
+# 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.3.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/htdocs/new_autoinstaller/mxchange/0.3.0/docs/
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
+# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
+# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
+# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF = "The $name class " \
+ "The $name widget " \
+ "The $name file " \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH = /var/www/htdocs/
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = YES
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for Java.
+# For instance, namespaces will be presented as packages, qualified scopes
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
+# include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = YES
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is
+# documented as struct with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code where the coding convention is that all structs are
+# typedef'ed and only the typedef is referenced never the struct's name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = YES
+
+# If this flag is set to YES, the members of anonymous namespaces will be extracted
+# and appear in the documentation as a namespace called 'anonymous_namespace{file}',
+# where file will be replaced with the base name of the file that contains the anonymous
+# namespace. By default anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = YES
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = YES
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from the
+# version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text "
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE = /var/www/htdocs/new_autoinstaller/mxchange/0.3.0/docs/warn.log
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = /var/www/htdocs/new_autoinstaller/mxchange/0.3.0/
+
+# This tag can be used to specify the character encoding of the source files that
+# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
+# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding.
+# See http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.php
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS = */docs/* \
+ */ship-simu.org/*
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the output.
+# The symbol name can be a fully qualified name, a word, or if the wildcard * is used,
+# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH
+# then you must also enable this option. If you don't then doxygen will produce
+# a warning and turn it on anyway
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = YES
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 3
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = YES
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
+# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
+# specify the directory where the mscgen tool resides. If left empty the tool is assumed to
+# be found in the default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = NO
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = YES
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
+# generate a call dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+
+CALL_GRAPH = YES
+
+# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
+# generate a caller dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+
+CALLER_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the number
+# of direct children of the root node in a graph is already larger than
+# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, which results in a white background.
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = YES
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class holding general data about the application and some methods for
+ * the management including the entry point.
+ *
+ * E.g.:
+ *
+ * index.php?app=my_app
+ *
+ * You need to create a folder in the folder "application" named "my_app"
+ * (without the quotes) and create a include file called
+ * class_ApplicationHelper.php. You have to write the same class for your
+ * application and implement the same interface called ManageableApplication
+ * because this class include file will be searched for.
+ *
+ * It is good when you avoid more GET parameters to keep URLs short and sweet.
+ * But sometimes you need some GET paramerers e.g. for your imprint or info page
+ * or other linked pages which you have to create and state some informations.
+ *
+ * Please remember that this include file is being loaded *before* the class
+ * loader is loading classes from "exceptions", "interfaces" and "main"!
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplication {
+ /**
+ * The version number of this application
+ */
+ private $appVersion = "";
+
+ /**
+ * The human-readable name for this application
+ */
+ private $appName = "";
+
+ /**
+ * The short uni*-like name of this application
+ */
+ private $shortName = "";
+
+ /**
+ * An instance of this class
+ */
+ private static $thisInstance = null;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Application-Helper");
+
+ // Create an unique ID
+ $this->createUniqueID();
+
+ // Tidy up a little
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Getter for an instance of this class
+ *
+ * @return $thisInstance An instance of this class
+ */
+ public final static function getInstance () {
+ // Is the instance there?
+ if (is_null(self::$thisInstance)) {
+ self::$thisInstance = new ApplicationHelper();
+ }
+
+ // Return the instance
+ return self::$thisInstance;
+ }
+
+ /**
+ * Getter for the version number
+ *
+ * @return $appVersion The application's version number
+ */
+ public final function getAppVersion () {
+ return $this->appVersion;
+ }
+
+ /**
+ * Setter for the version number
+ *
+ * @param $appVersion The application's version number
+ * @return void
+ */
+ public final function setAppVersion ($appVersion) {
+ // Cast and set it
+ $appVersion = (string) $appVersion;
+ $this->appVersion = $appVersion;
+ }
+
+ /**
+ * Getter for human-readable name
+ *
+ * @return $appName The application's human-readable name
+ */
+ public final function getAppName () {
+ return $this->appName;
+ }
+
+ /**
+ * Setter for human-readable name
+ *
+ * @param $appName The application's human-readable name
+ * @return void
+ */
+ public final function setAppName ($appName) {
+ // Cast and set it
+ $appName = (string) $appName;
+ $this->appName = $appName;
+ }
+
+ /**
+ * Getter for short uni*-like name
+ *
+ * @return $shortName The application's short uni*-like name
+ */
+ public final function getAppShortName () {
+ return $this->shortName;
+ }
+
+ /**
+ * Setter for short uni*-like name
+ *
+ * @param $shortName The application's short uni*-like name
+ * @return void
+ */
+ public final function setAppShortName ($shortName) {
+ // Cast and set it
+ $shortName = (string) $shortName;
+ $this->shortName = $shortName;
+ }
+
+ /**
+ * Launcher for the mxchange mailexchange script
+ *
+ * @return void
+ */
+ public final function entryPoint () {
+ // Not yet implemented
+ trigger_error(__METHOD__.": Not yet implemented!");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Overwrite some configuration entries here
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Initialize some debug constants here
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Set the new handler
+//set_exception_handler('selector_exception_handler');
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Application initializer
+//
+// Please remember that this include file is being loaded *before* the class
+// loader is loading classes from "exceptions", "interfaces" and "main"!
+//
+// Get an instance of the initializer
+$eval = sprintf("\$app = %s::getInstance();",
+ FrameworkConfiguration::getInstance()->readConfig("app_helper_class")
+);
+eval($eval);
+
+// Set application name and version
+$app->setAppName("MXChange Mailtausch-Skript");
+$app->setAppVersion("0.3.0");
+$app->setAppShortName(FrameworkConfiguration::getInstance()->readConfig("selector_name"));
+
+// Initialize output system
+require(PATH . "inc/output.php");
+
+// Initialize file i/o system
+require(PATH . "inc/file_io.php");
+
+// Include the language sub-system
+require(PATH . "inc/language.php");
+
+// Get the database layer as well
+require(PATH . "inc/database.php");
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// The application's class loader
+if (!isset($application)) {
+ // We need this!
+ ApplicationEntryPoint::app_die("[Main:] Interne Variable <strong>application</strong> nicht gefunden!");
+}
+
+// Load all classes
+ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application));
+
+// Include all classes
+ClassLoader::getInstance()->includeAllClasses();
+
+// Clean up the global namespace
+unset($lowerClasses);
+unset($class);
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Is there an application helper instance? We need the method main() for
+// maining the application
+$app = ApplicationHelper::getInstance();
+
+// Some sanity checks
+if ((empty($app)) || (is_null($app))) {
+ // Something went wrong!
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden, da die Hilfsklasse <strong>%s</strong> nicht geladen ist!",
+ $application,
+ FrameworkConfiguration::getInstance()->readConfig("app_helper_class")
+ ));
+} elseif (!is_object($app)) {
+ // No object!
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden, da die 'app' kein Objekt ist!",
+ $application
+ ));
+} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) {
+ // Method not found!
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden, da die Methode <strong>%s</strong> fehlt!",
+ $application,
+ FrameworkConfiguration::getInstance()->readConfig("entry_method")
+ ));
+}
+
+// Call the entry point method
+try {
+ $eval = sprintf("%s::getInstance()->%s();",
+ FrameworkConfiguration::getInstance()->readConfig("app_helper_class"),
+ FrameworkConfiguration::getInstance()->readConfig("entry_method")
+ );
+ eval($eval);
+} catch (FrameworkException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden. Grund: <u>%s</u>",
+ $application,
+ $e->getMessage()
+ ));
+}
+
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Dummy debug class
+ */
+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);
+ // Reederei-Objekt debuggen
+ //define('DEBUG_COMPANY_OBJ', true);
+ // Hafen-Objekt debuggen
+ //define('DEBUG_HARBOR_OBJ', true);
+ // Schiff-Objekt debuggen
+ //define('DEBUG_SHIP_OBJ', true);
+ // Auftrag-Objekt debuggen
+ //define('DEBUG_CONTRACT_OBJ', true);
+ // Haendler-Objekt debuggen
+ //define('DEBUG_MERCHANT_OBJ', true);
+ // Personal-Objekt debuggen
+ //define('DEBUG_PERSONELL_OBJ', true);
+ //////// Alles unteren debuggen ////////
+ //define('DEBUG_ALL', true);
+ // Personal debuggen
+ //define('DEBUG_PERSONELL', true);
+ // Reederei debuggen
+ //define('DEBUG_COMPANY', true);
+ // Mitarbeiter debuggen
+ //define('DEBUG_COMPANY_EMPLOYEE', true);
+ // Hafen debuggen
+ //define('DEBUG_HARBOR', true);
+ // Werft debuggen
+ //define('DEBUG_SHIPYARD', true);
+ // Schiff debuggen
+ //define('DEBUG_SHIP', true);
+ // Schiffsteil debuggen
+ //define('DEBUG_SHIPPART', true);
+ // Schiffstruktur debuggen
+ //define('DEBUG_STRUCTURE', true);
+ // Antriebe debuggen
+ //define('DEBUG_DRIVE', true);
+ // Kabinen debuggen
+ //define('DEBUG_CABIN', true);
+ // Decks debuggen
+ //define('DEBUG_DECK', true);
+ // Bauauftraege debuggen
+ //define('DEBUG_CONTRACT', true);
+ // Haendler debuggen
+ //define('DEBUG_MERCHANT', true);
+ // Kompressor debuggen
+ //define('DEBUG_COMPRESSOR', true);
+ // Datenbankschichten debuggen
+ //define('DEBUG_DATABASE', true);
+ // Template-System debuggen
+ //define('DEBUG_TEMPLATE', true);
+ }
+}
+
+/**
+ * Initialize the dummy debug class
+ */
+$dummy = new Debug();
+unset($dummy);
+
+//
+?>
--- /dev/null
+Special Thanks goes to:
+ - Daff
+ - toms
+ - And all the others I have not listed here.
+
+If you think your name is missing here please ICQ me: 8809296
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/////// Load framework classes first ////////
+
+/**
+ * Lower framework classes
+ */
+$lowerClasses = array(
+ 0 => "exceptions", // Exceptions
+ 1 => "interfaces", // Interfaces
+ 2 => "main", // General main classes
+ 3 => "middleware" // The middleware
+);
+
+// Load all classes
+foreach ($lowerClasses as $class) {
+ // Try to load the framework classes
+ try {
+ ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $class));
+ } catch (PathIsNoDirectoryException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+ $class
+ ));
+ } catch (PathIsEmptyException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+ $class
+ ));
+ } catch (PathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+ $class
+ ));
+ } catch (DirPointerNotOpenedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+ $class
+ ));
+ }
+}
+
+// Include all classes
+ClassLoader::getInstance()->includeAllClasses();
+
+// Clean up the global namespace
+unset($lowerClasses[3]); // Applications shall not have any middleware
+unset($class);
+
+////// Until here the framework classes are loaded //////
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general abstract exception. You should not throw this even when you
+ * remove the "abstract" key-word. Better you make your own exception and
+ * attach a dedicated message to it.
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 1.0
+ */
+abstract class FrameworkException extends ReflectionException {
+ /**
+ * Array for the backtrace
+ */
+ private $backTrace = array();
+
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $message The non-optional message for the exception
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct($message, $code = 0) {
+ // Extract backtrace
+ $this->saveBackTrace();
+
+ // Cast all data
+ $message = (string) $message;
+ $code = (int) $code;
+
+ // make sure everything is assigned properly
+ parent::__construct($message, $code);
+ }
+
+ /**
+ * Save the current backtrace
+ *
+ * @return void
+ */
+ private final function saveBackTrace () {
+ $this->backTrace = debug_backtrace();
+ }
+
+ /**
+ * Get saved backtrace
+ *
+ * @return $backTrace The full backtrace in an array
+ */
+ public final function getBackTrace () {
+ return $this->backTrace;
+ }
+
+ /**
+ * Returns the name of the thrown exception
+ *
+ * @return $toString The name of the thrown exception
+ */
+ public function __toString() {
+ return get_class($this);
+ }
+
+ /**
+ * Getter for hex-decimal code
+ *
+ * @return $hexCode The exception code in hex-decimal format
+ */
+ public final function getHexCode () {
+ // Get the decimal code
+ $code = $this->getCode();
+
+ // Format it to hex-decimal, 0x as prefix and 3 chars
+ $hexCode = sprintf("0x%03s", dechex($code));
+
+ // Return it
+ return $hexCode;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class MismatchingCompressorsException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($array, $code) {
+ // Cast the array
+ $array = (array) $array;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Kompressor <u>%s</u> zu den geladenen Daten aus <u>%s</u> und der aktuell verwendete Kompressor <u>%s</u> stimmen nicht überein!",
+ $array[0]->__toString(),
+ $this->getLine(),
+ strtoupper($array[1]),
+ sprintf("%s:%s",
+ basename(dirname($array[2])),
+ basename($array[2])
+ ),
+ strtoupper($array[3])
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ContainerItemIsNoArrayException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Ein Container-Item ist kein Array.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ContainerItemIsNullException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Ein Container-Item ist auf <em>null</em> gesetzt.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ContainerMaybeDamagedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Ein Container ist möglicherweise beschädigt.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class SavePathIsEmptyException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Speicherpfad ist leer.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class SavePathIsNoDirectoryException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($path, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Der angegebene Speicherpfad <u>%s</u> ist ungütig (kein Pfad).", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class SavePathReadProtectedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($path, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Der Pfad <u>%s</u> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class SavePathWriteProtectedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($path, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Der angegebene Speicherpfad <u>%s</u> ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class DirPointerNotOpenedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($path, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Für den Pfad <u>%s</u> konnte kein Pointer initialisiert werden.", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class FilePointerNotOpenedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($path, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Für die Datei <u>%s</u> konnte kein Pointer initialisiert werden. Möglicherweise ist die Datei nicht lesbar oder fehlt!", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidDataLengthException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($array, $code) {
+ // Cast the array
+ $array = (array) $array;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Eine unerwartete Datenlänge von <u>%s</u> Byte ist aufgetreten. <u>%s</u> wurden erwartet!",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1],
+ $array[2]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidDirectoryResourceException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ if (is_null($class)) {
+ $message = "[???:] Ungütige Verzeichnis-Resource.";
+ } elseif (is_object($class)) {
+ $message = sprintf("[%s:%d] Ungütige Verzeichnis-Resource.",
+ $class->__toString(),
+ $this->getLine()
+ );
+ }
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidMD5ChecksumException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($array, $code) {
+ // Cast the array
+ $array = (array) $array;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Die MD5-Prüfsummen <u>%s</u> und <u>%s</u> stimmen nicht überein!",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1],
+ $array[2]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class PathIsEmptyException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ if (is_null($class)) {
+ $message = "[???:] Der Verzeichnisname ist leer.";
+ } elseif (is_object($class)) {
+ $message = sprintf("[%s:%d] Der Verzeichnisname ist leer.",
+ $class->__toString(),
+ $this->getLine()
+ );
+ }
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class PathIsNoDirectoryException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($path, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Der angegebene Pfad <u>%s</u> ist ungütig (kein Pfad).", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class PathReadProtectedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($path, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Der Pfad <u>%s</u> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidLanguagePathStringException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] <u>%s</u> ist keine Zeichenkette!",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class LanguagePathIsEmptyException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Sprachen-Basispfad ist leer.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class LanguagePathIsNoDirectoryException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Sprach-Basispfad <u>%s</u> existiert nicht oder ist eine Datei!",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class LanguagePathReadProtectedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Sprach-Basispfad <u>%s</u> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ClassMismatchException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($classArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Die Klasse <u>%s</u> ist ungleich <u>%s</u>.",
+ $classArray[0],
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ClassNotFoundException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("Die interne Script-Klasse <u>%s</u> konnte nicht gefunden werden!", $class);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class ConfigEntryIsEmptyException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Leeren Konfigurationseintrag angegeben!",
+ $class,
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class ConfigEntryNotFoundException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct (array $classArray, $code) {
+ // Cast the array
+ $classArray = (array) $classArray;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Konfigurationseintrag <u>%s</u> nicht gefunden.",
+ $classArray[0],
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class DimNotFoundInArrayException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ if (is_object($class)) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Abmasse konnten nicht extrahiert werden!",
+ $class->__toString(),
+ $this->getLine()
+ );
+ } else {
+ // No class given
+ $message = sprintf("Please provide a class for <u>%s</u>", __CLASS__);
+ }
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class ExceptionNotChangedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Exception(s) wurde(n) nicht geändert.",
+ $class,
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// Unsere eigene Exception!
+class ExceptionNotFoundException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct (array $classArray, $code) {
+ // Cast the array
+ $classArray = (array) $classArray;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Exception <u>%s</u> nicht gefunden.",
+ $classArray[0],
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class GetterNotFoundException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($dataArray, $code) {
+ // Cast the array
+ $dataArray = (array) $dataArray;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Getter-Methode für Attribut <u>%s</u> nicht gefunden.",
+ $dataArray[0]->__toString(),
+ $this->getLine(),
+ $dataArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidArrayCountException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($array, $code) {
+ // Cast the array
+ $array = (array) $array;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] <u>%s</u> hat <u>%d</u> Elemente, soll aber <u>%d</u> enthalten!",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1],
+ $array[2],
+ $array[3]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidObjectException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: <u>%s</u>)",
+ $class->__toString(),
+ $this->getLine(),
+ $class->getPartDescr()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class MissingArrayElementsException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($classArray, $code) {
+ // Cast the array
+ $classArray = (array) $classArray;
+
+ // Extract all elements
+ $elements = "";
+ if ((isset($classArray[2])) && (is_array($classArray[2]))) {
+ // Convert into strings
+ $elements = implode("</u>, <u>", $classArray[2]);
+ } else {
+ // Invalid data
+ $elements = "invalid_data";
+ }
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Das Array <u>%s()</u> keine Elemente <u>%s</u> auf!",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1],
+ $elements
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class MissingDecimalsThousandsSeperatorException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($instance, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Die Dezimal- und Tausendertrenner fehlen!",
+ $instance->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class MissingMethodException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($classArray, $code) {
+ // Cast the array
+ $classArray = (array) $classArray;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Weisst keine Methode <u>%s()</u> auf!",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class NoArrayCreatedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($array, $code) {
+ // Cast the array
+ $array = (array) $array;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] <u>%s</u> ist kein erstelltes Objekt.",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class NoArrayException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($string, $code) {
+ // Add a message around the missing class
+ $message = sprintf("<u>%s</u> ist kein Array!",
+ $string
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class NoObjectException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($string, $code) {
+ // Add a message around the missing class
+ $message = sprintf("<u>%s</u> ist kein Objekt!",
+ $string
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class NullPointerException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Eine Instanz/Pointer ist auf <em>null</em> gesetzt.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class VariableIsNotSetException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($array, $code) {
+ // Cast the array
+ $array = (array) $array;
+
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Bei der Initialisierung der Applikation <u>%s</u> wurde keine Variable <u>%s</u> erzeugt.",
+ $array[0]->__toString(),
+ $this->getLine(),
+ $array[1],
+ $array[2]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class BasePathIsEmptyException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class An array holding our informations
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Template-Basispfad ist leer.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class BasePathIsNoDirectoryException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class An array holding our informations
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Template-Basispfad <u>%s</u> existiert nicht oder ist eine Datei!",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class BasePathReadProtectedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class An array holding our informations
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Template-Basispfad <u>%s</u> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidBasePathStringException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class An array holding our informations
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] <u>%s</u> ist keine Zeichenkette!",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class InvalidTemplateVariableNameException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class An array holding our informations
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Die im Template <u>%s</u> gefundene Variable <u>%s</u> ist nicht gültig! Gültige Variablennamen sind nur <u>%s</strong>.",
+ $class[0]->__toString(),
+ $this->getLine(),
+ basename($class[1]),
+ $class[2],
+ $class[3]->readConfig("tpl_valid_var")
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// An exception class for lost classes... ;-)
+class UnexpectedTemplateTypeException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class An array holding our informations
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public final function __construct ($class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Der Template-Typ <u>%s</u> entspricht nicht dem erwartetem Template-Typ <u>%s</u>.",
+ $class[0]->__toString(),
+ $this->getLine(),
+ $class[1],
+ $class[2]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for managing applications. This can be a lot. E.g.:
+ *
+ * - Un-/locking applications
+ * - Creating selectors for the selector-mode
+ * - Usage statistics
+ * - And many more...
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface ManageableApplication extends FrameworkInterface {
+ /**
+ * Getter for application's version number
+ *
+ * @return $appVersion The application's version number
+ */
+ function getAppVersion ();
+ /**
+ * Setter for application's version number
+ *
+ * @param $appVersion The application's version number
+ * @return void
+ */
+ function setAppVersion ($appVersion);
+
+ /**
+ * Getter for application's human-readable name
+ *
+ * @return $appName The application's name readable for humans
+ */
+ function getAppName ();
+
+ /**
+ * Setter for application's human-readable name
+ *
+ * @param $appName The application's name readable for humans
+ * @return void
+ */
+ function setAppName ($appName);
+
+ /**
+ * Getter for application's short uni*-like name
+ *
+ * @return $shortName The application's name readable for humans
+ */
+ function getAppShortName ();
+
+ /**
+ * Setter for application's short uni*-like name
+ *
+ * @param $shortName The application's name readable for humans
+ * @return void
+ */
+ function setAppShortName ($shortName);
+
+ /**
+ * Launches the application
+ *
+ * @return void
+ */
+ function entryPoint ();
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * This is the top-level interface for all other interfaces and should contain
+ * method stubs which is being used in every class
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface FrameworkInterface {
+}
+
+//
+?>
--- /dev/null
+<?php
+/**
+ * An interface for compression classes
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface Compressor extends FrameworkInterface {
+ /**
+ * A compression stream
+ *
+ * @param $streamData Mixed non-object stream data
+ * @return $streamData The compressed stream data
+ * @throws InvalidObjectException If the stream is an object
+ */
+ function compressStream ($streamData);
+
+ /**
+ * A decompression stream
+ *
+ * @param $streamData Mixed non-object stream data
+ * @return $streamData The decompressed stream data
+ * @throws InvalidObjectException If the stream is an object
+ */
+ function decompressStream ($streamData);
+
+ /**
+ * Getter for the file extension of this compressor
+ *
+ * @return $string The compressor's file extension
+ */
+ function getCompressorExtension ();
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The general interface for all other database interfaces
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface FrameworkDatabaseInterface extends FrameworkInterface {
+ /**
+ * Saves a whole object by serializing it entirely or some specifyable
+ * parts. Specifying parts must be done before this method is called. If
+ * it is not done this method will serialize the whole object.
+ *
+ * @param $object An instance to the object we want to save
+ * @return void
+ * @see limitObject(ObjectLimits) limitObject
+ */
+ function saveObject ($object);
+
+ /**
+ * Analyses if a unique ID has already been used or not. This method does
+ * only pass the given ID through to the "real" database layer.
+ *
+ * @param $uniqueID A unique ID number which shall be checked
+ * before it will be used
+ * @param $inConstructor If called from a constructor or from
+ * somewhere else
+ * @return $isUnused true = The unique ID was not found in the database,
+ * false = It is already in use by an other object
+ * @throws NullPointerException If $dbInstance is null
+ * @throws NoObjectException If $dbInstance is not an object
+ * @throws MissingMethodException If the required method
+ * isUniqueIdUsed() was not found
+ */
+ function isUniqueIdUsed ($uniqueID, $inConstructor = false);
+
+ /**
+ * Gets cached data from the database layer and if not found fetch it from
+ * the database again. This method does not return the header stuff because
+ * The underlaying database class will return only the requested content.
+ *
+ * @param $idNumber The ID number which we need for looking up
+ * the requested data
+ * @return $cachedArray The maybe cached data from the database
+ * @throws NullPointerException If $dbInstance is null
+ * @throws NoObjectException If $dbInstance is not an object
+ * @throws MissingMethodException If the required method
+ * isUniqueIdUsed() was not found
+ */
+ function getObjectFromCachedData ($idNumber);
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for front-end database classes. The classes should prepare the
+ * objects for saving in the database. So for server-bases database classes SQL
+ * queries shall be generated and send to the backend classes. In case of local
+ * file databases the object shall be serialized and (maybe) transparently
+ * compressed before they got saved to a local file.
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface DatabaseFrontendInterface extends FrameworkDatabaseInterface {
+ /**
+ * Loads data saved with saveObject from the database and re-creates a
+ * full object from it.
+ * If limitObject() was called before a new object ObjectContainer with
+ * all requested attributes will be returned instead.
+ *
+ * @return Object The fully re-created object or instance to
+ * ObjectContainer
+ */
+ function loadObject ();
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for middleware database classes
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface DatabaseConnector extends FrameworkDatabaseInterface {
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for debugger classes
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface Debugger extends FrameworkInterface {
+ /**
+ * Outputs the given data
+ *
+ * @param $output Debug text for output
+ * @return void
+ */
+ function outputStream ($output);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This is an inface for limiting object while saving them with the
+ * DatabaseConnection class.
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface LimitableObject extends FrameworkInterface {
+ /**
+ * Reduces the volume of a processed object.
+ *
+ * @param $limitInstance An instance to ObjectLimits which holds
+ * attribute names that we want to include
+ * in the processing phase. Other attributes
+ * except $uniqueID and $realClass will be
+ * ignored and keept out.
+ * @return void
+ */
+ function limitObject (ObjectLimits $limitInstance);
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for streams
+ *
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface Streamable extends FrameworkInterface {
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for file input operations.
+ *
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface FileInputStreamer extends Streamable {
+ /**
+ * Reads from a local or remote file
+ *
+ * @param $fqfn The file's FQFN we shall load
+ * @return $array An array containing all read lines
+ * @throws NullPointerException If an instance is null
+ * @throws NoObjectException If the instance is not an object
+ * instance
+ * @throws MissingMethodException If a required method is missing.
+ * @throws InvalidArrayCountException If an array has not the
+ * expected size
+ * @throws InvalidMD5ChecksumException If two MD5 hashes did not match
+ */
+ function loadFileContents ($fqfn);
+}
+
+//
+?>
--- /dev/null
+<?php
+/**
+ * An interface for file output operations.
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface FileOutputStreamer extends Streamable {
+ /**
+ * Saves streamed (that are mostly serialized objects) data to files or
+ * external servers.
+ *
+ * @param $fileName The local file's name including full path
+ * @param $dataArray Array containing the compressor's extension
+ * and streamed data
+ * @return void
+ * @throws NullPointerException If an instance is null
+ * @throws NoObjectException If the instance is not an object
+ * instance
+ * @throws MissingMethodException If a required method is missing.
+ */
+ function saveFile ($fileName, $dataArray);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for output streams
+ *
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface OutputStreamer extends Streamable {
+ /**
+ * Assigns a variable for output
+ *
+ * @param $var The variable we shall assign
+ * @param $value The value to store in the variable
+ * @return void
+ */
+ function assignVariable ($var, $value);
+
+ /**
+ * Output the code
+ *
+ * @return void
+ */
+ function output ($outStream=false);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for language systems
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface ManageableLanguage extends FrameworkInterface {
+ /**
+ * Initialize the array-object for all later language strings
+ *
+ * @return void
+ */
+ function initLanguageStrings();
+} // END - class
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for template engines
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+interface CompileableTemplate extends FrameworkInterface {
+ /**
+ * Assign variables for templates
+ *
+ * @param $var The "variable" we want to assign
+ * @param $value The value we want to store in the variable
+ * @return void
+ */
+ function assignVariable ($var, $value);
+
+ /**
+ * Assign a configuration variables for templates
+ *
+ * @param $var The configuration "variable" we want to assign
+ * @param $value The value we want to store in the variable
+ * @return void
+ */
+ function assignConfigVariable ($var, $value);
+
+ /**
+ * Load a specified web template into the engine
+ *
+ * @param $template The web template we shall load which is
+ * located in "html" by default
+ * @return void
+ */
+ function loadWebTemplate ($template);
+
+ /**
+ * Load a specified code template into the engine for later compilation
+ * with other code/web/email templates.
+ *
+ * @param $template The code template we shall load which is
+ * located in "html" by default
+ * @return void
+ */
+ function loadCodeTemplate ($template);
+
+ /**
+ * Load a specified email template into the engine
+ *
+ * @param $template The email template we shall load which is
+ * located in "emails" by default
+ * @return void
+ */
+ function loadEmailTemplate ($template);
+
+ /**
+ * Compile all variables by inserting their respective values
+ *
+ * @return void
+ */
+ function compileVariables ();
+
+
+ /**
+ * Compile all required code/web/email-templates into the current one
+ *
+ * @return void
+ */
+ function compileTemplate ();
+
+ /**
+ * Output the compiled template to the outside world. In case of web
+ * templates this would be vaild (X)HTML code. And in case of email
+ * templates this would store a prepared email body inside the template
+ * engine.
+ *
+ * @return void
+ */
+ function output ();
+} // END - class
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The simulator system class is the super class of all other classes. This
+ * class handles saving of games etc.
+ */
+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;
+ const EXCEPTION_NOT_CONSTRUCTABLE = 0x02d;
+
+ /**
+ * In the super constructor these system classes shall be ignored or else
+ * we would get an endless calling loop.
+ *
+ *--------------------------------------------------------------------*
+ * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL SHOOT YOUR SERVER!!! *
+ *--------------------------------------------------------------------*
+ */
+ private $systemClasses = array(
+ "DebugMiddleware", // Debug middleware output sub-system
+ "DebugWebOutput", // Debug web output sub-system
+ "DebugConsoleOutput", // Debug console output sub-system
+ "DebugErrorLogOutput", // Debug error_log() output sub-system
+ "CompressorChannel", // Compressor sub-system
+ "FrameworkDirectoryPointer", // Directory handler sub-system
+ "NullCompressor", // Null compressor
+ "Bzip2Compressor", // BZIP2 compressor
+ "GzipCompressor", // GZIP compressor
+ "WebOutput", // Web output sub-system
+ );
+
+ /**
+ * Private super constructor
+ *
+ * @return void
+ */
+ private function __construct ($class) {
+ // Set real class
+ $this->setRealClass($class);
+ }
+
+ /**
+ * Destructor reached...
+ *
+ * @return void
+ */
+ public function __destruct() {
+ // Is this object already destroyed?
+ if ($this->__toString() != "DestructedObject") {
+ // Debug message
+ if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
+ $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> wird zerstört.<br />\n",
+ __CLASS__, $this->__toString()
+ ));
+ }
+
+ // Destroy all informations about this class but keep some text about it alive
+ $this->setPartDescr(sprintf("Entferntes Objekt <em>%s</em>", $this->__toString()));
+ $this->setRealClass("DestructedObject");
+ $this->resetUniqueID();
+ } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
+ // Already destructed object
+ $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> wurde bereits zerstört.<br />\n",
+ __CLASS__, $this->__toString()
+ ));
+ }
+ }
+
+ /**
+ * The call method where all non-implemented methods end up
+ *
+ * @return void
+ */
+ public final function __call ($methodName, $args) {
+ // Implode all given arguments
+ $argsString = implode("|", $args);
+ if (empty($argsString)) $argsString = "NULL";
+
+ $this->getDebugInstance()->output(sprintf("[%s::%s] Stub! Args: %s",
+ $this->__toString(),
+ $methodName,
+ $argsString
+ ));
+
+ // Return nothing
+ return null;
+ }
+
+ /**
+ * Public constructor (for initializing things, etc.)
+ *
+ * @return void
+ */
+ public function constructor ($class) {
+ // Call constructor
+ $this->__construct($class);
+
+ // Get the current (singleton) configuration instance
+ $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration());
+
+ // Is the class weather debug nor compressor channel?
+ if (!in_array($class, $this->systemClasses)) {
+ // Initialize debug instance
+ if (is_null($this->getDebugInstance())) {
+ // Set the debug output system if it is not debug class ;)
+ $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig("debug_engine")));
+ }
+
+ // Initialize web instance
+ if (is_null($this->getWebOutputInstance())) {
+ // Generate the eval() command
+ $eval = sprintf("\$this->setWebOutputInstance(%s::create%s(\"%s\"));",
+ $this->getConfigInstance()->readConfig("web_engine"),
+ $this->getConfigInstance()->readConfig("web_engine"),
+ $this->getConfigInstance()->readConfig("web_content_type")
+ );
+
+ // Debug message
+ if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
+ $this->__toString(),
+ htmlentities($eval)
+ ));
+
+ // Run the command
+ eval($eval);
+ }
+
+ // Initialize compressor channel
+ if (is_null($this->getCompressorChannel())) {
+ // Set the compressor channel
+ $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s",
+ PATH,
+ $this->getConfigInstance()->readConfig("compressor_base_path")
+ )));
+ }
+
+ // Initialize database middleware
+ if (is_null($this->getDatabaseInstance())) {
+ // Get the middleware instance
+ $db = DatabaseConnection::getInstance();
+ if (is_object($db)) {
+ // Set the database middleware
+ $this->setDatabaseInstance($db);
+ }
+ }
+
+ // Debug output
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Alle Sub-Systeme sind initialisiert.<br />\n",
+ $this->__toString()
+ ));
+ }
+ }
+
+ /**
+ * Setter for language instance
+ *
+ * @param $configInstance The configuration instance which shall
+ * be FrameworkConfiguration
+ * @return void
+ */
+ public final function setConfigInstance (FrameworkConfiguration $configInstance) {
+ $this->cfgInstance = $configInstance;
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler auf <strong>%s</strong> gesetzt.<br />\n",
+ $this->__toString(),
+ $configInstance->__toString()
+ ));
+ }
+
+ /**
+ * Getter for configuration instance
+ *
+ * @return $cfhInstance - Configuration instance
+ */
+ public final function getConfigInstance () {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler <strong>%s</strong> angefordert.<br />\n",
+ $this->__toString(),
+ $this->cfgInstance->__toString()
+ ));
+ return $this->cfgInstance;
+ }
+
+ /**
+ * Setter for debug instance
+ *
+ * @param $debugInstance The instance for debug output class
+ * @return void
+ */
+ public final function setDebugInstance (DebugMiddleware $debugInstance) {
+ self::$debug = $debugInstance;
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Debug-Handler auf <strong>%s</strong> gesetzt.<br />\n",
+ $this->__toString(),
+ $this->getDebugInstance()->__toString()
+ ));
+ }
+
+ /**
+ * Getter for debug instance
+ *
+ * @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput
+ */
+ public final function getDebugInstance () {
+ return self::$debug;
+ }
+
+ /**
+ * Setter for web output instance
+ *
+ * @param $webInstance The instance for web output class
+ * @return void
+ */
+ public final function setWebOutputInstance (OutputStreamer $webInstance) {
+ self::$webOutput = $webInstance;
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Web-Handler auf <strong>%s</strong> gesetzt.<br />\n",
+ $this->__toString(),
+ $this->getWebOutputInstance()->__toString()
+ ));
+ }
+
+ /**
+ * Getter for web output instance
+ *
+ * @return $webOutput - Instance to class WebOutput
+ */
+ public final function getWebOutputInstance () {
+ return self::$webOutput;
+ }
+
+ /**
+ * Static setter for database instance
+ *
+ * @param $dbInstance The instance for the database connection
+ * (forced DatabaseConnection)
+ * @return void
+ */
+ public final function setDatabaseInstance (DatabaseConnection $dbInstance) {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($dbInstance->getDebugInstance()))) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Datenbankschicht gesetzt.<br />\n",
+ $dbInstance->__toString()
+ ));
+ $this->dbInstance = $dbInstance;
+ }
+
+ /**
+ * Getter for $realClass
+ *
+ * @return $realClass The name of the real class (not BaseFrameworkSystem)
+ */
+ public final function __toString () {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] __toString() erreicht.<br />\n",
+ $this->realClass
+ ));
+ return $this->realClass;
+ }
+
+ /**
+ * Setter for the real class name
+ *
+ * @param $realClass Class name (string)
+ * @return void
+ */
+ public final function setRealClass ($realClass) {
+ // Cast to string
+ $realClass = (string) $realClass;
+
+ // Set real class
+ $this->realClass = $realClass;
+ }
+
+ /**
+ * Generate unique ID from a lot entropy
+ *
+ * @return void
+ */
+ public final function createUniqueID () {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID aufgerufen.<br />\n",
+ $this->__toString()
+ ));
+
+ // Existiert noch keine?
+ if (empty($this->uniqueID)) {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID erzeugt neue Unique-ID.<br />\n",
+ $this->__toString()
+ ));
+
+ // Correct missing class name
+ $corrected = false;
+ if ($this->__toString() == "") {
+ $this->setRealClass(__CLASS__);
+ $corrected = true;
+ }
+
+ // Neue ID erstellen
+ $tempID = false;
+ while (true) {
+ // Generate a unique ID number
+ $tempID = $this->generateIdNumber();
+ $isUsed = false;
+
+ // Try to figure out if the ID number is not yet used
+ try {
+ if (is_object($this->getDatabaseInstance())) {
+ $isUsed = $this->getDatabaseInstance()->isUniqueIdUsed($tempID, true);
+ }
+ } catch (FrameworkException $e) {
+ // Catches all and ignores all ;-)
+ }
+
+ if (
+ (
+ $tempID !== false
+ ) && (
+ (
+ $this->getDatabaseInstance() === null
+ ) || (
+ (
+ is_object($this->getDatabaseInstance())
+ ) && (
+ !$isUsed
+ )
+ )
+ )
+ ) {
+ // Abort the loop
+ break;
+ }
+ }
+
+ // Debug message
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] uniqueID ist auf <strong>%s</strong> gesetzt.<br />\n",
+ $this->__toString(),
+ $tempID
+ ));
+
+ // Apply the new ID
+ $this->setUniqueID($tempID);
+
+ // Revert maybe corrected class name
+ if ($corrected) {
+ $this->setRealClass("");
+ }
+
+ // Remove system classes if we are in a system class
+ if ((isset($this->systemClasses)) && (in_array($this->__toString(), $this->systemClasses))) {
+ // This may save some RAM...
+ $this->removeSystemArray();
+ }
+ }
+ }
+
+ /**
+ * Generates a new ID number for classes based from the class' real name,
+ * the description and some random data
+ *
+ * @return $tempID The new (temporary) ID number
+ */
+ private final function generateIdNumber () {
+ return sprintf("%s@%s",
+ $this->__toString(),
+ md5(sprintf("%s:%s:%s:%s:%s:%s",
+ $this->__toString(),
+ $this->getPartDescr(),
+ time(),
+ getenv('REMOTE_ADDR'),
+ getenv('SERVER_ADDR'),
+ mt_rand()
+ ))
+ );
+ }
+
+ /**
+ * Setter for unique ID
+ *
+ * @param $uniqueID The newly generated unique ID number
+ * @return void
+ */
+ private final function setUniqueID ($uniqueID) {
+ // Cast to string
+ $uniqueID = (string) $uniqueID;
+
+ // Debug message
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID gesetzt auf <u>%s</u>.<br />\n",
+ $this->__toString(),
+ $uniqueID
+ ));
+
+ // Set the ID number
+ $this->uniqueID = $uniqueID;
+ }
+
+ /**
+ * Getter for unique ID
+ *
+ * @return $uniqueID The unique ID of this class
+ */
+ public final function getUniqueID () {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID angefordert.<br />\n",
+ $this->__toString()
+ ));
+ return $this->uniqueID;
+ }
+
+ /**
+ * Resets or recreates the unique ID number
+ *
+ * @return void
+ */
+ public final function resetUniqueID() {
+ // Sweet and simple... ;-)
+ $newUniqueID = $this->generateIdNumber();
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID zurückgesetzt auf <u>%s</u>.<br />\n",
+ $this->__toString(),
+ $newUniqueID
+ ));
+ $this->setUniqueID($newUniqueID);
+ }
+
+ /**
+ * Getter for simulator description
+ *
+ * @return $partDescr The description of this simulation part
+ */
+ public final function getPartDescr () {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] getPartDescr erreicht.<br />\n",
+ $this->__toString()
+ ));
+ if (isset($this->partDescr)) {
+ return $this->partDescr;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Setter for simulation part description
+ *
+ * @param $partDescr The description as string for this simulation part
+ * @return void
+ */
+ public final function setPartDescr ($partDescr) {
+ $this->partDescr = (String) $partDescr;
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Teilbeschreibung wird auf <strong>%s</strong> gesetzt.<br />\n",
+ $this->__toString(),
+ $this->partDescr
+ ));
+ }
+
+ /**
+ * Validate if given object is the same as current
+ *
+ * @param $object An object instance for comparison with this class
+ * @return boolean The result of comparing both's unique ID
+ */
+ public final function equals ($object) {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Ist <strong>%s</strong>=<strong>%s</strong>?<br />\n",
+ $this->__toString(),
+ $this->__toString(),
+ $object->__toString()
+ ));
+ return ($this->getUniqueID() == $object->getUniqueID());
+ }
+
+ /**
+ * Compare if both simulation part description and class name matches
+ * (shall be enougth)
+ *
+ * @param $itemInstance An object instance to an other class
+ * @return boolean The result of comparing class name simulation part description
+ */
+ public function itemMatches ($itemInstance) {
+ return (
+ ($this->__toString() == $itemInstance->__toString())
+ && ($this->getPartDescr() == $itemInstance->getPartDescr())
+ );
+ }
+
+ /**
+ * Compare class name of this and given class name
+ *
+ * @param $class The class name as string from the other class
+ * @return boolean The result of comparing both class names
+ */
+ public final function isClass ($class) {
+ if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] <strong>%s</strong>=<strong>%s</strong>?<br />\n",
+ $this->__toString(),
+ $this->__toString(),
+ $class
+ ));
+ return ($this->__toString() == $class);
+ }
+
+ /**
+ * Stub method (only real cabins shall override it)
+ *
+ * @return boolean false = is no cabin, true = is a cabin
+ */
+ public function isCabin () {
+ return false;
+ }
+
+ /**
+ * Stub method for tradeable objects
+ *
+ * @return boolean false = is not tradeable by the Merchant class,
+ * true = is a tradeable object
+ */
+ public function isTradeable () {
+ return false;
+ }
+
+ /**
+ * Formats computer generated price values into human-understandable formats
+ * with thousand and decimal seperators.
+ *
+ * @param $value The in computer format value for a price
+ * @param $currency The currency symbol (use HTML-valid characters!)
+ * @param $decNum Number of decimals after commata
+ * @return $price The for the current language formated price string
+ * @throws MissingDecimalsThousandsSeperatorException If decimals or
+ * thousands seperator
+ * is missing
+ */
+ public function formatCurrency ($value, $currency = "€", $decNum = 2) {
+ // Are all required attriutes set?
+ if ((!isset($this->decimals)) || (!isset($this->thousands))) {
+ // Throw an exception
+ throw new MissingDecimalsThousandsSeperatorException($this, self::EXCEPTION_ATTRIBUTES_ARE_MISSING);
+ }
+
+ // Cast the number
+ $value = (float) $value;
+ if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] <strong>%d</strong> wird umformatiert.<br />\n",
+ $this->__toString(),
+ $value
+ ));
+
+ // Reformat the US number
+ $price = sprintf("%s %s",
+ number_format($value, $decNum, $this->decimals, $this->thousands),
+ $currency
+ );
+
+ // Return as string...
+ return $price;
+ }
+
+ /**
+ * Removes number formating characters
+ *
+ * @return void
+ */
+ public final function removeNumberFormaters () {
+ if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Zahlenumformatierungszeichen werden entfernt.<br />\n",
+ $this->__toString()
+ ));
+ unset($this->thousands);
+ unset($this->decimals);
+ }
+
+ /**
+ * Getter for database layer
+ *
+ * @return $dbInstance The database layer instance
+ */
+ public final function getDatabaseInstance () {
+ if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Datenbank-Instanz <u>%s</u> angefordert.<br />\n",
+ $this->__toString(),
+ $this->dbInstance
+ ));
+ return $this->dbInstance;
+ }
+
+ /**
+ * Setter for compressor channel
+ *
+ * @param $compressorChannel An instance of CompressorChannel
+ * @return void
+ */
+ public final function setCompressorChannel (CompressorChannel $compressorChannel) {
+ self::$compressor = $compressorChannel;
+ }
+
+ /**
+ * Getter for compressor channel
+ *
+ * @return $compressor The compressor channel
+ */
+ public final function getCompressorChannel () {
+ return self::$compressor;
+ }
+
+ /**
+ * Remove the $systemClasses array from memory
+ *
+ * @return void
+ */
+ public final function removeSystemArray () {
+ unset($this->systemClasses);
+ }
+
+ /**
+ * Create a file name and path name from the object's unique ID number.
+ * The left part of the ID shall always be a valid class name and the
+ * right part an ID number.
+ *
+ * @return $pfn The file name with a prepended path name
+ * @throws NoArrayCreatedException If explode() fails to create an array
+ * @throws InvalidArrayCountException If the array contains less or
+ * more than two elements
+ */
+ public function getPathFileNameFromObject () {
+ // Get the main object's unique ID. We use this as a path/filename combination
+ $pathFile = $this->getUniqueID();
+
+ // Split it up in path and file name
+ $pathFile = explode("@", $pathFile);
+
+ // Are there two elements? Index 0 is the path, 1 the file name + global extension
+ if (!is_array($pathFile)) {
+ // No array found
+ throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED);
+ } elseif (count($pathFile) != 2) {
+ // Invalid ID returned!
+ throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ }
+
+ // Auto-append missing trailing slash
+ $pathFile[0] = $this->addMissingTrailingSlash($pathFile[0]);
+
+ // Create the file name and return it
+ $pfn = ($pathFile[0] . $pathFile[1]);
+ return $pfn;
+ }
+
+ /**
+ * Appends a trailing slash to a string
+ *
+ * @param $str A string (maybe) without trailing slash
+ * @return $str A string with an auto-appended trailing slash
+ */
+ public final function addMissingTrailingSlash ($str) {
+ // Is there a trailing slash?
+ if (substr($str, -1, 1) != "/") $str .= "/";
+ return $str;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Class for saving arrays as an object. We need this little extension for
+ * some common methods used in the whole application. Please see below if you
+ * need more details.
+ */
+class FrameworkArrayObject extends ArrayObject {
+ /**
+ * Constructor for smooth coding style ;-)
+ *
+ * @param $class The class's real name
+ * @return void
+ */
+ public function constructor ($class) {
+ // $class will be ignored for backward compatiblity
+ }
+
+ /**
+ * Get real class' name back
+ *
+ * @return $realClass The class' real name
+ */
+ public function __toString () {
+ return get_class($this);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * BZIP2 compression and decompression class
+ */
+class Bzip2Compressor extends BaseFrameworkSystem implements Compressor {
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor!
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\n",
+ $this->__toString()
+ ));
+
+ // Set description
+ $this->setPartDescr("BZIP2-Kompressor");
+
+ // Create an unique ID
+ $this->createUniqueID();
+ }
+
+ /**
+ * Create a new compressor channel based a given compression handler
+ *
+ * @return $cInstance An instance of this class
+ */
+ public final static function createBzip2Compressor () {
+ // Get new instance
+ if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) {
+ // Compressor can maybe be used
+ $cInstance = new Bzip2Compressor();
+
+ // Debug message
+ if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompression wird verwendet.<br />\n",
+ $cInstance->__toString()
+ ));
+ } else {
+ // Routines not found!
+ $cInstance = null;
+
+ // Debug message
+ if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompressionsroutinen <strong>nicht</strong> gefunden.<br />\n",
+ $cInstance->__toString()
+ ));
+ }
+
+ // Return the compressor instance
+ return $cInstance;
+ }
+
+ /**
+ * BZIP2 compression stream
+ *
+ * @param $streamData Mixed non-object stream data
+ * @return $streamData The compressed stream data
+ * @throws InvalidObjectException If the stream is an object
+ */
+ public function compressStream ($streamData) {
+ if (is_object($streamData)) {
+ // Throw an exception
+ throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
+ }
+
+ // Return the compressed stream
+ return bzcompress($streamData, 1);
+ }
+
+ /**
+ * BZIP2 decompression stream
+ *
+ * @param $streamData Mixed non-object stream data
+ * @return $streamData The decompressed stream data
+ * @throws InvalidObjectException If the stream is an object
+ */
+ public function decompressStream ($streamData) {
+ if (is_object($streamData)) {
+ // Throw an exception
+ throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
+ }
+
+ // Return the decompressed stream
+ return bzdecompress($streamData);
+ }
+
+ /**
+ * Getter for the file extension of this compressor
+ *
+ * @return $string Returns always "bz2"
+ */
+ public final function getCompressorExtension () {
+ if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.<br />\n",
+ $this->__toString()
+ ));
+ return "bz2";
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * GZIP compression and decompression class
+ */
+class GzipCompressor extends BaseFrameworkSystem implements Compressor {
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor!
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\n",
+ $this->__toString()
+ ));
+
+ // Set description
+ $this->setPartDescr("GZIP-Kompressor");
+
+ // Create an unique ID
+ $this->createUniqueID();
+ }
+
+ /**
+ * Create a new compressor channel based a given compression handler
+ *
+ * @return $cInstance An instance of this class
+ */
+ public final static function createGzipCompressor () {
+ // Get new instance
+ if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) {
+ // Compressor can maybe be used
+ $cInstance = new GzipCompressor();
+
+ // Debug message
+ if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompression wird verwendet.<br />\n",
+ $cInstance->__toString()
+ ));
+ } else {
+ // Routines not found!
+ $cInstance = null;
+
+ // Debug message
+ if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompressionsroutinen <strong>nicht</strong> gefunden.<br />\n",
+ $cInstance->__toString()
+ ));
+ }
+
+ // Return the compressor instance
+ return $cInstance;
+ }
+
+ /**
+ * GZIP compression stream
+ *
+ * @param $streamData Mixed non-object stream data
+ * @return $streamData The compressed stream data
+ * @throws InvalidObjectException If the stream is an object
+ */
+ public function compressStream ($streamData) {
+ if (is_object($streamData)) {
+ // Throw an exception
+ throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
+ }
+
+ // Return the compressed stream
+ return gzcompress($streamData, 1);
+ }
+
+ /**
+ * GZIP decompression stream
+ *
+ * @param $streamData Mixed non-object stream data
+ * @return $streamData The decompressed stream data
+ * @throws InvalidObjectException If the stream is an object
+ */
+ public function decompressStream ($streamData) {
+ if (is_object($streamData)) {
+ // Throw an exception
+ throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
+ }
+
+ // Return the decompressed stream
+ return gzuncompress($streamData);
+ }
+
+ /**
+ * Getter for the file extension of this compressor
+ *
+ * @return $string Returns always "gz"
+ */
+ public final function getCompressorExtension () {
+ if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.<br />\n",
+ $this->__toString()
+ ));
+ return "gz";
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Null compression and decompression class
+ */
+class NullCompressor extends BaseFrameworkSystem implements Compressor {
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor!
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\n",
+ $this->__toString()
+ ));
+
+ // Set description
+ $this->setPartDescr("Null-Kompressor");
+
+ // Create an unique ID
+ $this->createUniqueID();
+ }
+
+ /**
+ * Create a new compressor channel based a given compression handler
+ *
+ * @return $cInstance An instance of this class
+ */
+ public final static function createNullCompressor () {
+ // Get new instance
+ $cInstance = new NullCompressor();
+
+ // Return the compressor instance
+ return $cInstance;
+ }
+
+ /**
+ * Null compression stream
+ *
+ * @param $streamData Mixed non-object stream data
+ * @return $streamData The compressed stream data
+ * @throws InvalidObjectException If the stream is an object
+ */
+ public function compressStream ($streamData) {
+ if (is_object($streamData)) {
+ // Throw an exception
+ throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
+ }
+
+ // Return the compressed stream
+ return $streamData;
+ }
+
+ /**
+ * Null decompression stream
+ *
+ * @param $streamData Mixed non-object stream data
+ * @return $streamData The decompressed stream data
+ * @throws InvalidObjectException If the stream is an object
+ */
+ public function decompressStream ($streamData) {
+ if (is_object($streamData)) {
+ // Throw an exception
+ throw new InvalidObjectException($streamData, self::EXCEPTION_UNEXPECTED_OBJECT);
+ }
+
+ // Return the decompressed stream
+ return $streamData;
+ }
+
+ /**
+ * Getter for the file extension of this compressor
+ *
+ * @return $string Returns always "bz2"
+ */
+ public final function getCompressorExtension () {
+ if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.<br />\n",
+ $this->__toString()
+ ));
+ return "null";
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This class contains static helper functions for console applications
+ */
+class ConsoleTools extends BaseFrameworkSystem {
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Console-Tools");
+
+ // Create an unique ID
+ $this->createUniqueID();
+ }
+
+ /**
+ * Aquires the IP address of this host by reading the /etc/hostname file and solving it
+ *
+ * @return $ip The resolved IP address
+ */
+ public static function aquireSelfIPAddress () {
+ // Local IP by default
+ $ip = "127.0.0.1";
+
+ // Get a new instance
+ $helper = new ConsoleTools();
+
+ try {
+ // Get a file pointer
+ $io = FrameworkFileInputPointer::createFrameworkFileInputPointer("/etc/hostname");
+
+ // Read the file
+ $hostname = trim($io->readFromFile());
+ $helper->getDebugInstance()->output(sprintf("[%s:] Our host name is: <strong>%s</strong><br />\n",
+ $helper->__toString(),
+ $hostname
+ ));
+
+ // Close the file
+ $io->closeFile();
+
+ // Resolve it
+ $ipResolved = gethostbyname($hostname);
+ if (($ipResolved !== false) && ($ipResolved != $hostname)) {
+ // Okay, this works!
+ $ip = $ipResolved;
+
+ // Debug message
+ $helper->getDebugInstance()->output(sprintf("[%s:] Resolved IP address is: <strong>%s</strong><br />\n",
+ $helper->__toString(),
+ $ip
+ ));
+ }
+ } catch (FrameworkException $e) {
+ // Do nothing here
+ }
+
+ // Return the IP address
+ return $ip;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An abstract database access class for handling database I/O requests
+ *
+ * @see DatabaseFrontendInterface An interface for database frontends
+ * (front-end to the application)
+ */
+abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject {
+ /**
+ * The limiter instance
+ */
+ private $limitInstance = null;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct($class) {
+ // Call parent constructor
+ parent::constructor($class);
+
+ // Debug message
+ if (((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.<br />\n",
+ $this->__toString()
+ ));
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ }
+
+ /**
+ * The public constructor
+ *
+ * @return void
+ */
+ public function constructor ($class) {
+ // Calls just the private one
+ $this->__construct($class);
+ }
+
+ /**
+ * Getter for limitation instance
+ *
+ * @return $limitInstance The instance to the object ObjectLimits
+ */
+ public final function getLimitInstance () {
+ if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz <strong>%s</strong> angefordert.<br />\n",
+ $this->__toString(),
+ $this->limitInstance->__toString()
+ ));
+ return $this->limitInstance;
+ }
+
+ /**
+ * Setup limitation for the saving process
+ *
+ * @param $limitInstance An instance of ObjectLimits which contains
+ * elements we shall exclusivly include in
+ * saving process
+ * @return void
+ */
+ public final function limitObject (ObjectLimits $limitInstance) {
+ // Debug message
+ if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz <strong>%s</strong> soll verwendet werden.<br />\n",
+ $this->__toString(),
+ $limitInstance->__toString()
+ ));
+
+ // Get limitArray for validation
+ $array = $limitInstance->getLimitArray();
+
+ // Sanity-check if some limitations are in the object
+ if ($array->count() > 0) {
+ // Okay, there is enougth
+ $this->limitInstance = $limitInstance;
+
+ // Debug message
+ if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz <strong>%s</strong> wird verwendet und beinhaltet <strong>%s</strong> Einträge.<br />\n",
+ $this->__toString(),
+ $limitInstance->__toString(),
+ $array->count()
+ ));
+ }
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Database backend class for storing objects in locally created files.
+ *
+ * This class serializes objects and saves them to local files.
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 0.1
+ */
+class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface {
+ /**
+ * Save path for "file database"
+ */
+ private $savePath = "";
+
+ /**
+ * The file's extension
+ */
+ private $fileExtension = "serialized";
+
+ /**
+ * The IO handler for file handling which should be FileIOHandler.
+ */
+ private $ioInstance = null;
+
+ /**
+ * The last read file's name
+ */
+ private $lastFile = "";
+
+ /**
+ * The last read file's content including header information
+ */
+ private $lastContents = array();
+
+ /**
+ * The private constructor. Do never instance from outside!
+ * You need to set a local file path. The class will then validate it.
+ *
+ * @return void
+ */
+ private function __construct() {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Dateidatenbankschicht");
+
+ // Create unique ID
+ $this->createUniqueID();
+
+ // Clean up a little
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Create an object of LocalFileDatabase and set the save path for local files.
+ * This method also validates the given file path.
+ *
+ * @param $savePath The local file path string
+ * @param $ioInstance The input/output handler. This
+ * should be FileIOHandler
+ * @return $dbInstance An instance of LocalFileDatabase
+ * @throws SavePathIsEmptyException If the given save path is an
+ * empty string
+ * @throws SavePathIsNoDirectoryException If the save path is no
+ * path (e.g. a file)
+ * @throws SavePathReadProtectedException If the save path is read-
+ * protected
+ * @throws SavePathWriteProtectedException If the save path is write-
+ * protected
+ */
+ public final static function createLocalFileDatabase ($savePath, FileIOHandler $ioInstance) {
+ // Get an instance
+ $dbInstance = new LocalFileDatabase();
+
+ if (empty($savePath)) {
+ // Empty string
+ throw new SavePathIsEmptyException($dbInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!is_dir($savePath)) {
+ // Is not a dir
+ throw new SavePathIsNoDirectoryException($savePath, self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($savePath)) {
+ // Path not readable
+ throw new SavePathReadProtectedException($savePath, self::EXCEPTION_READ_PROTECED_PATH);
+ } elseif (!is_writeable($savePath)) {
+ // Path not writeable
+ throw new SavePathWriteProtectedException($savePath, self::EXCEPTION_WRITE_PROTECED_PATH);
+ }
+
+ // Debug output
+ if (defined('DEBUG_DATABASE')) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Es werden lokale Dateien zum Speichern von Objekten verwendet.<br />\n",
+ $dbInstance->__toString()
+ ));
+
+ // Set save path and IO instance
+ $dbInstance->setSavePath($savePath);
+ $dbInstance->setIOInstance($ioInstance);
+
+ // Return database instance
+ return $dbInstance;
+ }
+
+ /**
+ * Setter for save path
+ *
+ * @param $savePath The local save path where we shall put our serialized classes
+ * @return void
+ */
+ public final function setSavePath ($savePath) {
+ // Secure string
+ $savePath = (string) $savePath;
+
+ // Debug message
+ if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Lokaler Speicherpfad <strong>%s</strong> wird verwendet.<br />\n",
+ $this->__toString(),
+ $savePath
+ ));
+
+ // Set save path
+ $this->savePath = $savePath;
+ }
+
+ /**
+ * Getter for save path
+ *
+ * @return $savePath The local save path where we shall put our serialized classes
+ */
+ public final function getSavePath () {
+ return $this->savePath;
+ }
+
+ /**
+ * Getter for file extension
+ *
+ * @return $fileExtension The file extension for all file names
+ */
+ public final function getFileExtension () {
+ return $this->fileExtension;
+ }
+
+ /**
+ * Saves a given object to the local file system by serializing and
+ * transparently compressing it
+ *
+ * @param $object The object we shall save to the local file system
+ * @return void
+ * @throws NullPointerException If the object instance is null
+ * @throws NoObjectException If the parameter $object is not
+ * an object
+ */
+ public final function saveObject ($object) {
+ // Some tests on the parameter...
+ if (is_null($object)) {
+ // Is null, throw exception
+ throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($object)) {
+ // Is not an object, throw exception
+ throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($object, '__toString')) {
+ // A highly required method was not found... :-(
+ throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // Debug message
+ if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> soll in eine lokale Datei gespeichert werden.<br />\n",
+ $this->__toString(),
+ $object->__toString()
+ ));
+
+ // Get a string containing the serialized object. We cannot exchange
+ // $this and $object here because $object does not need to worry
+ // about it's limitations... ;-)
+ $serialized = $this->serializeObject($object);
+
+ // Debug message
+ if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> ist nach der Serialisierung <strong>%s</strong> Byte gross.<br />\n",
+ $this->__toString(),
+ $object->__toString(),
+ strlen($serialized)
+ ));
+
+ // Get a path name plus file name and append the extension
+ $fqfn = $this->getSavePath() . $object->getPathFileNameFromObject() . "." . $this->getFileExtension();
+
+ // Save the file to disc we don't care here if the path is there,
+ // this must be done in later methods.
+ $this->getIOInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized));
+ }
+
+ /**
+ * Get a serialized string from the given object
+ *
+ * @param $object The object we want to serialize and transparently
+ * compress
+ * @return $serialized A string containing the serialzed/compressed object
+ * @see ObjectLimits An object holding limition information
+ * @see SerializationContainer A special container class for e.g.
+ * attributes from limited objects
+ */
+ private function serializeObject ($object) {
+ // If there is no limiter instance we serialize the whole object
+ // otherwise only in the limiter object (ObjectLimits) specified
+ // attributes summarized in a special container class
+ if ($this->getLimitInstance() === null) {
+ // Serialize the whole object. This tribble call is the reason
+ // why we need a fall-back implementation in CompressorChannel
+ // of the methods compressStream() and decompressStream().
+ $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($object));
+ } else {
+ // Serialize only given attributes in a special container
+ $container = SerializationContainer::createSerializationContainer($this->getLimitInstance(), $object);
+
+ // Serialize the container
+ $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($container));
+ }
+
+ // Return the serialized object string
+ return $serialized;
+ }
+
+ /**
+ * Analyses if a unique ID has already been used or not by search in the
+ * local database folder.
+ *
+ * @param $uniqueID A unique ID number which shall be checked
+ * before it will be used
+ * @param $inConstructor If we got called in a de/con-structor or
+ * from somewhere else
+ * @return $isUnused true = The unique ID was not found in the database,
+ * false = It is already in use by an other object
+ * @throws NoArrayCreatedException If explode() fails to create an array
+ * @throws InvalidArrayCountException If the array contains less or
+ * more than two elements
+ */
+ public function isUniqueIdUsed ($uniqueID, $inConstructor = false) {
+ // Currently not used... ;-)
+ $isUsed = false;
+
+ // Split the unique ID up in path and file name
+ $pathFile = explode("@", $uniqueID);
+
+ // Are there two elements? Index 0 is the path, 1 the file name + global extension
+ if (!is_array($pathFile)) {
+ // No array found
+ if ($inConstructor) {
+ return false;
+ } else {
+ throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED);
+ }
+ } elseif (count($pathFile) != 2) {
+ // Invalid ID returned!
+ if ($inConstructor) {
+ return false;
+ } else {
+ throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ }
+ }
+
+ // Create full path name
+ $pathName = $this->getSavePath() . $pathFile[0];
+
+ // Check if the file is there with a file handler
+ if ($inConstructor) {
+ // No exceptions in constructors and destructors!
+ $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName, true);
+
+ // Has an object being created?
+ if (!is_object($dirInstance)) return false;
+ } else {
+ // Outside a constructor
+ try {
+ $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName);
+ } catch (PathIsNoDirectoryException $e) {
+ // Okay, path not found
+ return false;
+ }
+ }
+
+ // Initialize the search loop
+ $isValid = false;
+ while ($dataFile = $dirInstance->readDirectoryExcept(array(".", ".."))) {
+ // Generate FQFN for testing
+ $fqfn = sprintf("%s/%s", $pathName, $dataFile);
+ $this->setLastFile($fqfn);
+
+ // Get instance for file handler
+ $inputHandler = $this->getIOInstance();
+
+ // Try to read from it. This makes it sure that the file is
+ // readable and a valid database file
+ $this->setLastFileContents($inputHandler->loadFileContents($fqfn));
+
+ // Extract filename (= unique ID) from it
+ $ID = substr(basename($fqfn), 0, -(strlen($this->getFileExtension()) + 1));
+
+ // Is this the required unique ID?
+ if ($ID == $pathFile[1]) {
+ // Okay, already in use!
+ $isUsed = true;
+ }
+ }
+
+ // Close the directory handler
+ $dirInstance->closeDirectory();
+
+ // Now the same for the file...
+ return $isUsed;
+ }
+
+ /**
+ * Getter for the file IO instance
+ *
+ * @return $ioInstance An instance for IO operations
+ * @see FileIOHandler The concrete handler for IO operations
+ */
+ public final function getIOInstance () {
+ return $this->ioInstance;
+ }
+
+ /**
+ * Setter for the file IO instance
+ *
+ * @param $ioInstance An instance for IO operations (should be
+ * FileIOHandler)
+ * @return void
+ */
+ public final function setIOInstance (FileIOHandler $ioInstance) {
+ $this->ioInstance = $ioInstance;
+ }
+
+ /**
+ * Setter for the last read file
+ *
+ * @param $fqfn The FQFN of the last read file
+ * @return void
+ */
+ private function setLastFile ($fqfn) {
+ // Cast string
+ $fqfn = (string) $fqfn;
+ $this->lastFile = $fqfn;
+ }
+
+ /**
+ * Getter for last read file
+ *
+ * @return $lastFile The last read file's name with full path
+ */
+ public final function getLastFile () {
+ return $this->lastFile;
+ }
+
+ /**
+ * Setter for contents of the last read file
+ *
+ * @param $contents An array with header and data elements
+ * @return void
+ */
+ private function setLastFileContents ($contents) {
+ // Cast array
+ $contents = (array) $contents;
+ $this->lastContents = $contents;
+ }
+
+ /**
+ * Getter for last read file's content as an array
+ *
+ * @return $lastContent The array with elements 'header' and 'data'.
+ */
+ public final function getLastContents () {
+ return $this->lastContents;
+ }
+
+ /**
+ * Get cached (last fetched) data from the local file database
+ *
+ * @param $uniqueID The ID number for looking up the data
+ * @return $object The restored object from the maybe compressed
+ * serialized data
+ * @throws MismatchingCompressorsException If the compressor from
+ * the loaded file
+ * mismatches with the
+ * current used one.
+ * @throws NullPointerException If the restored object
+ * is null
+ * @throws NoObjectException If the restored "object"
+ * is not an object instance
+ * @throws MissingMethodException If the required method
+ * toString() is missing
+ */
+ public function getObjectFromCachedData ($uniqueID) {
+ // Get instance for file handler
+ $inputHandler = $this->getIOInstance();
+
+ // Get last file's name and contents
+ $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID);
+ $contents = $this->repairContents($this->getLastContents(), $fqfn);
+
+ // Let's decompress it. First we need the instance
+ $compressInstance = $this->getCompressorChannel();
+
+ // Is the compressor's extension the same as the one from the data?
+ if ($compressInstance->getCompressorExtension() != $contents['header'][0]) {
+ /**
+ * @todo For now we abort here but later we need to make this a little more dynamic.
+ */
+ throw new MismatchingCompressorsException(array($this, $contents['header'][0], $fqfn, $compressInstance->getCompressorExtension()), self::EXCEPTION_MISMATCHING_COMPRESSORS);
+ }
+
+ // Decompress the data now
+ $serialized = $compressInstance->getCompressor()->decompressStream($contents['data']);
+
+ // And unserialize it...
+ $object = unserialize($serialized);
+
+ // This must become a valid object, so let's check it...
+ if (is_null($object)) {
+ // Is null, throw exception
+ throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($object)) {
+ // Is not an object, throw exception
+ throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($object, '__toString')) {
+ // A highly required method was not found... :-(
+ throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // And return the object
+ return $object;
+ }
+
+ /**
+ * Private method for re-gathering (repairing) the FQFN
+ *
+ * @param $fqfn The current FQFN we shall validate
+ * @param $uniqueID The unique ID number
+ * @return $fqfn The repaired FQFN when it is empty
+ * @throws NoArrayCreatedException If explode() has not
+ * created an array
+ * @throws InvalidArrayCountException If the array count is not
+ * as the expected
+ */
+ private function repairFQFN ($fqfn, $uniqueID) {
+ // Cast both strings
+ $fqfn = (string) $fqfn;
+ $uniqueID = (string) $uniqueID;
+
+ // Is there pre-cached data available?
+ if (empty($fqfn)) {
+ // Split the unique ID up in path and file name
+ $pathFile = explode("@", $uniqueID);
+
+ // Are there two elements? Index 0 is the path, 1 the file name + global extension
+ if (!is_array($pathFile)) {
+ // No array found
+ throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED);
+ } elseif (count($pathFile) != 2) {
+ // Invalid ID returned!
+ throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ }
+
+ // Create full path name
+ $pathName = $this->getSavePath() . $pathFile[0];
+
+ // Nothing cached, so let's create a FQFN first
+ $fqfn = sprintf("%s/%s.%s", $pathName, $pathFile[1], $this->getFileExtension());
+ $this->setLastFile($fqfn);
+ }
+
+ // Return repaired FQFN
+ return $fqfn;
+ }
+
+ /**
+ * Private method for re-gathering the contents of a given file
+ *
+ * @param $contents The (maybe) already cached contents as an array
+ * @param $fqfn The current FQFN we shall validate
+ * @return $contents The repaired contents from the given file
+ */
+ private function repairContents ($contents, $fqfn) {
+ // Is there some content and header (2 indexes) in?
+ if ((!is_array($contents)) || (count($contents) != 2) || (!isset($contents['header'])) || (!isset($contents['data']))) {
+ // No content found so load the file again
+ $contents = $inputHandler->loadFileContents($fqfn);
+
+ // And remember all data for later usage
+ $this->setLastContents($contents);
+ }
+
+ // Return the repaired contents
+ return $contents;
+ }
+
+ /* DUMMY */ public final function loadObject () {}
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A debug output class for the console (e.g. hub software)
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A debug output class for PHP's error_log() command
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A debug output class for the web browser
+ */
+class DebugWebOutput extends BaseFrameworkSystem implements Debugger {
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Debug-Ausgabe auf Konsole");
+
+ // Create an unique ID
+ $this->createUniqueID();
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $debugInstance The prepared debug instance
+ */
+ public final static function createDebugWebOutput () {
+ // Get a new instance
+ $debugInstance = new DebugWebOutput();
+
+ // Return it
+ return $debugInstance;
+ }
+
+ /**
+ * Outputs the given data directly
+ *
+ * @param $output The HTML output
+ * @return void
+ */
+ public final function outputStream ($output) {
+ trigger_error($output);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This object limits other objects. This is mostly being used to prepare
+ * objects to the datatabase connection or else a lot heap would be saved.
+ */
+class ObjectLimits extends BaseFrameworkSystem {
+ /**
+ * Limitation array for storing all attribute names we will use later
+ * only.
+ */
+ private $limitArray = null;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private final function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set part description
+ $this->setPartDescr("Limitierungsobjekt");
+
+ // Create unique ID number
+ $this->createUniqueID();
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ }
+
+ /**
+ * Create a new ObjectLimits object and (maybe prepare it a little)
+ *
+ * @param $limitationArray The limitation array we "walk" through
+ * @return $limitInstance The instance to an ObjectLimits object
+ */
+ public final static function createObjectLimits (array $limitationArray) {
+ // Is there a limitation array given?
+ if (count($limitationArray) > 0) {
+ // Get instance
+ $limitInstance = new ObjectLimits();
+
+ // Get all limitations and do them
+ foreach ($limitationArray as $limit) {
+ // What shall we limitate?
+ if ($limit instanceof FrameworkInterface) {
+ // Add an object
+ $limitInstance->addObject($limit);
+ } elseif (is_string($limit)) {
+ // Add a string
+ $limitInstance->addString($limit);
+ } else {
+ // Others are not supported (yet)
+ throw new UnsupportedLimitationPartException($limit, self::EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED);
+ }
+ }
+
+ // Return instance
+ return $limitInstance;
+ } else {
+ // No limitation given so we send "null" back
+ return null;
+ }
+ }
+
+ /**
+ * Add an object's name to the limitation list
+ *
+ * @param $object The object's name we shall add to the list
+ * @return void
+ */
+ private final function addObject (FrameworkInterface $object) {
+ // Auto-initialization
+ if (is_null($this->limitArray)) {
+ // Initialize this array
+ $this->limitArray = new FrameworkArrayObject();
+ }
+
+ // Add the object's name to it
+ $this->limitArray->append($object->__toString());
+ }
+
+ /**
+ * Add a string directly to the limitation list
+ *
+ * @param $str The string we want to add directly
+ * @return void
+ */
+ private final function addString ($str) {
+ // Auto-initialization
+ if (is_null($this->limitArray)) {
+ // Initialize this array
+ $this->limitArray = new FrameworkArrayObject();
+ }
+
+ // Add the direct string to ArrayObject
+ $this->limitArray->append($str);
+ }
+
+ /**
+ * Getter for limitArray
+ *
+ * @return $limitArray The object ArrayObject which holds limitations
+ */
+ public final function getLimitArray () {
+ return $this->limitArray;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * This class contains object attributes which we can now send together to
+ * other classes
+ */
+class SerializationContainer extends FrameworkArrayObject {
+ /**
+ * Public constructor, if you like to have an object of this class...
+ *
+ * @return void
+ */
+ public function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Debug message
+ if ((defined('DEBUG_CONTAINER')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[SerializationContainer:] Konstruktor erreicht.<br />\n");
+ }
+
+ /**
+ * Create a SerializationContainer object by applying the limitations
+ * in $limitInstance on $object. The resulting data container will only
+ * hold the attributed and their values which we have specified in
+ * the limitation object.
+ *
+ * @param $limitInstance The instance to the object ObjectLimits
+ * @param $object The origin object. We don't touch it here.
+ * @return $containerInstance An instance of SerializationContainer
+ * @throws GetterNotFoundException If a getter was not found
+ */
+ public final static function createSerializationContainer (ObjectLimits $limitInstance, $object) {
+ // Get an instance
+ $containerInstance = new SerializationContainer();
+
+ // Iterate through the whole limitation array
+ for ($idx = $limitInstance->getLimitArray()->getIterator(); $idx->valid(); $idx->next()) {
+ // Get current item from list
+ $curr = ucfirst($idx->current());
+
+ // Is the required method available?
+ if (method_exists($object, sprintf("get%s", $curr))) {
+ // Generate a command for getting it
+ $eval = sprintf("\$value = \$object->get%s();",
+ $curr
+ );
+
+ // Debug eval command
+ if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $limitInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
+ $this->__toString(),
+ htmlentities($eval)
+ ));
+
+ // Run it
+ @eval($eval);
+
+ // Add this item to the container list
+ $containerInstance->append(array(
+ 'name' => $curr,
+ 'value' => $value
+ ));
+ } else {
+ // Throw an exception
+ throw new GetterNotFoundException(array($object, $curr), self::EXCEPTION_GETTER_IS_MISSING);
+ }
+ } // END - for
+
+ // Return container instance
+ return $containerInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An universal class for file input/output streams.
+ */
+class FileIOStream extends BaseFrameworkSystem implements FileInputStreamer, FileOutputStreamer {
+ /**
+ * Private constructor
+ */
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set part description
+ $this->setPartDescr("Universal Datei-Ein-/Ausgabesystem");
+
+ // Create unique ID
+ $this->createUniqueID();
+
+ // Clean-up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Create a file IO stream. This is a class for performing all actions
+ * on files like creating, deleting and loading them.
+ *
+ * @return $ioInstance An instance of FileIOStream
+ */
+ public final static function createFileIOStream () {
+ // Create new instance
+ $ioInstance = new FileIOStream();
+
+ // Return the instance
+ return $ioInstance;
+ }
+
+ /**
+ * Saves data to a given local file
+ *
+ * @param $fileName The file name for the to be saved file
+ * @param $dataArray The data we shall store to the file
+ * @return void
+ * @see FileOutputStreamer
+ */
+ public final function saveFile ($fileName, $dataArray) {
+ // Try it five times
+ $dirName = ""; $fileInstance = null;
+ for ($idx = 0; $idx < 5; $idx++) {
+ // Get a file output pointer
+ try {
+ $fileInstance = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fileName, 'w');
+ } catch (FilePointerNotOpenedException $e) {
+ // Create missing directory
+ $dirName = dirname($fileName);
+ for ($idx2 = 0; $idx2 < (2 - $idx); $idx2++) {
+ $dirName = dirname($dirName);
+ }
+ // Try to create it
+ @mkdir($dirName);
+ }
+ }
+
+ // Write a header information for validation purposes
+ $fileInstance->writeToFile(sprintf("@head^%s:%s:%s:%s\n",
+ $dataArray[0],
+ time(),
+ strlen($dataArray[1]),
+ md5($dataArray[1])
+ ));
+
+ // Encode the (maybe) binary stream with Base64
+ $b64Stream = base64_encode($dataArray[1]);
+
+ // write the data line by line
+ $line = str_repeat(" ", 50); $idx = 0;
+ while (strlen($line) == 50) {
+ // Get 50 chars or less
+ $line = substr($b64Stream, $idx, 50);
+
+ // Save it to the stream
+ $fileInstance->writeToFile(sprintf("@data^%s:%s\n",
+ $line,
+ md5($line)
+ ));
+
+ // Advance to the next 50-chars block
+ $idx += 50;
+ }
+
+ // Close the file
+ $fileInstance->closeFile();
+ }
+
+ /**
+ * Reads from a local file
+ *
+ * @param $fqfn The full-qualified file-name which we shall load
+ * @return $array An array with the element 'header' and 'data'
+ * @see FileInputStreamer
+ */
+ public final function loadFileContents ($fqfn) {
+ // Initialize some variables and arrays
+ $inputBuffer = "";
+ $lastBuffer = "";
+ $header = array();
+ $data = array();
+ $readData = ""; // This will contain our read data
+
+ // Get a file input handler
+ $fileInstance = FrameworkFileInputPointer::createFrameworkFileInputPointer($fqfn);
+
+ // Read all it's contents (we very and transparently decompress it below)
+ while ($readRawLine = $fileInstance->readFromFile()) {
+ // Add the read line to the buffer
+ $inputBuffer .= $readRawLine;
+
+ // Break infinite loop maybe caused by the input handler
+ if ($lastBuffer == $inputBuffer) break;
+
+ // Remember last read line for avoiding possible infinite loops
+ $lastBuffer = $inputBuffer;
+ }
+
+ // Close directory handle
+ $fileInstance->closeFile();
+
+ // Convert it into an array
+ $inputBuffer = explode("\n", $inputBuffer);
+
+ // Now process the read lines and verify it's content
+ foreach ($inputBuffer as $rawLine) {
+ // Trim it a little but not the leading spaces/tab-stops
+ $rawLine = rtrim($rawLine);
+
+ // Analyze this line
+ if (substr($rawLine, 0, 5) == "@head") {
+ // Header found, so let's extract it
+ $header = explode("^", $rawLine);
+ $header = trim($header[1]);
+
+ // Now we must convert it again into an array
+ $header = explode(":", $header);
+
+ // Is the header (maybe) valid?
+ if (count($header) != 4) {
+ // Throw an exception
+ throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ }
+ } elseif (substr($rawLine, 0, 5) == "@data") {
+ // Is a data line!
+ $data = explode("^", $rawLine);
+ $data = $data[1];
+
+ // First element is the data, second the MD5 checksum
+ $data = explode(":", $data);
+
+ // Validate the read line
+ if (count($data) == 2) {
+ if (md5($data[0]) != $data[1]) {
+ // MD5 hash did not match!
+ throw new InvalidMD5ChecksumException(array($this, md5($data[0]), $data[1]), self::EXCEPTION_MD5_CHECKSUMS_MISMATCH);
+ }
+ } else {
+ // Invalid count!
+ throw new InvalidArrayCountException(array($this, "data", count($data), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ }
+
+ // Add this to the readData string
+ $readData .= $data[0];
+ } else {
+ // Other raw lines than header/data tagged lines and re-add the new-line char
+ $readData .= $rawLine."\n";
+ }
+ }
+
+ // Was raw lines read and no header/data?
+ if ((!empty($readData)) && (count($header) == 0) && (count($data) == 0)) {
+ // Return raw lines back
+ return $readData;
+ }
+
+ // Was a header found?
+ if (count($header) != 4) {
+ // Throw an exception
+ throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ }
+
+ // Decode all from Base64
+ $readData = @base64_decode($readData);
+
+ // Does the size match?
+ if (strlen($readData) != $header[2]) {
+ // Size did not match
+ throw new InvalidDataLengthException(array($this, strlen($readData), $header[2]), self::EXCEPTION_UNEXPECTED_STRING_SIZE);
+ }
+
+ // Validate the decoded data with the final MD5 hash
+ if (md5($readData) != $header[3]) {
+ // MD5 hash did not match!
+ throw new InvalidMD5ChecksumException(array($this, md5($readData), $header[3]), self::EXCEPTION_MD5_CHECKSUMS_MISMATCH);
+ }
+
+ // Return all in an array
+ return array(
+ 'header' => $header,
+ 'data' => $readData
+ );
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A class for directory reading and getting its contents
+ */
+class FrameworkDirectoryPointer extends BaseFrameworkSystem {
+ /**
+ * The current path we are working in
+ */
+ private $pathName = "";
+
+ /**
+ * The directory pointer
+ */
+ private $dirPointer = null;
+
+ /**
+ * Private constructor
+ */
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set part description
+ $this->setPartDescr("Verzeichnis-Handler");
+
+ // Create unique ID
+ $this->createUniqueID();
+
+ // Clean-up a little
+ $this->removeNumberFormaters();
+ }
+
+ /**
+ * Destructor for cleaning purposes, etc
+ */
+ public function __destruct() {
+ // Is there a resource pointer? Then we have to close the directory here!
+ if (is_resource($this->getPointer())) {
+ // Try to close a directory
+ $this->closeDirectory();
+ }
+
+ // Call the parent destructor
+ parent::__destruct();
+ }
+
+ /**
+ * Create a directory pointer based on the given path. The path will also
+ * be verified here.
+ *
+ * @param $pathName The path name we shall pass
+ * to opendir()
+ * @param $inConstructor If we are in de/con-structor
+ * or from somewhere else
+ * @throws PathIsEmptyException If the provided path name
+ * is empty
+ * @throws InvalidPathStringException If the provided path name is
+ * not a string
+ * @throws PathIsNoDirectoryException If the provided path name is
+ * not valid
+ * @throws PathReadProtectedException If the provided path name is
+ * read-protected
+ * @throws DirPointerNotOpened If opendir() returns not a
+ * directory resource
+ * @return $pointerInstance A prepared instance of
+ * FrameworkDirectoryPointer
+ */
+ public final static function createFrameworkDirectoryPointer ($pathName, $inConstructor = false) {
+ // Some pre-sanity checks...
+ if (is_null($pathName)) {
+ // No pathname given
+ if ($inConstructor) {
+ return null;
+ } else {
+ throw new PathIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ }
+ } elseif (!is_string($pathName)) {
+ // Is not a string
+ if ($inConstructor) {
+ return null;
+ } else {
+ throw new InvalidPathStringException(null, self::EXCEPTION_INVALID_STRING);
+ }
+ } elseif (!is_dir($pathName)) {
+ // Not a directory
+ if ($inConstructor) {
+ return null;
+ } else {
+ throw new PathIsNoDirectoryException($pathName, self::EXCEPTION_INVALID_PATH_NAME);
+ }
+ } elseif (!is_readable($pathName)) {
+ // Not readable
+ if ($inConstructor) {
+ return null;
+ } else {
+ throw new PathReadProtectedException($pathName, self::EXCEPTION_READ_PROTECED_PATH);
+ }
+ }
+
+ // Try to open a handler
+ $dirPointer = @opendir($pathName);
+ if (!is_resource($dirPointer)) {
+ // Something bad happend
+ if ($inConstructor) {
+ return null;
+ } else {
+ throw new DirPointerNotOpenedException($pathName, self::EXCEPTION_DIR_POINTER_INVALID);
+ }
+ }
+
+ // Create new instance
+ $pointerInstance = new FrameworkDirectoryPointer();
+
+ // Set directory pointer and path name
+ $pointerInstance->setPointer($dirPointer);
+ $pointerInstance->setPathName($pathName);
+
+ // Return the instance
+ return $pointerInstance;
+ }
+
+ /**
+ * Read raw lines of data from a directory pointer and return the data
+ *
+ * @return string Directory and/or file names read from the current
+ * directory pointer
+ * @throws NullPointerException If the directory pointer instance
+ * is not set by setPointer()
+ * @throws InvalidDirectoryResourceException If there is being set
+ * an invalid directory resource
+ */
+ public function readRawDirectory () {
+ if (is_null($this->getPointer())) {
+ // Pointer not initialized
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_resource($this->getPointer())) {
+ // Pointer is not a valid resource!
+ throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+
+ // Read data from the directory pointer and return it
+ return readdir($this->getPointer());
+ }
+
+ /**
+ * Read lines from the current directory pointer except some parts
+ *
+ * @param $except Some parts of a directory we want to ignore.
+ * Valid: dirs
+ * Other values will be silently ignored
+ * @return string Directory and/or file names read from the current
+ * directory pointer
+ */
+ public function readDirectoryExcept ($except = "") {
+ if ((empty($except)) || (!is_array($except)) || (count($except) == 0)) {
+ // No exception given, so read all data
+ return $this->readRawDirectory();
+ }
+
+ // Read a raw line...
+ $rawLine = $this->readRawDirectory();
+
+ // Shall we exclude directories?
+ if ((!is_null($rawLine)) && ($rawLine !== false) && (in_array($rawLine, $except))) {
+ // Exclude this part
+ return $this->readDirectoryExcept($except);
+ } elseif ((!is_null($rawLine)) && ($rawLine !== false)) {
+ // Return read data
+ return $rawLine;
+ }
+
+ // End pointer reached
+ return null;
+ }
+
+ /**
+ * Close a directory source and set it's instance to null and the path name
+ * to empty
+ *
+ * @return void
+ * @throws NullPointerException If the directory pointer instance
+ * is not set by setPointer()
+ * @throws InvalidDirectoryResourceException If there is being set
+ */
+ public function closeDirectory () {
+ if (is_null($this->getPointer())) {
+ // Pointer not initialized
+ return;
+ } elseif (!is_resource($this->getPointer())) {
+ // Pointer is not a valid resource!
+ throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+
+ // Close the directory pointer and reset the instance variable
+ @closedir($this->getPointer());
+ $this->setPointer(null);
+ $this->setPathName("");
+ }
+
+ /**
+ * Setter for the directory pointer
+ *
+ * @param $dirPointer The directory resource
+ * @return void
+ */
+ public final function setPointer ($dirPointer) {
+ // Sanity-check if the pointer is a valid directory resource
+ if (is_resource($dirPointer) || is_null($dirPointer)) {
+ // Is a valid resource
+ $this->dirPointer = $dirPointer;
+ } else {
+ // Throw exception
+ throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+ }
+
+ /**
+ * Getter for the directory pointer
+ *
+ * @return $dirPointer The directory pointer which shall be a valid
+ * directory resource
+ */
+ public final function getPointer () {
+ return $this->dirPointer;
+ }
+
+ /**
+ * Setter for path name
+ *
+ * @param $pathName The new path name
+ * @return void
+ */
+ public final function setPathName ($pathName) {
+ $pathName = (string) $pathName;
+ $this->pathName = $pathName;
+ }
+
+ /**
+ * Getter for path name
+ *
+ * @return $pathName The current path name
+ */
+ public final function getPathName () {
+ return $this->pathName;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A class for reading files
+ */
+class FrameworkFileInputPointer extends BaseFrameworkSystem {
+ /**
+ * The current file we are working in
+ */
+ private $fileName = "";
+
+ /**
+ * The file pointer
+ */
+ private $filePointer = null;
+
+ /**
+ * Private constructor
+ */
+ private final function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set part description
+ $this->setPartDescr("Dateiausgabe-Handler");
+
+ // Create unique ID
+ $this->createUniqueID();
+
+ // Clean-up a little
+ $this->removeNumberFormaters();
+ }
+
+ /**
+ * Destructor for cleaning purposes, etc
+ */
+ public final function __destruct() {
+ // Is there a resource pointer? Then we have to close the file here!
+ if (is_resource($this->getPointer())) {
+ // Try to close a file
+ $this->closeFile();
+ }
+
+ // Call the parent destructor
+ parent::__destruct();
+ }
+
+ /**
+ * Create a file pointer based on the given file. The file will also
+ * be verified here.
+ *
+ * @param $fileName The file name we shall pass
+ * to fopen()
+ * @throws FileIsEmptyException If the provided file name is empty.
+ * @throws FilePointerNotOpenedException If fopen() returns not a
+ * file resource
+ * @return void
+ */
+ public final static function createFrameworkFileInputPointer ($fileName) {
+ // Some pre-sanity checks...
+ if (is_null($fileName)) {
+ // No filename given
+ throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ }
+
+ // Try to open a handler
+ $filePointer = @fopen($fileName, 'rb');
+ if (($filePointer === null) || ($filePointer === false)) {
+ // Something bad happend
+ throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID);
+ }
+
+ // Create new instance
+ $pointerInstance = new FrameworkFileInputPointer();
+
+ // Set file pointer and file name
+ $pointerInstance->setPointer($filePointer);
+ $pointerInstance->setFileName($fileName);
+
+ // Return the instance
+ return $pointerInstance;
+ }
+
+ /**
+ * Read data a file pointer
+ *
+ * @return mixed The result of fread()
+ * @throws NullPointerException If the file pointer instance
+ * is not set by setPointer()
+ * @throws InvalidFileResourceException If there is being set
+ * an invalid file resource
+ */
+ public function readFromFile () {
+ if (is_null($this->getPointer())) {
+ // Pointer not initialized
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_resource($this->getPointer())) {
+ // Pointer is not a valid resource!
+ throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+
+ // Read data from the file pointer and return it
+ return fread($this->getPointer(), 1024);
+ }
+
+ /**
+ * Read lines from a file pointer
+ *
+ * @return mixed The result of fread()
+ * @throws NullPointerException If the file pointer instance
+ * is not set by setPointer()
+ * @throws InvalidFileResourceException If there is being set
+ * an invalid file resource
+ */
+ public function readLinesFromFile () {
+ if (is_null($this->getPointer())) {
+ // Pointer not initialized
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_resource($this->getPointer())) {
+ // Pointer is not a valid resource!
+ throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+
+ // Read data from the file pointer and return it
+ return fgets($this->getPointer(), 1024);
+ }
+
+ /**
+ * Close a file source and set it's instance to null and the file name
+ * to empty
+ *
+ * @return void
+ * @throws NullPointerException If the file pointer instance
+ * is not set by setPointer()
+ * @throws InvalidFileResourceException If there is being set
+ */
+ public function closeFile () {
+ if (is_null($this->getPointer())) {
+ // Pointer not initialized
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_resource($this->getPointer())) {
+ // Pointer is not a valid resource!
+ throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+
+ // Close the file pointer and reset the instance variable
+ @fclose($this->getPointer());
+ $this->setPointer(null);
+ $this->setFileName("");
+ }
+
+ /**
+ * Setter for the file pointer
+ *
+ * @param $filePointer File resource
+ * @return void
+ */
+ public final function setPointer ($filePointer) {
+ // Sanity-check if the pointer is a valid file resource
+ if (is_resource($filePointer) || is_null($filePointer)) {
+ // Is a valid resource
+ $this->filePointer = $filePointer;
+ } else {
+ // Throw exception
+ throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+ }
+
+ /**
+ * Getter for the file pointer
+ *
+ * @return $filePointer The file pointer which shall be a valid
+ * file resource
+ */
+ public final function getPointer () {
+ return $this->filePointer;
+ }
+
+ /**
+ * Setter for file name
+ *
+ * @param $fileName The new file name
+ * @return void
+ */
+ public final function setFileName ($fileName) {
+ $fileName = (string) $fileName;
+ $this->fileName = $fileName;
+ }
+
+ /**
+ * Getter for file name
+ *
+ * @return $fileName The current file name
+ */
+ public final function getFileName () {
+ return $this->fileName;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A class for writing files
+ */
+class FrameworkFileOutputPointer extends BaseFrameworkSystem {
+ /**
+ * The current file we are working in
+ */
+ private $fileName = "";
+
+ /**
+ * The file pointer
+ */
+ private $filePointer = null;
+
+ /**
+ * Private constructor
+ */
+ private final function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set part description
+ $this->setPartDescr("Dateiausgabe-Handler");
+
+ // Create unique ID
+ $this->createUniqueID();
+
+ // Clean-up a little
+ $this->removeNumberFormaters();
+ }
+
+ /**
+ * Destructor for cleaning purposes, etc
+ */
+ public final function __destruct() {
+ // Is there a resource pointer? Then we have to close the file here!
+ if (is_resource($this->getPointer())) {
+ // Try to close a file
+ $this->closeFile();
+ }
+
+ // Call the parent destructor
+ parent::__destruct();
+ }
+
+ /**
+ * Create a file pointer based on the given file. The file will also
+ * be verified here.
+ *
+ * @param $fileName The file name we shall pass
+ * to fopen()
+ * @param $mode The output mode ('w', 'a' are valid)
+ * @throws FileIsEmptyException If the provided file name is empty.
+ * @throws FilePointerNotOpened If fopen() returns not a file
+ * resource
+ * @return void
+ */
+ public final static function createFrameworkFileOutputPointer ($fileName, $mode) {
+ // Some pre-sanity checks...
+ if (is_null($fileName)) {
+ // No filename given
+ throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ }
+
+ // Try to open a handler
+ $filePointer = @fopen($fileName, $mode);
+ if (($filePointer === null) || ($filePointer === false)) {
+ // Something bad happend
+ throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID);
+ }
+
+ // Create new instance
+ $pointerInstance = new FrameworkFileOutputPointer();
+
+ // Set file pointer and file name
+ $pointerInstance->setPointer($filePointer);
+ $pointerInstance->setFileName($fileName);
+
+ // Return the instance
+ return $pointerInstance;
+ }
+
+ /**
+ * Write data to a file pointer
+ *
+ * @param $dataStream The data stream we shall write to the file
+ * @return mixed The result of fwrite()
+ * @throws NullPointerException If the file pointer instance
+ * is not set by setPointer()
+ * @throws InvalidFileResourceException If there is being set
+ * an invalid file resource
+ */
+ public function writeToFile ($dataStream) {
+ if (is_null($this->getPointer())) {
+ // Pointer not initialized
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_resource($this->getPointer())) {
+ // Pointer is not a valid resource!
+ throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+
+ // Read data from the file pointer and return it
+ return fwrite($this->getPointer(), $dataStream);
+ }
+
+ /**
+ * Close a file source and set it's instance to null and the file name
+ * to empty
+ *
+ * @return void
+ * @throws NullPointerException If the file pointer instance
+ * is not set by setPointer()
+ * @throws InvalidFileResourceException If there is being set
+ */
+ public function closeFile () {
+ if (is_null($this->getPointer())) {
+ // Pointer not initialized
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_resource($this->getPointer())) {
+ // Pointer is not a valid resource!
+ throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+
+ // Close the file pointer and reset the instance variable
+ @fclose($this->getPointer());
+ $this->setPointer(null);
+ $this->setFileName("");
+ }
+
+ /**
+ * Setter for the file pointer
+ *
+ * @param $filePointer File resource
+ * @return void
+ */
+ public final function setPointer ($filePointer) {
+ // Sanity-check if the pointer is a valid file resource
+ if (is_resource($filePointer) || is_null($filePointer)) {
+ // Is a valid resource
+ $this->filePointer = $filePointer;
+ } else {
+ // Throw exception
+ throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ }
+ }
+
+ /**
+ * Getter for the file pointer
+ *
+ * @return $filePointer The file pointer which shall be a valid
+ * file resource
+ */
+ public final function getPointer () {
+ return $this->filePointer;
+ }
+
+ /**
+ * Setter for file name
+ *
+ * @param $fileName The new file name
+ * @return void
+ */
+ public final function setFileName ($fileName) {
+ $fileName = (string) $fileName;
+ $this->fileName = $fileName;
+ }
+
+ /**
+ * Getter for file name
+ *
+ * @return $fileName The current file name
+ */
+ public final function getFileName () {
+ return $this->fileName;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The language sub-system for handling language strings being used in the
+ * application and whole framework
+ */
+class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage {
+ /**
+ * The full-qualified base path for the language include files
+ */
+ private $basePath = "";
+
+ /**
+ * The 2-char language code
+ */
+ private $langCode = "xx"; // This will later be overwritten!
+
+ /**
+ * The array-object for all language strings
+ */
+ private $langStrings = null;
+
+ /**
+ * An instance of this class
+ */
+ private static $thisInstance = null;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private final function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set part description
+ $this->setPartDescr("Sprachsystem");
+
+ // Create unique ID number
+ $this->createUniqueID();
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of the class LanguageSystem and prepares it for usage
+ *
+ * @param $basePath The local base path for all language strings
+ * @return $langInstance An instance of LanguageSystem
+ * @throws LanguagePathIsEmptyException If the provided $basePath is empty
+ * @throws InvalidLanguagePathStringException If $basePath is no string
+ * @throws LanguagePathIsNoDirectoryException If $basePath is no
+ * directory or not found
+ * @throws LanguagePathReadProtectedException If $basePath is
+ * read-protected
+ */
+ public final static function createLanguageSystem ($basePath) {
+ // Get a new instance
+ $langInstance = new LanguageSystem();
+
+ // Is the base path valid?
+ if (empty($basePath)) {
+ // Language path is empty
+ throw new LanguagePathIsEmptyException($langInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!is_string($basePath)) {
+ // Is not a string
+ throw new InvalidLanguagePathStringException(array($langInstance, $basePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($basePath)) {
+ // Is not a path
+ throw new LanguagePathIsNoDirectoryException(array($langInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($basePath)) {
+ // Is not readable
+ throw new LanguagePathReadProtectedException(array($langInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ }
+
+ // Set the base path
+ $langInstance->setBasePath($basePath);
+
+ // Initialize the variable stack
+ $langInstance->initLanguageStrings();
+
+ // Set language code from default config
+ $langInstance->setLanguageCode($langInstance->getConfigInstance()->readConfig("default_lang"));
+
+ // Remember this instance
+ self::$thisInstance = $langInstance;
+
+ // Return the prepared instance
+ return $langInstance;
+ }
+
+ /**
+ * Singleton getter for this instance
+ *
+ * @return $thisInstance An instance of this class
+ */
+ public final static function getInstance () {
+ return self::$thisInstance;
+ }
+
+ /**
+ * Initialize the array-object for all later language strings
+ *
+ * @return void
+ */
+ public function initLanguageStrings () {
+ $this->langStrings = new FrameworkArrayObject();
+ }
+
+ /**
+ * Setter for base path
+ *
+ * @param $basePath The local base path for all templates
+ * @return void
+ */
+ public final function setBasePath ($basePath) {
+ // Cast it
+ $basePath = (string) $basePath;
+
+ // And set it
+ $this->basePath = $basePath;
+ }
+
+ /**
+ * Getter for language code
+ *
+ * @return $langCode The language code for the current application
+ */
+ public final function getLanguageCode () {
+ return $this->langCode;
+ }
+
+ /**
+ * Setter for language code
+ *
+ * @param $langCode The language code for the current application
+ * @return void
+ */
+ public final function setLanguageCode ($langCode) {
+ // Cast it
+ $langCode = (string) $langCode;
+
+ // And set it (only 2 chars)
+ $this->langCode = substr($langCode, 0, 2);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This class simply puts HTML code / JavaScript code or CSS code out to the
+ * browser
+ */
+class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer {
+ /**
+ * The instance for the singleton design pattern
+ */
+ private static $consoleInstance = null;
+
+ /**
+ * Assigned variables
+ */
+ private $vars = array();
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Console-Ausgabe-Handler");
+
+ // Create an unique ID
+ $this->createUniqueID();
+ }
+
+ /**
+ * Create a new web output system and set the content type
+ *
+ * @param $contentType A valid content-type
+ * @return $debugInstance An instance of this middleware class
+ */
+ public final static function createConsoleOutput ($contentType) {
+ // Cast the content-type to string
+ $contentType = (string) $contentType;
+ $contentType = trim($contentType);
+
+ // Get instance
+ self::$consoleInstance = new ConsoleOutput();
+
+ // Set the content type
+ if (!empty($contentType)) {
+ @header(sprintf("Content-type: %s",
+ $contentType
+ ));
+ }
+
+ // Return instance
+ return self::$consoleInstance;
+ }
+
+ /**
+ * Getter for an instance of this class
+ *
+ * @return $consoleInstance An instance of this class
+ */
+ public final static function getInstance() {
+ if (is_null(self::$consoleInstance)) {
+ $contentType = FrameworkConfiguration::getInstance()->readConfig("web_content_type");
+ self::$consoleInstance = ConsoleOutput::createConsoleOutput($contentType);
+ }
+ return self::$consoleInstance;
+ }
+
+ /**
+ * Output the code
+ *
+ * @param $outStream Something we shall sent to the console
+ * @return void
+ */
+ public final function output ($outStream=false) {
+ if ($outStream === false) {
+ // Output something here...
+ foreach ($this->vars as $var=>$value) {
+ $this->output("var=".$var.", value=".$value."");
+ }
+ } else {
+ // Output it to the console
+ printf("%s\n", trim(html_entity_decode(strip_tags($outStream))));
+ }
+ }
+
+ /**
+ * Assigns a variable for output
+ *
+ * @param $var The variable we shall assign
+ * @param $value The value to store in the variable
+ * @return void
+ */
+ public function assignVariable ($var, $value) {
+ $this->vars[$var] = $value;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * This class simply puts HTML code / JavaScript code or CSS code out to the
+ * browser
+ */
+class WebOutput extends BaseFrameworkSystem implements OutputStreamer {
+ /**
+ * The instance for the singleton design pattern
+ */
+ private static $webInstance = null;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Web-Ausgabe-Handler");
+
+ // Create an unique ID
+ $this->createUniqueID();
+ }
+
+ /**
+ * Create a new web output system and set the content type
+ *
+ * @param $contentType A valid content-type
+ * @return $debugInstance An instance of this middleware class
+ */
+ public final static function createWebOutput ($contentType) {
+ // Is there no instance?
+ if (is_null(self::$webInstance)) {
+ // Cast the content-type to string and trim it
+ $contentType = (string) $contentType;
+ $contentType = trim($contentType);
+
+ // Set the content type
+ if (!empty($contentType)) {
+ @header(sprintf("Content-type: %s",
+ $contentType
+ ));
+ }
+
+ // Get a new instance and set it
+ self::$webInstance = new WebOutput();
+ }
+
+ // Return instance
+ return self::$webInstance;
+ }
+
+ /**
+ * Assigns a variable for output
+ *
+ * @param $var The variable we shall assign
+ * @param $value The value to store in the variable
+ * @return void
+ */
+ public function assignVariable($var, $value) {
+ // Stub message because we don't have it here
+ trigger_error(__METHOD__.": Stub!");
+ }
+
+ /**
+ * Output the code
+ *
+ * @return void
+ */
+ public final function output ($outStream=false) {
+ print $outStream;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The own template engine for loading caching and sending out the web pages
+ * and emails.
+ */
+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 <strong>%s</strong> vom Typ <strong>%s</strong> wird geladen.<br />\n",
+ $this->__toString(),
+ $template,
+ $this->getTemplateType()
+ ));
+
+ // Get a input/output instance from the middleware
+ $ioInstance = $this->getIOInstance();
+
+ // Validate the instance
+ if (is_null($ioInstance)) {
+ // Throw exception
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($ioInstance)) {
+ // Throw another exception
+ throw new NoObjectException($ioInstance, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($ioInstance, 'loadFileContents')) {
+ // Throw yet another exception
+ throw new MissingMethodException(array($ioInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // Load the raw template
+ $rawTemplateData = $ioInstance->loadFileContents($fqfn);
+
+ // Debug message
+ if ((defined('DEBUG_TEMPLATE')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] <strong>%s</strong> Byte Rohdaten geladen.<br />\n",
+ $this->__toString(),
+ strlen($rawTemplateData)
+ ));
+
+ // Store the template's contents into this class
+ $this->setRawTemplateData($rawTemplateData);
+
+ // Remember the template's FQFN
+ $this->setLastTemplate($fqfn);
+ }
+
+ /**
+ * Try to assign an extracted template variable as a "content" or "config"
+ * variable.
+ *
+ * @param $varName The variable's name (shall be content or
+ * config) by default
+ * @param $var The variable we want to assign
+ */
+ private function assignTemplateVariable ($varName, $var) {
+ // Is it not a config variable?
+ if ($varName != "config") {
+ // Regular template variables
+ $this->assignVariable($var, "");
+ } else {
+ // Configuration variables
+ $this->assignConfigVariable($var, $this->getConfigInstance()->readConfig($var));
+ }
+ }
+
+ /**
+ * Extract variables from a given raw data stream
+ *
+ * @param $rawData The raw template data we shall analyze
+ * @return void
+ * @throws InvalidTemplateVariableNameException If a variable name
+ * in a template is
+ * invalid
+ */
+ private function extractVariablesFromRawData ($rawData) {
+ // Cast to string
+ $rawData = (string) $rawData;
+
+ // Search for variables
+ @preg_match_all('/\$(\w+)(\[(\w+)\])?/', $rawData, $variableMatches);
+
+ // Did we find some variables?
+ if ((is_array($variableMatches)) && (count($variableMatches) == 4) && (count($variableMatches[0]) > 0)) {
+ // Initialize all missing variables
+ foreach ($variableMatches[3] as $key=>$var) {
+ // Is the variable name valid?
+ if (($variableMatches[1][$key] != $this->getConfigInstance()->readConfig("tpl_valid_var")) && ($variableMatches[1][$key] != "config")) {
+ // Invalid variable name
+ throw new InvalidTemplateVariableNameException(array($this, $this->getLastTemplate(), $variableMatches[1][$key], $this->getConfigInstance()), self::TEMPLATE_CONTAINS_INVALID_VAR_EXCEPTION);
+ }
+
+ // Try to assign it, empty strings are being ignored
+ $this->assignTemplateVariable($variableMatches[1][$key], $var);
+ }
+ }
+ }
+
+ /**
+ * Main analysis of the loaded template
+ *
+ * @param $templateMatches Found template place-holders, see below
+ * @return void
+ *
+ *---------------------------------
+ * Structure of $templateMatches:
+ *---------------------------------
+ * [0] => Array - An array with all full matches
+ * [1] => Array - An array with left part (before the ":") of a match
+ * [2] => Array - An array with right part of a match including ":"
+ * [3] => Array - An array with right part of a match excluding ":"
+ */
+ private function analyzeTemplate ($templateMatches) {
+ // Backup raw template data
+ $backup = $this->getRawTemplateData();
+
+ // Initialize some arrays
+ if (is_null($this->loadedRawData)) { $this->loadedRawData = array(); $this->rawTemplates = array(); }
+
+ // Load all requested templates
+ foreach ($templateMatches[1] as $template) {
+
+ // Load and compile only templates which we have not yet loaded
+ // RECURSIVE PROTECTION! BE CAREFUL HERE!
+ if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) {
+
+ // Then try to search for code-templates first
+ try {
+ // Load the code template and remember it's contents
+ $this->loadCodeTemplate($template);
+ $this->loadedRawData[$template] = $this->getRawTemplateData();
+
+ // Remember this template for recursion detection
+ // RECURSIVE PROTECTION!
+ $this->loadedTemplates[] = $template;
+ } catch (FilePointerNotOpenedException $e) {
+ // Template not found!
+ $this->rawTemplates[] = $template;
+ }
+
+ } // if ((!isset( ...
+
+ } // for ($templateMatches ...
+
+ // Restore the raw template data
+ $this->setRawTemplateData($backup);
+ }
+
+ /**
+ * Compile a given raw template code and remember it for later usage
+ *
+ * @param $code The raw template code
+ * @param $template The template's name
+ * @return void
+ */
+ private function compileCode ($code, $template) {
+ // Is this template already compiled?
+ if (in_array($template, $this->compiledTemplates)) {
+ // Abort here...
+ return;
+ }
+
+ // Remember this template being compiled
+ $this->compiledTemplates[] = $template;
+
+ // Compile the loaded code in five steps:
+ //
+ // 1. Backup current template data
+ $backup = $this->getRawTemplateData();
+
+ // 2. Set the current template's raw data as the new content
+ $this->setRawTemplateData($code);
+
+ // 3. Compile the template data
+ $this->compileTemplate();
+
+ // 4. Remember it's contents
+ $this->loadedRawData[$template] = $this->getRawTemplateData();
+
+ // 5. Restore the previous raw content from backup variable
+ $this->setRawTemplateData($backup);
+ }
+
+ /**
+ * Insert all given and loaded templates by running through all loaded
+ * codes and searching for their place-holder in the main template
+ *
+ * @param $templateMatches See method analyzeTemplate()
+ * @return void
+ */
+ private function insertAllTemplates ($templateMatches) {
+ // Run through all loaded codes
+ foreach ($this->loadedRawData as $template => $code) {
+
+ // Search for the template
+ $foundIndex = array_search($template, $templateMatches[1]);
+
+ // Lookup the matching template replacement
+ if (isset($templateMatches[0][$foundIndex])) {
+
+ // Get the current raw template
+ $rawData = $this->getRawTemplateData();
+
+ // Replace the space holder with the template code
+ $rawData = str_replace($templateMatches[0][$foundIndex], $code, $rawData);
+
+ // Set the new raw data
+ $this->setRawTemplateData($rawData);
+ }
+ }
+ }
+
+ /**
+ * Load all extra raw templates
+ *
+ * @return void
+ */
+ private function loadExtraRawTemplates () {
+ // Are there some raw templates we need to load?
+ if (count($this->rawTemplates) > 0) {
+ // Try to load all raw templates
+ foreach ($this->rawTemplates as $key => $template) {
+ try {
+ // Load the template
+ $this->loadWebTemplate($template);
+
+ // Remember it's contents
+ $this->rawTemplates[$template] = $this->getRawTemplateData();
+
+ // Remove it from the loader list
+ unset($this->rawTemplates[$key]);
+
+ // Remember this template for recursion detection
+ // RECURSIVE PROTECTION!
+ $this->loadedTemplates[] = $template;
+ } catch (FilePointerNotOpenedException $e) {
+ // This template was never found. We silently ignore it
+ unset($this->rawTemplates[$key]);
+ }
+ }
+ }
+ }
+
+ /**
+ * Assign all found template variables
+ *
+ * @param $varMatches An array full of variable/value pairs.
+ * @return void
+ */
+ private function assignAllVariables ($varMatches) {
+ // Search for all variables
+ foreach ($varMatches[1] as $key=>$var) {
+
+ // Detect leading equals
+ if (substr($varMatches[2][$key], 0, 1) == "=") {
+ // Remove and cast it
+ $varMatches[2][$key] = (string) substr($varMatches[2][$key], 1);
+ }
+
+ // Do we have some quotes left and right side? Then it is free text
+ if ((substr($varMatches[2][$key], 0, 1) == "\"") && (substr($varMatches[2][$key], -1, 1) == "\"")) {
+ // Free string detected! Which we can assign directly
+ $this->assignVariable($var, $varMatches[3][$key]);
+ } else {
+ // Non-string found so we need some deeper analysis...
+ die("Deeper analysis not yet implemented!");
+ }
+
+ } // for ($varMatches ...
+ }
+ /**
+ * Compiles all loaded raw templates
+ *
+ * @param $templateMatches See method analyzeTemplate() for details
+ * @return void
+ */
+ private function compileRawTemplateData ($templateMatches) {
+ // Are some code-templates found which we need to compile?
+ if (count($this->loadedRawData) > 0) {
+
+ // Then compile all!
+ foreach ($this->loadedRawData as $template => $code) {
+
+ // Search for the template
+ $foundIndex = array_search($template, $templateMatches[1]);
+
+ // Lookup the matching variable data
+ if (isset($templateMatches[3][$foundIndex])) {
+
+ // Split it up with another reg. exp. into variable=value pairs
+ @preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches);
+
+ // Assign all variables
+ $this->assignAllVariables($varMatches);
+
+ } // END - if (isset($templateMatches ...
+
+ // Compile the loaded template
+ $this->compileCode($code, $template);
+
+ } // END - foreach ($this->loadedRawData ...
+
+ // Insert all templates
+ $this->insertAllTemplates($templateMatches);
+
+ } // END - if (count($this->loadedRawData) ...
+ }
+
+ /**
+ * Getter for raw template data
+ *
+ * @return $rawTemplateData The raw data from the template
+ */
+ public final function getRawTemplateData () {
+ return $this->rawTemplateData;
+ }
+
+ /**
+ * Getter for compiled templates
+ */
+ public final function getCompiledData () {
+ return $this->compiledData;
+ }
+
+ /**
+ * Load a specified web template into the engine
+ *
+ * @param $template The web template we shall load which is
+ * located in "html" by default
+ * @return void
+ */
+ public final function loadWebTemplate ($template) {
+ // Set template type
+ $this->setTemplateType($this->getConfigInstance()->readConfig("web_template_type"));
+
+ // Load the special template
+ $this->loadTemplate($template);
+ }
+
+ /**
+ * Load a specified email template into the engine
+ *
+ * @param $template The email template we shall load which is
+ * located in "emails" by default
+ * @return void
+ */
+ public final function loadEmailTemplate ($template) {
+ // Set template type
+ $this->setTemplateType($this->getConfigInstance()->readConfig("email_template_type"));
+
+ // Load the special template
+ $this->loadTemplate($template);
+ }
+
+ /**
+ * Load a specified code template into the engine
+ *
+ * @param $template The code template we shall load which is
+ * located in "code" by default
+ * @return void
+ */
+ public final function loadCodeTemplate ($template) {
+ // Set template type
+ $this->setTemplateType($this->getConfigInstance()->readConfig("code_template_type"));
+
+ // Load the special template
+ $this->loadTemplate($template);
+ }
+
+ /**
+ * Compile all variables by inserting their respective values
+ *
+ * @return void
+ */
+ public final function compileVariables () {
+ // Initialize the $content array
+ $validVar = $this->getConfigInstance()->readConfig("tpl_valid_var");
+ $dummy = array();
+
+ // Iterate through all variables
+ for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) {
+ // Get current variable from the stack
+ $currVariable = $idx->current();
+
+ // Transfer it's name/value combination to the $content array
+ $dummy[$currVariable['name']] = $currVariable['value'];
+ }
+ $$validVar = $dummy;
+
+ // Prepare all configuration variables
+ $config = $this->configVariables;
+
+ // Remove some variables
+ unset($idx);
+ unset($currVariable);
+
+ // Prepare the eval() command for comiling the template
+ $eval = sprintf("\$this->setCompiledData(\"%s\");",
+ addslashes($this->getRawTemplateData())
+ );
+
+ // Debug message
+ if (((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
+ $this->__toString(),
+ htmlentities($eval)
+ ));
+
+ // Run the constructed command. This will "compile" all variables in
+ eval($eval);
+ }
+
+ /**
+ * Compile all required templates into the current loaded one
+ *
+ * @return void
+ * @throws UnexpectedTemplateTypeException If the template type is
+ * not "code"
+ * @throws InvalidArrayCountException If an unexpected array
+ * count has been found
+ */
+ public final function compileTemplate () {
+ // We will only work with template type "code" from configuration
+ if ($this->getTemplateType() != $this->getConfigInstance()->readConfig("code_template_type")) {
+ // Abort here
+ throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->readConfig("code_template_type")), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED);
+ }
+
+ // Get the raw data. Thanks to Flobee(R) for given me a hint using the
+ // modifier "m" in regular expressions. I had implemented a regex here
+ // like this: (\n|\r)
+ $rawData = $this->getRawTemplateData();
+
+ // Remove double spaces and trim leading/trailing spaces
+ $rawData = trim(str_replace(" ", " ", $rawData));
+
+ // Search for raw variables
+ $this->extractVariablesFromRawData($rawData);
+
+ // Search for code-tags which are {? ?}
+ @preg_match_all($this->regExpCodeTags, $rawData, $templateMatches);
+
+ // Analyze the matches array
+ if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) {
+ // Entries are found:
+ //
+ // The main analysis
+ $this->analyzeTemplate($templateMatches);
+
+ // Compile raw template data
+ $this->compileRawTemplateData($templateMatches);
+
+ // Are there some raw templates left for loading?
+ $this->loadExtraRawTemplates();
+
+ // Are some raw templates found and loaded?
+ if (count($this->rawTemplates) > 0) {
+ die("NOT YET IMPLEMENTED");
+ }
+ } // END - if($templateMatches ...
+ }
+
+ /**
+ * Output the compiled page to the outside world. In case of web templates
+ * this would be vaild (X)HTML code. And in case of email templates this
+ * would store a prepared email body inside the template engine.
+ *
+ * @return void
+ */
+ public final function output () {
+ // Check which type of template we have
+ switch ($this->getTemplateType()) {
+ case "html": // Raw HTML templates can be send to the output buffer
+ // Quick-N-Dirty:
+ $this->getWebOutputInstance()->output($this->getCompiledData());
+ break;
+
+ default: // Unknown type found
+ if ((is_object($this->getDebugInstance())) && (method_exists($this->getDebugInstance(), 'output'))) {
+ // Use debug output handler
+ $this->getDebugInstance()->output(sprintf("[%s:] Unbekannter Template-Typ <strong>%s</strong> erkannt.",
+ $this->__toString(),
+ $this->getTemplateType()
+ ));
+ die();
+ } else {
+ // Put directly out
+ // DO NOT REWRITE THIS TO app_die() !!!
+ die(sprintf("[%s:] Unbekannter Template-Typ <strong>%s</strong> erkannt.",
+ $this->__toString(),
+ $this->getTemplateType()
+ ));
+ }
+ break;
+ }
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An abstract middleware class for all other middlware classes
+ */
+class BaseMiddleware extends BaseFrameworkSystem {
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct ($class) {
+ // Call parent constructor
+ parent::constructor($class);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ }
+
+ /**
+ * Public constructor
+ *
+ * @return void
+ */
+ public function constructor ($class) {
+ // Just call the private constructor
+ $this->__construct($class);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Kompressor-Auswahl Klasse
+class CompressorChannel extends BaseMiddleware {
+ // Output handler instance
+ private $compressor = null;
+
+ // Public constructor
+ private function __construct () {
+ // Call parent constructor!
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Komprimierungshandler");
+
+ // Create an unique ID
+ $this->createUniqueID();
+ }
+
+ // Create a new compressor channel based a given compression handler
+ public final static function createCompressorChannel ($baseDir) {
+ // Get new instance
+ $cInstance = new CompressorChannel();
+
+ // Is the compressor handler set?
+ if (
+ (is_null($cInstance->getCompressor()))
+ || (!is_object($cInstance->getCompressor()))
+ || (!method_exists($cInstance->getCompressor(), 'compressStream'))
+ || (!method_exists($cInstance->getCompressor(), 'decompressStream'))
+ ) {
+ // Get a directory pointer
+ $dirPointer = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($baseDir);
+
+ // Read all directories but no sub directories
+ while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess"))) {
+ // Is this a class file?
+ if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == $cInstance->getConfigInstance()->readConfig("php_extension"))) {
+ // Get the compressor's name. That's why you must name
+ // your files like your classes and also that's why you
+ // must keep on class in one file.
+ $class = substr($dir, 6, -4);
+
+ // Create eval command
+ $eval = sprintf("\$tempInstance = %s::create%s();",
+ $class,
+ $class
+ );
+
+ // Debug message
+ if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
+ $cInstance->__toString(),
+ htmlentities($eval)
+ ));
+
+ // Run it. This will create an instance to the current class
+ eval($eval);
+
+ // Is the instance valid? We have the stream handler here
+ if ((!is_null($tempInstance)) && (method_exists($tempInstance, 'compressStream')) && (method_exists($tempInstance, 'decompressStream'))) {
+ // Okay, this handler is valid
+ $cInstance->setCompressor($tempInstance);
+
+ // No more searches required because we have found a valid compressor stream
+ break;
+ }
+ }
+ }
+
+ // Close the directory
+ $dirPointer->closeDirectory();
+ }
+
+ // Check again if there is a compressor
+ if (
+ (is_null($cInstance->getCompressor()))
+ || (!is_object($cInstance->getCompressor()))
+ || (!method_exists($cInstance->getCompressor(), 'compressStream'))
+ || (!method_exists($cInstance->getCompressor(), 'decompressStream'))
+ ) {
+ // Set the null compressor handler
+ $cInstance->setCompressor(NullCompressor::createNullCompressor());
+ }
+
+ // Return the compressor instance
+ return $cInstance;
+ }
+
+ /**
+ * Getter for compressor instance
+ *
+ * @return $compressor The compressor instance
+ */
+ public final function getCompressor () {
+ return $this->compressor;
+ }
+
+ /**
+ * Setter for compressor
+ *
+ * @param $compressorInstance The compressor instance we shall use
+ * @return void
+ */
+ public final function setCompressor (Compressor $compressorInstance) {
+ $this->compressor = $compressorInstance;
+ }
+
+ /**
+ * Getter for the file extension of the current compressor
+ */
+ public final function getCompressorExtension () {
+ // Get compressor extension from current compressor
+ return $this->getCompressor()->getCompressorExtension();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+
+// Database selector class
+class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, LimitableObject {
+ // Array for connection data
+ private $connectData = array();
+
+ // The real database layer
+ private $dbLayer = null;
+
+ // An instance of this class
+ private static $thisInstance = null;
+
+ // Private constructor
+ private final function __construct() {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Datenbank-Mittelschicht");
+
+ // Create an unique ID
+ $this->createUniqueID();
+
+ // Clean up a little
+ $this->removeSystemArray();
+ }
+
+ // Create new database connection layer
+ public final static function createDatabaseConnection (DebugMiddleware $debugInstance, DatabaseFrontendInterface $dbLayer) {
+ // Get instance
+ $dbInstance = new DatabaseConnection();
+
+ // Set debug output handler
+ $dbInstance->setDebugInstance($debugInstance);
+
+ // Set database layer
+ $dbInstance->setDatabaseLayer($dbLayer);
+
+ // Set db instance
+ self::$thisInstance = $dbInstance;
+
+ // Return instance
+ return $dbInstance;
+ }
+
+ // Get an instance of this class
+ public final static function getInstance () {
+ return self::$thisInstance;
+ }
+
+ // Public setter for database connection
+ public final function setConnectionData ($login, $pass, $dbase, $host) {
+ // Transfer connection data
+ $this->connectData['login'] = (string) $login;
+ $this->connectData['pass'] = (string) $pass;
+ $this->connectData['dbase'] = (string) $dbase;
+ $this->connectData['host'] = (string) $host;
+ }
+
+ /**
+ * Save a whole object or parts of it to the database or local file
+ *
+ * @param $object The object we shall save
+ * @return void
+ * @throws NullPointerException If $limitInstance is null
+ * @throws NoObjectException If $limitInstance is not an object
+ * @throws MissingMethodException If the required method
+ * saveObject() was not found
+ */
+ public final function saveObject ($object) {
+ // Some sanity checks
+ if (is_null($this->dbLayer)) {
+ // Is null
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($this->dbLayer)) {
+ // Is not an object
+ throw new NoObjectException($this->dbLayer, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($this->dbLayer, 'saveObject')) {
+ // Does not have the required instance
+ throw new MissingMethodException(array($this->dbLayer, 'saveObject'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // For now just pipe it through to the database layer
+ $this->dbLayer->saveObject($object);
+ }
+
+ /**
+ * Set a limitation for the saving process. This shall be done before
+ * saveObject() is called else saveObject() shall save the whole object.
+ *
+ * @param $limitInstance An instance of ObjectLimits which contains
+ * elements we shall exclusivly include in
+ * saving process
+ * @return void
+ * @throws NullPointerException If $limitInstance is null
+ * @throws NoObjectException If $limitInstance is not an object
+ * @throws MissingMethodException If the required method
+ * limitObject() was not found
+ */
+ public final function limitObject (ObjectLimits $limitInstance) {
+ // Get real database connection
+ $this->dbLayer = $this->getDatabaseInstance();
+
+ // Some sanity checks
+ if (is_null($this->dbLayer)) {
+ // Is null
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($this->dbLayer)) {
+ // Is not an object
+ throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($this->dbLayer, 'limitObject')) {
+ // Does not have the required instance
+ throw new MissingMethodException(array($this->dbLayer, 'limitObject'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // For now we pipe this through to the real database instance
+ $this->dbLayer->limitObject($limitInstance);
+ }
+
+ /**
+ * Analyses if a unique ID has already been used or not. This method does
+ * only pass the given ID through to the "real" database layer.
+ *
+ * @param $uniqueID A unique ID number which shall be checked
+ * before it will be used
+ * @param $inConstructor If called from a constructor or from
+ * somewhere else
+ * @return $isUnused true = The unique ID was not found in the database,
+ * false = It is already in use by an other object
+ * @throws NullPointerException If $this->dbLayer is null
+ * @throws NoObjectException If $this->dbLayer is not an object
+ * @throws MissingMethodException If the required method
+ * isUniqueIdUsed() was not found
+ */
+ public final function isUniqueIdUsed ($uniqueID, $inConstructor = false) {
+ // Some sanity checks
+ if (is_null($this->dbLayer)) {
+ // Is null
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($this->dbLayer)) {
+ // Is not an object
+ throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($this->dbLayer, 'isUniqueIdUsed')) {
+ // Does not have the required instance
+ throw new MissingMethodException(array($this->dbLayer, 'isUniqueIdUsed'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // Pass the returning result through
+ return $this->dbLayer->isUniqueIdUsed($uniqueID, $inConstructor);
+ }
+
+ /**
+ * Gets cached data from the database layer and if not found fetch it from
+ * the database again. This method does not return the header stuff because
+ * The underlaying database class will return only the requested content.
+ *
+ * @param $idNumber The ID number which we need for looking up
+ * the requested data
+ * @return $cachedArray The maybe cached data from the database
+ * @throws NullPointerException If $this->dbLayer is null
+ * @throws NoObjectException If $this->dbLayer is not an object
+ * @throws MissingMethodException If the required method
+ * isUniqueIdUsed() was not found
+ */
+ public final function getObjectFromCachedData ($idNumber) {
+ // Some sanity checks
+ if (is_null($this->dbLayer)) {
+ // Is null
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($this->dbLayer)) {
+ // Is not an object
+ throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($this->dbLayer, 'getObjectFromCachedData')) {
+ // Does not have the required instance
+ throw new MissingMethodException(array($this->dbLayer, 'getObjectFromCachedData'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // Pass the returning result through
+ return $this->dbLayer->getObjectFromCachedData($idNumber);
+ }
+
+ /**
+ * Setter for the real database layer
+ * @param $dbLayer An instance of the real database layer
+ * @return void
+ */
+ public final function setDatabaseLayer (DatabaseFrontendInterface $dbLayer) {
+ $this->dbLayer = $dbLayer;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The middlware debug output system. A *real* or concrete output class shall
+ * become registered with this middleware because the back-fall class will
+ * become deprecated soon.
+ */
+class DebugMiddleware extends BaseMiddleware {
+ /**
+ * The concrete output instance
+ */
+ private $outputHandler = null;
+
+ /**
+ * An instance of this class
+ */
+ private static $thisInstance = null;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private final function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Debug-Ausgabe-Handler");
+
+ // Create an unique ID
+ $this->createUniqueID();
+
+ // Set own instance
+ self::$thisInstance = $this;
+ }
+
+ /**
+ * Create a new debug output system.
+ * If no output is given this class is currently being used for back-fall.
+ * This fall-back mechanism will become deprecated very soon.
+ *
+ * @param $debuggerClass The class name which we shall use for
+ * registering the *real* debug output
+ * @return $debugInstance An instance of this middleware class
+ */
+ public final static function createDebugMiddleware ($debuggerClass) {
+ // Create an instance if this middleware
+ $debugInstance = new DebugMiddleware();
+
+ // Is there a valid output handler provided?
+ if ((!is_null($debuggerClass)) && (is_object($debuggerClass)) && (method_exists($debuggerClass, 'outputStream'))) {
+ // Use the given output system
+ $debugInstance->setOutputHandler($debuggerClass);
+ } elseif ((!is_null($debuggerClass)) && (is_string($debuggerClass)) && (class_exists($debuggerClass))) {
+ // A name for a debug output class has been provided so we try to get it
+ $eval = sprintf("\$debuggerClass = %s::create%s();",
+ $debuggerClass,
+ $debuggerClass
+ );
+
+ // Run the constructed name
+ @eval($eval);
+
+ // Was this successfull?
+ if ((is_object($debuggerClass)) && (method_exists($debuggerClass, "outputStream"))) {
+ // Set this as output class
+ $debugInstance->setOutputHandler($debuggerClass);
+ } else {
+ // No object or method is missing use fall-back
+ throw new MissingMethodException(array($debuggerClass, 'outputStream'), self::EXCEPTION_MISSING_METHOD);
+ }
+ }
+
+ // Return instance
+ return $debugInstance;
+ }
+
+ /**
+ * Getter for an instance of this class
+ *
+ * @return $thisInstance An instance of this class
+ */
+ public final static function getInstance() {
+ return self::$thisInstance;
+ }
+
+ /**
+ * Setter for output handler
+ *
+ * @return void
+ */
+ public final function setOutputHandler ($outputHandler) {
+ $this->outputHandler = $outputHandler;
+ }
+
+ /**
+ * This method shall send debug output which can be HTML code for the
+ * browser or debug lines for a log file, etc. to the registered debug
+ * output handler.
+ *
+ * @return void
+ */
+ public final function output ($outStream) {
+ // Check if the output handler is valid
+ if (is_null($this->outputHandler)) {
+ // Debug output handler was not set
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($this->outputHandler)) {
+ // The debug output handler is not an object
+ throw new NoObjectException($this->ouputHandler, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($this->outputHandler, 'outputStream')) {
+ // The required method outputStream() is missing
+ throw new MissingMethodException(array($this->outputHandler, 'outputStream'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // Is the output stream set
+ if (empty($outStream)) {
+ // Initialization phase
+ return;
+ }
+
+ // Use the output handler
+ $this->outputHandler->outputStream($outStream);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This is a file IO handler. It handles reading from and writing to files.
+ * Missing paths in writing process will be automatically created.
+ */
+class FileIOHandler extends BaseMiddleware {
+ /**
+ * The *real* file input class we shall use for reading data
+ */
+ private $inputStream = null;
+
+ /**
+ * The *real* file output class we shall use for reading data
+ */
+ private $outputStream = null;
+
+ /**
+ * An instance of this class
+ */
+ private static $thisInstance = null;
+
+ /**
+ * Private constructor
+ *
+ * @return void
+ */
+ private function __construct () {
+ // Call parent constructor
+ parent::constructor(__CLASS__);
+
+ // Set description
+ $this->setPartDescr("Datei-Ein-/Ausgabe-Handler");
+
+ // Create an unique ID
+ $this->createUniqueID();
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+
+ // Set own instance
+ self::$thisInstance = $this;
+ }
+
+ /**
+ * Creates an instance of this class and prepares the IO system. This is
+ * being done by setting the default file IO class
+ *
+ * @return $ioInstance A prepared instance of FilIOHandler
+ */
+ public final static function createFileIOHandler () {
+ // Get instance
+ $ioHandler = new FileIOHandler();
+
+ // Set the *real* file IO instances (both the same)
+ $ioHandler->setInputStream(FileIOStream::createFileIOStream());
+ $ioHandler->setOutputStream(FileIOStream::createFileIOStream());
+
+ // Return instance
+ return $ioHandler;
+ }
+
+ /**
+ * Getter for an instance of this class
+ *
+ * @return $thisInstance An instance of this class
+ */
+ public final static function getInstance () {
+ return self::$thisInstance;
+ }
+
+ /**
+ * Setter for the *real* file input instance
+ *
+ * @param $inputStream The *real* file-input class
+ */
+ public final function setInputStream (FileInputStreamer $inputStream) {
+ $this->inputStream = $inputStream;
+ }
+
+ /**
+ * Getter for the *real* file input instance
+ *
+ * @return $inputStream The *real* file-input class
+ */
+ public final function getInputStream () {
+ return $this->inputStream;
+ }
+
+ /**
+ * Setter for the *real* file output instance
+ *
+ * @param $outputStream The *real* file-output class
+ */
+ public final function setOutputStream (FileOutputStreamer $outputStream) {
+ $this->outputStream = $outputStream;
+ }
+
+ /**
+ * Getter for the *real* file output instance
+ *
+ * @return $outputStream The *real* file-output class
+ */
+ public final function getOutputStream () {
+ return $this->outputStream;
+ }
+
+ /**
+ * Saves a file with data by using the current output stream
+ *
+ * @see FileOutputStreamer
+ */
+ public function saveFile ($fileName, $dataArray) {
+ // Get output stream
+ $outInstance = $this->getOutputStream();
+
+ // Is it a valid stream?
+ if (is_null($outInstance)) {
+ // No class returned
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($outInstance)) {
+ // Not an object! ;-(
+ throw new NoObjectException($outInstance, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($outInstance, 'saveFile')) {
+ // Nope, so throw exception
+ throw new MissingMethodException(array($outInstance, 'saveFile'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // Send the fileName and dataArray to the output handler
+ $outInstance->saveFile($fileName, $dataArray);
+ }
+
+ /** Loads data from a file over the input handler
+ *
+ * @see FileInputStreamer
+ */
+ public function loadFileContents ($fqfn) {
+ // Initialize the array
+ $array = array();
+
+ // Get output stream
+ $inInstance = $this->getInputStream();
+
+ // Is it a valid stream?
+ if (is_null($inInstance)) {
+ // No class returned
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } elseif (!is_object($inInstance)) {
+ // Not an object! ;-(
+ throw new NoObjectException($inInstance, self::EXCEPTION_IS_NO_OBJECT);
+ } elseif (!method_exists($inInstance, 'loadFileContents')) {
+ // Nope, so throw exception
+ throw new MissingMethodException(array($inInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD);
+ }
+
+ // Read from the input handler
+ return $inInstance->loadFileContents($fqfn);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Load the class from inc/config direktory
+@require_once(dirname(__FILE__) . "/config/class_FrameworkConfiguration.php");
+
+// Get a new configuration instance
+$cfg = FrameworkConfiguration::createFrameworkConfiguration();
+
+// CFG: SERVER-PATH
+$cfg->definePath(dirname(dirname(__FILE__)) . "/"); // DON'T MISS THE TRAILING SLASH!!!
+
+// CFG: DATABASE-TYPE
+$cfg->defineDatabaseType("local");
+
+// CFG: TIME-ZONE
+$cfg->setDefaultTimezone("Europe/Berlin");
+
+// CFG: MAGIC-QUOTES-RUNTIME
+$cfg->setMagicQuotesRuntime(false);
+
+// CFG: PHP-SCRIPT-EXTENSION
+$cfg->setConfigEntry("php_extension", ".php");
+
+// CFG: CLASS-PREFIX
+$cfg->setConfigEntry("class_prefix", "class_");
+
+// CFG: CLASS-SUFFIX
+$cfg->setConfigEntry("class_suffix", ".php");
+
+// CFG: RAW-TEMPLATE-EXTENSION
+$cfg->setConfigEntry("raw_template_extension", ".tpl");
+
+// CFG: CODE-TEMPLATE-EXTENSION
+$cfg->setConfigEntry("code_template_extension", ".ctp");
+
+// CFG: SELECTOR-GET
+$cfg->setConfigEntry("app_selector_get", "app");
+
+// CFG: APPLICATION-HELPER
+$cfg->setConfigEntry("app_helper_class", "ApplicationHelper");
+
+// CFG: SELECTOR-PATH
+$cfg->setConfigEntry("selector_path", "selector");
+
+// CFG: TEMPLATE-BASE-PATH
+$cfg->setConfigEntry("tpl_base_path", "templates/"); // DON'T MISS THE TRAILING SLASH!
+
+// CFG: LANGUAGE-BASE-PATH
+$cfg->setConfigEntry("lang_base_path", "inc/language/"); // DON'T MISS THE TRAILING SLASH!
+
+// CFG: COMPRESSOR-BASE-PATH
+$cfg->setConfigEntry("compressor_base_path", "inc/classes/main/compressor/"); // DON'T MISS THE TRAILING SLASH!
+
+// CFG: APPLICATION-PATH
+$cfg->setConfigEntry("application_path", "application");
+
+// CFG: COMPILE-OUTPUT-PATH
+$cfg->setConfigEntry("compile_output_path", "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH!
+
+// CFG: TEMPLATE-ENGINE
+$cfg->setConfigEntry("tpl_engine", "TemplateEngine");
+
+// CFG: DEBUG-ENGINE
+$cfg->setConfigEntry("debug_engine", "DebugWebOutput");
+
+// CFG: DEFAULT-LANGUAGE
+$cfg->setConfigEntry("default_lang", "de"); // A two-char language string: de for german, en for english and so on
+
+// CFG: WEB-TEMPLATE-TYPE
+$cfg->setConfigEntry("web_template_type", "html");
+
+// CFG: EMAIL-TEMPLATE-TYPE
+$cfg->setConfigEntry("email_template_type", "emails");
+
+// CFG: CODE-TEMPLATE-TYPE
+$cfg->setConfigEntry("code_template_type", "code");
+
+// CFG: WEB-ENGINE
+$cfg->setConfigEntry("web_engine", "WebOutput");
+
+// CFG: SELECTOR-TEMPLATE-PREFIX
+$cfg->setConfigEntry("tpl_selector_prefix", "selector");
+
+// CFG: WEB-CONTENT-TYPE
+$cfg->setConfigEntry("web_content_type", "text/html");
+
+// CFG: VALID-TEMPLATE-VARIABLE
+$cfg->setConfigEntry("tpl_valid_var", "content");
+
+// CFG: META-AUTHOR
+$cfg->setConfigEntry("meta_author", "Roland Häder");
+
+// CFG: META-PUBLISHER
+$cfg->setConfigEntry("meta_publisher", "Roland Häder");
+
+// CFG: META-KEYWORDS
+$cfg->setConfigEntry("meta_keywords", "test,test,test");
+
+// CFG: META-DESCRIPTION
+$cfg->setConfigEntry("meta_description", "A lame description for an application framework");
+
+// CFG: LAUNCH-METHOD
+$cfg->setConfigEntry("entry_method", "entryPoint");
+
+// CFG: SELECTOR-MAIN-TEMPLATE
+$cfg->setConfigEntry("selector_main_tpl", "selector_main");
+
+// CFG: SELECTOR-APPS-TEMPLATE
+$cfg->setConfigEntry("selector_apps_tpl", "selector_apps");
+
+// CFG: SELECTOR-NAME
+$cfg->setConfigEntry("selector_name", "selector");
+
+// CFG: DEFAULT-APPLICATION
+$cfg->setConfigEntry("default_application", "selector");
+
+// CFG: VERBOSE-LEVEL
+$cfg->setConfigEntry("verbose_level", 0);
+
+// Shall we include config-local.php where you can configure some things? Then
+// We need to do some things:
+//
+// First generate FQFN
+$localConfig = sprintf("%sinc/config-local%s", PATH, $cfg->readConfig("php_extension"));
+
+// Second is the file there and readable?
+if ((file_exists($localConfig)) && (is_readable($localConfig))) {
+ // The third step to load it
+ require_once($localConfig);
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class for the configuration stuff implemented in a singleton design paddern
+ *
+ * NOTE: We cannot put this in inc/classes/ because it would be loaded (again)
+ * in the class loader. See inc/loader/class_ClassLoader.php for instance
+ *
+ * @see ClassLoader
+ */
+class FrameworkConfiguration {
+ /**
+ * Include files which shall be included before the main loader.
+ */
+ private $moreIncPre = null;
+
+ /**
+ * Include files which shall be included after the main loader.
+ */
+ private $moreIncPost = null;
+
+ /**
+ * The framework's main configuration array which will be initialized with
+ * hard-coded configuration data and might be overwritten/extended by
+ * config data from the database.
+ */
+ private $config = array();
+
+ /**
+ * The configuration instance itself
+ */
+ private static $cfgInstance = null;
+
+ // Some constants for the configuration system
+ const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0xc00;
+ const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0xc01;
+
+ /**
+ * Private constructor
+ */
+ private function __construct () {
+ // Initialize both include lists
+ $this->moreIncPre = new ArrayObject();
+ $this->moreIncPost = new ArrayObject();
+ }
+
+ /**
+ * "Create" a configuration instance
+ */
+ public final static function createFrameworkConfiguration ($enableDebug = false) {
+ /**
+ * For singleton design pattern because we only need a one-time-run
+ * through the initial configuration.
+ */
+ if (is_null(self::$cfgInstance)) {
+ // CFG: DEBUG-LEVEL
+ @error_reporting(E_ALL | E_STRICT);
+
+ /**
+ * Shall we enable the debug mode?
+ */
+ if ($enableDebug) {
+ define('DEBUG_MODE', true);
+ }
+
+ /**
+ * Crate a config instance
+ */
+ self::$cfgInstance = new FrameworkConfiguration();
+ }
+
+ /**
+ * Return the instance
+ */
+ return self::$cfgInstance;
+ }
+
+ /**
+ * Getter for an instance of this class
+ *
+ * @return $cfgInstance An instance of this class
+ */
+ public final static function getInstance () {
+ return self::$cfgInstance;
+ }
+
+ /**
+ * Setter for default time zone (must be correct!)
+ *
+ * @param $zone The time-zone string (e.g. Europe/Berlin)
+ * @return void
+ */
+ public final function setDefaultTimezone ($zone) {
+ // At least 5.1.0 is required for this!
+ if (version_compare(phpversion(), "5.1.0")) {
+ @date_default_timezone_set($zone);
+ }
+ }
+
+ /**
+ * Setter for runtime magic quotes
+ */
+ public final function setMagicQuotesRuntime ($enableQuotes) {
+ // Cast it to boolean
+ $enableQuotes = (boolean) $enableQuotes;
+
+ // Set it
+ @set_magic_quotes_runtime($enableQuotes);
+ }
+
+ /**
+ * A private include loader
+ *
+ * @param $arrayObject The array object with all include files
+ * @return void
+ */
+ private function loadIncludes (ArrayObject $arrayObject) {
+ // Load only if there are includes defined
+ if (!is_null($arrayObject)) {
+ for ($idx = $arrayObject->getIterator(); $idx->valid(); $idx->next()) {
+ // Get include file
+ $inc = $idx->current();
+
+ // Is the file name really set?
+ if (!empty($inc)) {
+ // Base path added? (Uni* / Windows)
+ if ((substr($inc, 0, 1) != "/") && (substr($inc, 1, 1) != ":")) {
+ // Generate FQFN
+ $fqfn = sprintf("%s/inc/extra/%s", PATH, $inc);
+ } else {
+ // Base path is already added
+ $fqfn = $inc;
+ }
+ }
+
+ // Include them all here
+ require($fqfn);
+ }
+ }
+ }
+
+ /**
+ * Load all includes before main loader and clears the array after usage
+ *
+ * @return void
+ */
+ public function loadPreIncludes () {
+ $this->loadIncludes($this->moreIncPre);
+ unset($this->moreIncPre);
+ }
+
+ /**
+ * Load all includes after main loader and clears the array after usage
+ *
+ * @return void
+ */
+ public function loadPostIncludes () {
+ $this->loadIncludes($this->moreIncPost);
+ unset($this->moreIncPost);
+ }
+
+ /**
+ * Define the database type which must be valid and will not be verified.
+ *
+ * @param $type The database type. See path inc/database/.
+ * @return void
+ */
+ public function defineDatabaseType ($type) {
+ // Is it defined or not?
+ if (!defined('_DB_TYPE')) {
+ // Cast to string
+ $type = (string) $type;
+
+ // Set the constant
+ define('_DB_TYPE', $type);
+ } else {
+ // Already defined! But we cannot throw an exception here... :(
+ ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the database type only once in your application!",
+ __CLASS__
+ ));
+ }
+ }
+
+ /**
+ * Define the local file path
+ *
+ * @param $path The database type. See path inc/database/.
+ * @return void
+ */
+ public function definePath ($path) {
+ // Cast to string
+ $path = (string) $path;
+
+ // Is it defined or not?
+ if (!is_dir($path)) {
+ // Is not a valid path
+ ApplicationEntryPoint::app_die(sprintf("[%s:] Invalid path (not found) specified. Please make sure it is created.",
+ __CLASS__
+ ));
+ } elseif (!defined('PATH')) {
+ // Set the constant
+ define('PATH', $path);
+ } else {
+ // Already defined! But we cannot throw an exception here... :(
+ ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the local file path only once in your application.",
+ __CLASS__
+ ));
+ }
+ }
+
+ /**
+ * Read a configuration element.
+ *
+ * @param $cfgEntry The configuration element
+ * @return $cfgValue The fetched configuration value
+ * @throws ConfigEntryIsEmptyException If $cfgEntry is empty
+ * @throws ConfigEntryNotFoundException If a configuration element
+ * was not found
+ */
+ public function readConfig ($cfgEntry) {
+ // Cast to string
+ $cfgEntry = (string) $cfgEntry;
+
+ // Is a valid configuration entry provided?
+ if (empty($cfgEntry)) {
+ // Entry is empty
+ throw new ConfigEntryIsEmptyException(__CLASS__, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY);
+ } elseif (!isset($this->config[$cfgEntry])) {
+ // Entry was not found!
+ throw new ConfigEntryNotFoundException(array(__CLASS__, $cfgEntry), self::EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND);
+ }
+
+ // Debug message
+ if ((defined('DEBUG_CONFIG')) || (defined('DEBUG_ALL'))) {
+ echo "[".__METHOD__."] Configuration entry ".$cfgEntry." requested.<br />\n";
+ }
+
+ // Return the requested value
+ return $this->config[$cfgEntry];
+ }
+
+ /**
+ * Set a configuration entry.
+ *
+ * @param $cfgEntry The configuration entry we want to add/change
+ * @param $cfgValue The configuration value we want to set
+ * @return void
+ * @throws ConfigEntryIsEmptyException If $cfgEntry is empty
+ */
+ public final function setConfigEntry ($cfgEntry, $cfgValue) {
+ // Cast to string
+ $cfgEntry = (string) $cfgEntry;
+ $cfgValue = (string) $cfgValue;
+
+ // Is a valid configuration entry provided?
+ if (empty($cfgEntry)) {
+ // Entry is empty
+ throw new ConfigEntryIsEmptyException(__CLASS__, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY);
+ }
+
+ // Set the configuration value
+ $this->config[$cfgEntry] = $cfgValue;
+
+ // Resort the array
+ ksort($this->config);
+ }
+
+ /**
+ * Compatiblity method to return this class' name
+ *
+ * @return __CLASS__ This class' name
+ */
+ public function __toString () {
+ return get_class($this);
+ }
+} // END - class
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Initialize layer
+$layer = null;
+
+// Is the type defined?
+if (!defined('_DB_TYPE')) {
+ // Abort here
+ ApplicationEntryPoint::app_die("[Main:] Please define a database type first!<br />
+E.g.:<pre>$GLOBALS['cfg']->defineDatabaseType("local");</pre>
+This will choose the local-file-based database type (layer)");
+}
+
+// Generate FQFN for the database layer
+$INC = sprintf("%sinc/database/lib-%s%s", PATH, _DB_TYPE, FrameworkConfiguration::getInstance()->readConfig("php_extension"));
+
+// Load the database layer include
+if ((file_exists($INC)) && (is_file($INC)) && (is_readable($INC))) {
+ // Load the layer
+ require_once($INC);
+} else {
+ // Layer is missing!
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer is missing! (%s) -> R.I.P.",
+ _DB_TYPE
+ ));
+}
+
+// Clean it up
+unset($INC);
+
+// Prepare database instance
+try {
+ $db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layer);
+} catch (NullPointerException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (InvalidDirectoryResourceException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (PathIsEmptyException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (PathIsNoDirectoryException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (PathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (DirPointerNotOpenedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// Datenbankobjekt debuggen
+if (defined('DEBUG_DATABASE_OBJ')) {
+ DebugMiddleware::getInstance()->output(sprintf("Die Datenbank-Schicht sieht wie folgt aus:<br />
+<pre>%s</pre>\n",
+ print_r($db, true)
+ ));
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// 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: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (SavePathNotFoundException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (SavePathIsNoDirectoryException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (SavePathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+} catch (SavePathWriteProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Debug-Instanz konnte nicht gesetzt werden. Reason: <strong>%s</strong><br />\n",
+ $e->getMessage()
+ ));
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+// Initialize the file I/O handler. Currently there is no need to check if
+// the initialization was successfull or not because only some class
+// instances will we generated.
+$io = FileIOHandler::createFileIOHandler();
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * 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]
+?>
--- /dev/null
+<?php
+/**
+ * Try to initializes the language system
+ */
+try {
+ $lang = LanguageSystem::createLanguageSystem(sprintf("%s%s",
+ PATH,
+ FrameworkConfiguration::getInstance()->readConfig("lang_base_path")
+ ));
+} catch (LanguagePathIsEmptyException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+} catch (InvalidLanguagePathStringException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+} catch (LanguagePathIsNoDirectoryException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+} catch (LanguagePathReadProtectedException $e) {
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This class loads class include files with a specific prefix and suffix
+ *
+ * @author Roland Haeder <roland __NOSPAM__ [at] __REMOVE_ME__ mxchange [dot] org>
+ * @version 1.1
+ *
+ * ----------------------------------
+ * 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:] <strong>%d</strong> Klassendateien in <strong>%d</strong> Verzeichnissen gefunden und geladen.<br />\n",
+ __CLASS__,
+ $this->classCnt,
+ $this->dirCnt
+ ));
+ }
+
+ /**
+ * Includes all found classes
+ * @return void
+ */
+ public function includeAllClasses () {
+ if (is_object($this->classes)) {
+ // Load all classes
+ for ($idx = $this->classes->getIterator(); $idx->valid(); $idx->next()) {
+ // Load current class
+ //* DEBUG: */ print "Class=".$idx->current()."\n";
+ require_once($idx->current());
+ }
+
+ // Re-initialize the classes list
+ $this->classes = new ArrayObject();
+ }
+ }
+}
+
+// Initial load of core classes and the FrameworkDirectoryPointer class
+require_once(sprintf("%sinc/classes/interfaces/class_FrameworkInterface%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension")));
+require_once(sprintf("%sinc/classes/main/class_BaseFrameworkSystem%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension")));
+require_once(sprintf("%sinc/classes/main/io/class_FrameworkDirectoryPointer%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension")));
+
+// Initialize the class loader
+$loader = new ClassLoader(FrameworkConfiguration::getInstance());
+
+// [EOF]
+?>
--- /dev/null
+<?php
+
+// 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]
+?>
--- /dev/null
+<?php
+/**
+ * @desc The application selector main include file
+ */
+
+// Does the user has an application specified?
+if (!empty($_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")])) {
+ // Set the application from string
+ $application = (string) $_GET[FrameworkConfiguration::getInstance()->readConfig("app_selector_get")];
+} elseif (!empty($_SERVER['argv'][1])) {
+ // Set the application from string
+ $application = (string) $_SERVER['argv'][1];
+ $app = explode("=", trim($application));
+ if ($app[0] == FrameworkConfiguration::getInstance()->readConfig("app_selector_get")) {
+ // Application is valid!
+ $application = trim($app[1]);
+ } else {
+ // Invalid entry found, first must be "app"!
+ $application = FrameworkConfiguration::getInstance()->readConfig("default_application");
+ }
+} else {
+ // Set the "application selector" application
+ $application = FrameworkConfiguration::getInstance()->readConfig("default_application");
+}
+
+// Secure it, by keeping out tags
+$application = htmlentities(strip_tags($application), ENT_QUOTES);
+
+// Secure it a little more with a reg.exp.
+$application = preg_replace('/([^a-z_-])+/i', "", $application);
+
+// Try to load these includes in the given order
+$configAppIncludes = array(
+ sprintf("class_%s", FrameworkConfiguration::getInstance()->readConfig("app_helper_class")), // The ApplicationHelper class
+ "config", // The application's own configuration
+ "init", // The application initializer
+ "loader", // The application's class loader
+ "debug", // Some debugging stuff
+ "exceptions", // The application's own exception handler
+ "starter", // The application starter (calls entryPoint(), etc.)
+);
+
+// Load them all (try only)
+foreach ($configAppIncludes as $inc) {
+ // Skip starter in test mode
+ if (($inc == "starter") && (defined('TEST'))) {
+ // Skip it here
+ continue;
+ }
+
+ // Generate a FQFN for the helper class
+ $fqfn = sprintf("%s%s/%s/%s%s",
+ PATH,
+ FrameworkConfiguration::getInstance()->readConfig("application_path"),
+ $application,
+ $inc,
+ FrameworkConfiguration::getInstance()->readConfig("php_extension")
+ );
+
+ // Does the include file exists?
+ if ((file_exists($fqfn)) && (is_file($fqfn)) && (is_readable($fqfn))) {
+ // Load it
+ require_once($fqfn);
+ } elseif (FrameworkConfiguration::getInstance()->readConfig("verbose_level") > 0) {
+ // File is missing
+ trigger_error(sprintf("Cannot load application script %s! File is missing or read-protected.",
+ $inc . FrameworkConfiguration::getInstance()->readConfig("php_extension")
+ ));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * The main class with the entry point to the whole application. This class
+ * "emulates" Java(tm)'s entry point call. Additionally it covers local
+ * variables from outside access to prevent possible attacks on uninitialized
+ * local variables.
+ *
+ * But good little boys and girls would always initialize their variables... ;-)
+ */
+class ApplicationEntryPoint {
+ /**
+ * The instances we want to remove after all is done
+ *
+ * @return void
+ */
+ private static $instances = array (
+ 'cfg', // The configuration system
+ 'loader', // The class loader system
+ 'debug', // Debug output
+ 'db', // Database layer
+ 'io', // Base I/O system (local file [or network])
+ 'engine', // Template engine ( for ApplicationEntryPoint::app_die() )
+ 'lang', // Language sub-system
+ 'app', // The ApplicationHelper instance
+ );
+
+ /**
+ * The application's emergency exit
+ *
+ * @param $message The optional message we shall output on exit
+ * @return void
+ */
+ public static function app_die ($message = "") {
+ // Is a message set?
+ if (empty($message)) {
+ // No message provided
+ $message = "No message provided!";
+ }
+
+ // Get some instances
+ $tpl = FrameworkConfiguration::getInstance()->readConfig("tpl_engine");
+ $lang = LanguageSystem::getInstance();
+ $io = FileIOHandler::getInstance();
+
+ // Is the template engine loaded?
+ if ((class_exists($tpl)) && (is_object($lang)) && (is_object($io))) {
+ // Use the template engine for putting out (nicer look) the message
+ try {
+ $eval = sprintf("$tplEngine = %s::create%s(\"%s%s\", LanguageSystem::getInstance(), FileIOHandler::getInstance());",
+ FrameworkConfiguration::getInstance()->readConfig("tpl_engine"),
+ FrameworkConfiguration::getInstance()->readConfig("tpl_engine"),
+ PATH,
+ FrameworkConfiguration::getInstance()->readConfig("tpl_base_path")
+ );
+ eval($eval);
+ } catch (BasePathIsEmptyException $e) {
+ die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+ } catch (InvalidBasePathStringException $e) {
+ die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+ } catch (BasePathIsNoDirectoryException $e) {
+ die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+ } catch (BasePathReadProtectedException $e) {
+ die(sprintf("[Main:] Die Template-Engine konnte nicht initialisieren. Grund: <strong>%s</strong>",
+ $e->getMessage()
+ ));
+ }
+
+ // Assign message
+ $tplEngine->assignVariable("message", $message);
+
+ // Load the template
+ $tplEngine->loadCodeTemplate("emergency_exit");
+
+ // Compile the template
+ $tplEngine->compileTemplate();
+
+ // Compile all variables
+ $tplEngine->compileVariables();
+
+ // Output all
+ $tplEngine->output();
+
+ // Good bye...
+ exit();
+ } else {
+ // Output message and die
+ die(sprintf("[Main:] Emergency exit reached: <strong>%s</strong>",
+ $message
+ ));
+ }
+ }
+
+ /**
+ * The application's main entry point. This class isolates some local
+ * variables which shall not become visible to outside because of security
+ * concerns. We are doing this here to "emulate" the well-known entry
+ * point in Java(tm).
+ *
+ * @return void
+ */
+ public static function main () {
+ // Some non-global common arrays we need...
+ global $_SERVER;
+
+ // Load config file
+ require(dirname(__FILE__) . "/inc/config.php");
+
+ // Load all include files
+ require(PATH . "inc/includes.php");
+
+ // Load all framework classes
+ require(PATH . "inc/classes.php");
+
+ // Include the application selector
+ require(PATH . "inc/selector.php");
+
+ } // END - main()
+
+} // END - class
+
+// Do not remove the following line:
+ApplicationEntryPoint::main();
+
+// [EOF]
+?>
--- /dev/null
+#!/bin/sh
+
+echo "$0: Cleaning up..."
+find docs/html/ -type f -exec rm -f {} \;
+rm -f docs/*.log
+echo "$0: Done."
+
+doxygen Doxyfile
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<!-- A compileable template for emergency messages //-->
+
+{?header:title="Problem in application framework detected!"?}
+
+{?navigation:nav_row=home;imprint;contact?}
+
+ <div class="emergency_exit message_box">
+ $content[message]
+ </div>
+
+{?footer_msg:footer_msg="Please contact the support and supply the full above message, if you think you are not qualified to fix this problem."?}
--- /dev/null
+ <div class="footer_message message_box">
+ $content[footer_msg]
+ </div>
+
+</div> <!-- masterbox //-->
+
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+ <title>
+ $content[title]
+ </title>
+
+ <meta name="author" content="$config[meta_author]" />
+ <meta name="publisher" content="$config[meta_publisher]" />
+ <meta name="keywords" content="$config[meta_keywords]" />
+ <meta name="robots" content="index,follow" />
+ <meta name="description" content="$config[meta_description]" />
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+ <meta http-equiv="content-style-type" content="text/css" />
+ <meta http-equiv="content-script-type" content="text/javascript" />
+ <meta http-equiv="language" content="de" />
+</head>
+
+<body>
+<div class="masterbox">
--- /dev/null
+Deny from all