*/
// Initialize output system
-require(PATH . 'inc/output.php');
+require($cfg->readConfig('base_path') . 'inc/output.php');
// Initialize file i/o system
-require(PATH . 'inc/file_io.php');
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
// Include the language sub-system
-require(PATH . 'inc/language.php');
+require($cfg->readConfig('base_path') . 'inc/language.php');
// This application needs a database connection then we have to simply include
// the inc/database.php script
-require(PATH . 'inc/database.php');
+require($cfg->readConfig('base_path') . 'inc/database.php');
// Generate call-back function
$callback = sprintf("%s::getInstance",
public function readApplicationDirectory () {
// Generate the base path for all applications
$appBasePath = sprintf("%s%s/",
- PATH,
+ $this->getConfigInstance()->readConfig('base_path'),
$this->getConfigInstance()->readConfig('application_path')
);
*/
// Initialize output system
-require(PATH . 'inc/output.php');
+require($cfg->readConfig('base_path') . 'inc/output.php');
// Initialize file i/o system
-require(PATH . 'inc/file_io.php');
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
// Include the language sub-system
-require(PATH . 'inc/language.php');
+require($cfg->readConfig('base_path') . 'inc/language.php');
// Generate call-back function
$callback = sprintf("%s::getInstance",
*/
// Initialize output system
-require(PATH . 'inc/output.php');
+require($cfg->readConfig('base_path') . 'inc/output.php');
// Initialize file i/o system
-require(PATH . 'inc/file_io.php');
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
// Include the language sub-system
-require(PATH . 'inc/language.php');
+require($cfg->readConfig('base_path') . 'inc/language.php');
// This application needs a database connection then we have to simply include
// the inc/database.php script
-require(PATH . 'inc/database.php');
+require($cfg->readConfig('base_path') . 'inc/database.php');
// Generate call-back function
$callback = sprintf("%s::getInstance",
*/
// Initialize output system
-require(PATH . 'inc/output.php');
+require($cfg->readConfig('base_path') . 'inc/output.php');
// Initialize file i/o system
-require(PATH . 'inc/file_io.php');
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
// Include the language sub-system
-require(PATH . 'inc/language.php');
+require($cfg->readConfig('base_path') . 'inc/language.php');
// This application needs a database connection then we have to simply include
// the inc/database.php script
-require(PATH . 'inc/database.php');
+require($cfg->readConfig('base_path') . 'inc/database.php');
// Generate call-back function
$callback = sprintf("%s::getInstance",
// Set the compressor channel
$this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s",
- PATH,
+ $this->getConfigInstance()->readConfig('base_path'),
$this->getConfigInstance()->readConfig('compressor_base_path')
)));
// Generate FQFN for all application templates
$fqfn = sprintf("%s%s/%s/%s",
- PATH,
+ $this->getConfigInstance()->readConfig('base_path'),
$this->getConfigInstance()->readConfig('application_path'),
strtolower($appInstance->getAppShortName()),
$this->getConfigInstance()->readConfig('tpl_base_path')
$tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension'));
// Absolute output path for compiled templates
- $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig('compile_output_path'));
+ $tplInstance->setCompileOutputPath($cfgInstance->readConfig('base_path') . $cfgInstance->readConfig('compile_output_path'));
// Return the prepared instance
return $tplInstance;
$tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension'));
// Absolute output path for compiled templates
- $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig('compile_output_path'));
+ $tplInstance->setCompileOutputPath($cfgInstance->readConfig('base_path') . $cfgInstance->readConfig('compile_output_path'));
// Return the prepared instance
return $tplInstance;
$tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension'));
// Absolute output path for compiled templates
- $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig('compile_output_path'));
+ $tplInstance->setCompileOutputPath($cfgInstance->readConfig('base_path') . $cfgInstance->readConfig('compile_output_path'));
// Return the prepared instance
return $tplInstance;
$cfg = FrameworkConfiguration::createFrameworkConfiguration();
// CFG: SERVER-PATH
-$cfg->definePath(dirname(dirname(__FILE__)) . '/'); // DON'T MISS THE TRAILING SLASH!!!
+$cfg->setConfigEntry('base_path', (dirname(dirname(__FILE__)) . '/')); // DON'T MISS THE TRAILING SLASH!!!
// CFG: BASE-URL
$cfg->setConfigEntry('base_url', $cfg->detectBaseUrl());
// CFG: DATABASE-TYPE
-$cfg->defineDatabaseType('local');
+$cfg->setConfigEntry('db_type', "local");
// CFG: LOCAL-DB-PATH
-$cfg->setConfigEntry('local_db_path', "db/");
+$cfg->setConfigEntry('local_db_path', $cfg->readConfig('base_path', "db/"));
// CFG: TIME-ZONE
$cfg->setDefaultTimezone("Europe/Berlin");
// Base path added? (Uni* / Windows)
if ((substr($inc, 0, 1) != "/") && (substr($inc, 1, 1) != ":")) {
// Generate FQFN
- $fqfn = sprintf("%s/inc/extra/%s", PATH, $inc);
+ $fqfn = sprintf("%s/inc/extra/%s", $this->readConfig('base_path'), $inc);
} // END - if
} // END - if
} // END - if
}
- /**
- * 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')) {
- // 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__
- ));
- }
-
- // Set the constant
- define('_DB_TYPE', (string) $type);
- }
-
- /**
- * Define the local file path
- *
- * @param $path Local file path for include files.
- * @return void
- */
- public function definePath ($path) {
- // Cast to string
- $path = (string) $path;
-
- // Replace backslashes with slashes
- $path = str_replace("\\", "/", $path);
-
- // Is it defined or not?
- if ((!is_dir($path)) || (!is_readable($path))) {
- // Is not a valid path
- ApplicationEntryPoint::app_die(sprintf("[%s:] Invalid path (not found) specified. Please make sure it is created.",
- __CLASS__
- ));
- } elseif (defined('PATH')) {
- // 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__
- ));
- }
-
- // Define path here
- define('PATH', $path);
- }
-
/**
* Read a configuration element.
*
- * @param $cfgEntry The configuration element
+ * @param $cfgEntry The configuration element
* @return $cfgValue The fetched configuration value
- * @throws ConfigEntryIsEmptyException If $cfgEntry is empty
+ * @throws ConfigEntryIsEmptyException If $cfgEntry is empty
* @throws ConfigEntryNotFoundException If a configuration element
- * was not found
+ * was not found
*/
public function readConfig ($cfgEntry) {
// Cast to string
/**
* Set a configuration entry.
*
- * @param $cfgEntry The configuration entry we want to add/change
- * @param $cfgValue The configuration value we want to set
+ * @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
*/
// 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>$cfg->defineDatabaseType("local");</pre>
-This will choose the local file-based database layer.");
-}
+// Get config instance
+$cfg = FrameworkConfiguration::getInstance();
// Generate FQFN for the database layer
$INC = sprintf("%sinc/database/lib-%s%s",
- PATH,
- _DB_TYPE,
- FrameworkConfiguration::getInstance()->readConfig('php_extension')
+ $cfg->readConfig('base_path'),
+ $cfg->readConfig('db_type'),
+ $cfg->readConfig('php_extension')
);
// Load the database layer include
} else {
// Layer is missing!
ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer is missing! (%s) -> R.I.P.",
- _DB_TYPE
+ $cfg->readConfig('db_type')
));
}
// Zum Testen speichern wir in lokale Dateien (LocalFileDatabase)
try {
- $layer = LocalFileDatabase::createLocalFileDatabase(PATH . FrameworkConfiguration::getInstance()->readConfig('local_db_path'), FileIoHandler::getInstance());
+ $layer = LocalFileDatabase::createLocalFileDatabase(FrameworkConfiguration::getInstance()->readConfig('local_db_path'), FileIoHandler::getInstance());
} catch (SavePathIsEmptyException $e) {
ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong>",
$e->getMessage()
$cfg = FrameworkConfiguration::getInstance();
// Include the class loader function
-require(sprintf("%sinc/loader/class_ClassLoader%s", PATH, $cfg->readConfig('php_extension')));
+require(sprintf("%sinc/loader/class_ClassLoader%s", $cfg->readConfig('base_path'), $cfg->readConfig('php_extension')));
// Does the user has an application specified?
if (!empty($_GET['app'])) {
/**
* Is the devel package included?
*/
-if (is_dir(sprintf("%sdevel", PATH))) {
+if (is_dir(sprintf("%sdevel", $cfg->readConfig('base_path')))) {
/**
* Load all development includes
*/
*/
try {
$lang = LanguageSystem::createLanguageSystem(sprintf("%s%s",
- PATH,
+ $cfg->readConfig('base_path'),
FrameworkConfiguration::getInstance()->readConfig('lang_base_path')
));
} catch (LanguagePathIsEmptyException $e) {
// Construct the FQFN for the cache
if (!defined('DEVELOPER')) {
- $this->listCacheFQFN = PATH . $this->cfgInstance->readConfig('local_db_path') . "list-" . $this->cfgInstance->readConfig('app_name') . ".cache";
- $this->classCacheFQFN = PATH . $this->cfgInstance->readConfig('local_db_path') . "class-" . $this->cfgInstance->readConfig('app_name') . ".cache";
+ $this->listCacheFQFN = $this->cfgInstance->readConfig('base_path') . $this->cfgInstance->readConfig('local_db_path') . "list-" . $this->cfgInstance->readConfig('app_name') . ".cache";
+ $this->classCacheFQFN = $this->cfgInstance->readConfig('base_path') . $this->cfgInstance->readConfig('local_db_path') . "class-" . $this->cfgInstance->readConfig('app_name') . ".cache";
} // END - if
// Set suffix and prefix from configuration
/**
* 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
+ * @param $basePath The relative base path to 'base_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() ) {
$this->prefixLen = strlen($this->prefix);
// Set base directory
- $basePath = sprintf("%sinc/config/", PATH);
+ $basePath = sprintf("%sinc/config/", $this->cfgInstance->readConfig('base_path'));
// Load all classes from the config directory
$this->loadClasses($basePath);
// Generate a FQFN for the helper class
$fqfn = sprintf("%s%s/%s/%s%s",
- PATH,
+ $cfg->readConfig('base_path'),
$cfg->readConfig('application_path'),
$cfg->readConfig('app_name'),
$inc,
if (empty($message)) {
// No message provided
$message = "No message provided!";
- }
+ } // END - if
// Get some instances
$tpl = FrameworkConfiguration::getInstance()->readConfig('template_class');
require(dirname(__FILE__) . '/inc/config.php');
// Load all include files
- require(PATH . 'inc/includes.php');
+ require($cfg->readConfig('base_path') . 'inc/includes.php');
// Load all framework classes
- require(PATH . 'inc/classes.php');
+ require($cfg->readConfig('base_path') . 'inc/classes.php');
// Include the application selector
- require(PATH . 'inc/selector.php');
+ require($cfg->readConfig('base_path') . 'inc/selector.php');
} // END - main()
} // END - class
require(dirname(dirname(__FILE__)) . '/inc/config.php');
// Load all include files
-require(PATH . 'inc/includes.php');
+require($cfg->readConfig('base_path') . 'inc/includes.php');
// Load all game classes
-require(PATH . 'inc/classes.php');
+require($cfg->readConfig('base_path') . 'inc/classes.php');
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
require(dirname(dirname(__FILE__)) . '/inc/config.php');
// Load all include files
-require(PATH . 'inc/includes.php');
+require($cfg->readConfig('base_path') . 'inc/includes.php');
// Load all game classes
-require(PATH . 'inc/classes.php');
+require($cfg->readConfig('base_path') . 'inc/classes.php');
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
require(dirname(dirname(__FILE__)) . '/inc/config.php');
// Load all include files
-require(PATH . 'inc/includes.php');
+require($cfg->readConfig('base_path') . 'inc/includes.php');
// Load all game classes
-require(PATH . 'inc/classes.php');
+require($cfg->readConfig('base_path') . 'inc/classes.php');
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
require(dirname(dirname(__FILE__)) . '/inc/config.php');
// Load all include files
-require(PATH . 'inc/includes.php');
+require($cfg->readConfig('base_path') . 'inc/includes.php');
// Load all game classes
-require(PATH . 'inc/classes.php');
+require($cfg->readConfig('base_path') . 'inc/classes.php');
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
// Load all include files
-require(PATH . 'inc/includes.php');
+require($cfg->readConfig('base_path') . 'inc/includes.php');
// Load all game classes
-require(PATH . 'inc/classes.php');
+require($cfg->readConfig('base_path') . 'inc/classes.php');
// Load file I/O handler
-require(PATH . 'inc/file_io.php');
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
// Load database layer
-require(PATH . 'inc/database.php');
+require($cfg->readConfig('base_path') . 'inc/database.php');
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
$application = 'ship-simu';
// Load more includes
-require(PATH . 'application/ship-simu/loader.php');
+require($cfg->readConfig('base_path') . 'application/ship-simu/loader.php');
// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
// jetzt die Personalliste wiederherstellen
require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
// Load all include files
-require(PATH . 'inc/includes.php');
+require($cfg->readConfig('base_path') . 'inc/includes.php');
// Load all game classes
-require(PATH . 'inc/classes.php');
+require($cfg->readConfig('base_path') . 'inc/classes.php');
// Load file I/O handler
-require(PATH . 'inc/file_io.php');
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
// Load database layer
-require(PATH . 'inc/database.php');
+require($cfg->readConfig('base_path') . 'inc/database.php');
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
$application = 'ship-simu';
// Load more includes
-require(PATH . 'application/ship-simu/loader.php');
+require($cfg->readConfig('base_path') . 'application/ship-simu/loader.php');
// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
// jetzt die Personalliste wiederherstellen
require(dirname(dirname(dirname(__FILE__))) . "/inc/config.php");
// Load all include files
-require(PATH . 'inc/includes.php');
+require($cfg->readConfig('base_path') . 'inc/includes.php');
// Load all game classes
-require(PATH . 'inc/classes.php');
+require($cfg->readConfig('base_path') . 'inc/classes.php');
// Load file I/O handler
-require(PATH . 'inc/file_io.php');
+require($cfg->readConfig('base_path') . 'inc/file_io.php');
// Load database layer
-require(PATH . 'inc/database.php');
+require($cfg->readConfig('base_path') . 'inc/database.php');
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'ship-simu');
$application = 'ship-simu';
// Load more includes
-require(PATH . 'application/ship-simu/loader.php');
+require($cfg->readConfig('base_path') . 'application/ship-simu/loader.php');
// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
// jetzt die Personalliste wiederherstellen