application/mxchange/.htaccess -text
application/mxchange/class_ApplicationHelper.php -text
application/mxchange/config.php -text
+application/mxchange/data.php -text
application/mxchange/debug.php -text
application/mxchange/exceptions.php -text
application/mxchange/exceptions/.htaccess -text
--- /dev/null
+<?php
+/**
+ * Application data
+ *
+ * Please remember that this include file is being loaded *before* the class
+ * loader is loading classes from "exceptions", "interfaces" and "main"!
+ *
+ * You can prevent adding this application to the selector by uncommenting the
+ * following line:
+ *
+ * if ((isset($this)) && (is_object($this)) && ($this->isClass("ApplicationSelector"))) { return; }
+ *
+ * isset() is required to prevent a warning and is_object() is highly required
+ * when the application itself is requested in URL (hint: index.php?app=your_app)
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// Get config instance
+$cfg = FrameworkConfiguration::getInstance();
+
+// Get an instance of the helper
+$app = call_user_func_array(
+ array($cfg->readConfig('app_helper_class'), "getInstance"),
+ array()
+);
+
+// Set application name and version
+$app->setAppName("MXChange Mail-Exchange");
+$app->setAppVersion("0.3.0");
+$app->setAppShortName("mxchange");
+
+// [EOF]
+?>
<?php
/**
- * Initialize some debug constants here
+ * Some debugging stuff for this application
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.ship-simu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+// Reederei-Objekt debuggen
+//define('DEBUG_COMPANY_OBJ', true);
+// Hafen-Objekt debuggen
+//define('DEBUG_HARBOR_OBJ', true);
+// Schiff-Objekt debuggen
+//define('DEBUG_SHIP_OBJ', true);
+// Auftrag-Objekt debuggen
+//define('DEBUG_CONTRACT_OBJ', true);
+// Haendler-Objekt debuggen
+//define('DEBUG_MERCHANT_OBJ', true);
+// Personal-Objekt debuggen
+//define('DEBUG_PERSONELL_OBJ', true);
+// Personal debuggen
+//define('DEBUG_PERSONELL', true);
+// Reederei debuggen
+//define('DEBUG_COMPANY', true);
+// Mitarbeiter debuggen
+//define('DEBUG_COMPANY_EMPLOYEE', true);
+// Hafen debuggen
+//define('DEBUG_HARBOR', true);
+// Werft debuggen
+//define('DEBUG_SHIPYARD', true);
+// Schiff debuggen
+//define('DEBUG_SHIP', true);
+// Schiffstruktur debuggen
+//define('DEBUG_STRUCTURE', true);
+// Kabinen debuggen
+//define('DEBUG_CABIN', true);
+// Decks debuggen
+//define('DEBUG_DECK', true);
+// Bauauftraege debuggen
+//define('DEBUG_CONTRACT', true);
+// Haendler debuggen
+//define('DEBUG_MERCHANT', true);
+
// [EOF]
?>
<?php
/**
- * Sets an application's own exception handle, by default the default one from
- * PHP will be used (as you have setupped in php.ini)
+ * The exception handler for this application
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.ship-simu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+// Our own exception handler
+function __exceptionHandler (FrameworkException $e) {
+ // Call the app_die() method
+ ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> (<span class=\"app_short_name\">%s</span>) has terminated due to a thrown exception: <span class=\"exception_name\">%s</span> <span class=\"exception_number\">[%s]</span>: <span class=\"debug_exception\">%s</span> Backtrace: <div class=\"debug_backtrace\">%s</div>",
+ ApplicationHelper::getInstance()->getAppName(),
+ ApplicationHelper::getInstance()->getAppShortName(),
+ $e->__toString(),
+ $e->getHexCode(),
+ $e->getMessage(),
+ $e->getPrintableBackTrace()
+ ),
+ $e->getHexCode(),
+ $e->getExtraData()
+ );
+} // END - function
+
// Set the new handler
-//set_exception_handler('selector_exception_handler');
+set_exception_handler('__exceptionHandler');
+
+// Error handler
+function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) {
+ // Construct the message
+ $message = sprintf("File: <span class=\"debug_file\">%s</span>, Line: <span class=\"debug_line\">%s</span>, Code: <span class=\"debug_code\">%s</span>, Message: <span class=\"debug_message\">%s</span>",
+ basename($errfile),
+ $errline,
+ $errno,
+ $errstr
+ );
+
+ // Throw an exception here
+ throw new FatalErrorException($message, BaseFrameworkSystem::EXCEPTION_FATAL_ERROR);
+} // END - function
+
+// Set error handler
+set_error_handler('__errorHandler');
+
+// Assertion handler
+function __assertHandler ($file, $line, $code) {
+ // Empty code?
+ if ($code === "") $code = "<em>Unknown</em>";
+
+ // Create message
+ $message = sprintf("File: <span class=\"debug_file\">%s</span>, Line: <span class=\"debug_line\">%s</span>, Code: <span class=\"debug_code\">%s</span>",
+ basename($file),
+ $line,
+ $code
+ );
+
+ // Throw an exception here
+ throw new AssertionException($message, BaseFrameworkSystem::EXCEPTION_ASSERTION_FAILED);
+} // END - function
+
+// Init assert handling
+assert_options(ASSERT_ACTIVE, 1);
+assert_options(ASSERT_WARNING, 0);
+assert_options(ASSERT_BAIL, 0);
+assert_options(ASSERT_QUIET_EVAL, 0);
+assert_options(ASSERT_CALLBACK, '__assertHandler');
// [EOF]
?>
/**
* Application initializer
*
+ * Please remember that this include file is being loaded *before* the class
+ * loader is loading classes from "exceptions", "interfaces" and "main"!
+ *
+ * You can prevent adding this application to the selector by uncommenting the
+ * following line:
+ *
+ * if ((isset($this)) && (is_object($this)) && ($this->isClass("ApplicationSelector"))) { return; }
+ *
+ * isset() is required to prevent a warning and is_object() is highly required
+ * when the application itself is requested in URL (hint: index.php?app=your_app)
+ *
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.ship-simu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// Get a new configuration instance
-$cfg = FrameworkConfiguration::createFrameworkConfiguration();
+// Get config instance
+$cfg = FrameworkConfiguration::getInstance();
// Initialize output system
-require($cfg->readConfig('base_path') . "inc/output.php");
+require($cfg->readConfig('base_path') . 'inc/output.php');
// Initialize file i/o system
-require($cfg->readConfig('base_path') . "inc/file_io.php");
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
// Include the language sub-system
-require($cfg->readConfig('base_path') . "inc/language.php");
-
-// Get the database layer as well
-require($cfg->readConfig('base_path') . "inc/database.php");
-
-// Generate call-back function
-$callback = sprintf("%s::getInstance",
- FrameworkConfiguration::getInstance()->readConfig('app_helper_class')
-);
-
-// Get an instance of the helper
-$app = call_user_func_array($callback, array());
-
-// Set application name and version
-$app->setAppName("MXChange Mailtausch-Skript");
-$app->setAppVersion("0.3.0");
-$app->setAppShortName(FrameworkConfiguration::getInstance()->readConfig("selector_name"));
+require($cfg->readConfig('base_path') . 'inc/language.php');
-// Set instances
-$app->setFileIoInstance($io);
-$app->setLanguageInstance($lang);
-$app->setDatabaseInstance($db);
+// This application needs a database connection then we have to simply include
+// the inc/database.php script
+require($cfg->readConfig('base_path') . 'inc/database.php');
// [EOF]
?>
<?php
/**
- * The application's class loader
+ * A specialized class loader for this class
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.ship-simu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Get config instance
$cfg = FrameworkConfiguration::getInstance();
-// Load all classes
-ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/", $cfg->readConfig("application_path"), $cfg->readConfig("app_name")));
+// Load all classes for the application
+foreach ($lowerClasses as $className) {
+ // Load the application classes
+ ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", $cfg->readConfig('application_path'), $cfg->readConfig('app_name'), $className));
+} // END - if
// Clean up the global namespace
unset($lowerClasses);
-unset($class);
+unset($className);
// [EOF]
?>
<?php
/**
- * Launches the application
+ * The application launcher
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.ship-simu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Is there an application helper instance? We need the method main() for
// 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!",
+ ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the helper class <span class=\"class_name\">%s</span> is not loaded.",
$application,
- FrameworkConfiguration::getInstance()->readConfig("app_helper_class")
+ 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!",
+ ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because 'app' is not an object.",
$application
));
-} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) {
+} 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!",
+ ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the method <span class=\"method_name\">%s</span> is missing.",
$application,
- FrameworkConfiguration::getInstance()->readConfig("entry_method")
+ FrameworkConfiguration::getInstance()->readConfig('entry_method')
));
}
-// Call the entry point method
-try {
- call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
-} catch (FrameworkException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Die Applikation <strong>%s</strong> kann nicht gestartet werden. Grund: <u>%s</u>",
- $application,
- $e->getMessage()
- ));
-}
+// Call user function
+call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
// [EOF]
?>