/**
* General functions library
*
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 3.0.0
* @copyright Copyright (c) 2009 - 2011 Cracker Tracker Team
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.shipsimu.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
} // END - function
} // END - if
+// Load configuration, if found
+function crackerTrackerLoadConfiguration () {
+ // FQFN
+ $fqfn = sprintf('%s/config/db_config.php', $GLOBALS['ctracker_base_path']);
+
+ // Is the file readable?
+ if (!isCrackerTrackerFileFound($fqfn)) {
+ // No config file found
+ die(__FUNCTION__.': No configuration file found.');
+ } // END - if
+
+ // Load it
+ require($fqfn);
+
+ // Load email header
+ $GLOBALS['ctracker_header'] = crackerTrackerLoadEmailTemplate('header');
+}
+
// Getter for ctracker_debug_enabled
function isCrackerTrackerDebug () {
// Is it set?
// Loads a given "template" (this is more an include file)
function crackerTrackerLoadTemplate ($template) {
// Create the full-qualified filename (FQFN)
- $FQFN = sprintf('%s/templates/%s.tpl.php',
- dirname(__FILE__),
+ $FQFN = sprintf('%s/libs/templates/%s.tpl.php',
+ $GLOBALS['ctracker_base_path'],
$template
);
// Loads a given "template" (this is more an include file)
function crackerTrackerLoadLocalizedTemplate ($template) {
// Create the full-qualified filename (FQFN)
- $FQFN = sprintf('%s/templates/%s/%s.tpl.php',
- dirname(__FILE__),
+ $FQFN = sprintf('%s/libs/templates/%s/%s.tpl.php',
+ $GLOBALS['ctracker_base_path'],
getCrackerTrackerLanguage(),
$template
);
} // END - if
// Construct FQFN
- $FQFN = sprintf('%s/language/%s.php',
- dirname(__FILE__),
+ $FQFN = sprintf('%s/libs/language/%s.php',
+ $GLOBALS['ctracker_base_path'],
getCrackerTrackerLanguage()
);
$GLOBALS['ctracker_language'] = 'en';
// Construct FQFN again
- $FQFN = sprintf('%s/language/en.php', dirname(__FILE__));
+ $FQFN = sprintf('%s/libs/language/en.php', $GLOBALS['ctracker_base_path']);
} // END - if
// Load the language file
crackerTrackerLanguage();
// Generate the FQFN
- $FQFN = sprintf('%s/mails/%s/%s.tpl',
- dirname(__FILE__),
+ $FQFN = sprintf('%s/libs/mails/%s/%s.tpl',
+ $GLOBALS['ctracker_base_path'],
getCrackerTrackerLanguage($language),
$template
);
// So is the file there?
if (isCrackerTrackerFileFound($FQFN)) {
// Init result
- $result = 'No result from template ' . $template . '. Please report this at http://forum.ship-simu.org Thank you.';
+ $result = 'No result from template ' . $template . '. Please report this at http://forum.shipsimu.org Thank you.';
// Then load it
- eval('$result = "' . crackerTrackerCompileCode(file_get_contents($FQFN)) . '";');
+ //* DEBUG-DIE: */ die('<pre>$result = "' . crackerTrackerCompileCode(trim(file_get_contents($FQFN))) . '";</pre>');
+ eval('$result = "' . crackerTrackerCompileCode(trim(file_get_contents($FQFN))) . '";');
// Return the result
return $result;
// Unset all ctracker data
foreach (array(
+ 'ctracker_base_path',
'ctracker_host',
'ctracker_dbname',
'ctracker_user',