$GLOBALS['module'] = 'birthday_confirm';
// Include header
- loadInclude('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Load birthday header template (for your banners, e.g.?)
$content['header'] = LOAD_TEMPLATE('birthday_header', true);
LOAD_TEMPLATE('birthday_confirm', false, $content);
// Include footer
- loadInclude('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} else {
// You have to install first!
redirectToUrl('install.php');
sendHeader('Content-type: text/css');
// Load header
-loadInclude('inc/header.php');
+loadIncludeOnce('inc/header.php');
// Load CSS code
loadInclude('inc/stylesheet.php');
// Load footer
-loadInclude('inc/footer.php');
+loadIncludeOnce('inc/footer.php');
//
?>
if (getConfig('doubler_send_mode') == 'DIRECT') loadInclude('inc/doubler_send.php');
// Output header
- loadInclude('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Banner in text
define('__DOUBLER_BANNER', LOAD_TEMPLATE('doubler_banner', true));
LOAD_TEMPLATE('doubler_index');
// Output footer
- loadInclude('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} else {
// You have to install first!
redirectToUrl('install.php');
}
if (getTotalFatalErrors() > 0) {
+ // Load config here
+ loadIncludeOnce('inc/load_config.php');
+
// Main div container
- LOAD_TEMPLATE("fatal_header");
+ LOAD_TEMPLATE('fatal_header');
// Set unset variable
if (empty($check)) $check = '';
);
// Load row template
- $OUT .= LOAD_TEMPLATE("install_fatal_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('install_fatal_row', true, $content);
}
// Load main template
- LOAD_TEMPLATE("install_fatal_table", false, $OUT);
+ LOAD_TEMPLATE('install_fatal_table', false, $OUT);
} elseif (isInstalled()) {
// Display all runtime fatal errors
$OUT = '';
);
// Load row template
- $OUT .= LOAD_TEMPLATE("runtime_fatal_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('runtime_fatal_row', true, $content);
}
// Load main template
- LOAD_TEMPLATE("runtime_fatal_table", false, $OUT);
+ LOAD_TEMPLATE('runtime_fatal_table', false, $OUT);
// Abort here
shutdown();
} // END - if
// Load footer template
- LOAD_TEMPLATE("fatal_footer", false, $CORR);
+ LOAD_TEMPLATE('fatal_footer', false, $CORR);
}
//
default:
// Huh, something goes wrong or maybe you have edited config.php ???
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", getConfig('OUTPUT_MODE')));
app_die(__FUNCTION__, __LINE__, "<strong>{--FATAL_ERROR--}:</strong> {--LANG_NO_RENDER_DIRECT--}");
break;
}
// Output error messages in a fasioned way and die...
function app_die ($F, $L, $msg) {
- // Load header
- loadIncludeOnce('inc/header.php');
+ // Check if Script is already dieing and not let it kill itself another 1000 times
+ if (!isset($GLOBALS['app_died'])) {
+ // Make sure, that the script realy realy diese here and now
+ $GLOBALS['app_died'] = true;
- // Prepare message for output
- $msg = sprintf(getMessage('MXCHANGE_HAS_DIED'), basename($F), $L, $msg);
+ // Load header
+ loadIncludeOnce('inc/header.php');
- // Load the message template
- LOAD_TEMPLATE('admin_settings_saved', false, $msg);
+ // Prepare message for output
+ $msg = sprintf(getMessage('MXCHANGE_HAS_DIED'), basename($F), $L, $msg);
- // Load footer
- loadIncludeOnce('inc/footer.php');
+ // Load the message template
+ LOAD_TEMPLATE('admin_settings_saved', false, $msg);
- // Exit explicitly
- shutdown();
+ // Load footer
+ loadIncludeOnce('inc/footer.php');
+
+ // Exit explicitly
+ shutdown();
+ } else {
+ // Script tried to kill itself twice
+ debug_report_bug('Script wanted to kill itself more than once! Raw message=' . $msg . ', file/function=' . $F . ', line=' . $L);
+ }
}
// Display parsing time and number of SQL queries in footer
// Add title decorations? (left)
if (!defined('__PAGE_TITLE')) {
// Config and database connection valid?
- if ((isConfigLoaded()) && (SQL_IS_LINK_UP())) {
+ if ((isConfigLocalLoaded()) && (isConfigLoaded()) && (SQL_IS_LINK_UP())) {
// Title decoration enabled?
if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_left') != '')) $TITLE .= trim(getConfig('title_left'))." ";
setConfigEntry('WRITE_FOOTER', 'Y');
setConfigEntry('_DB_TYPE' , 'mysql3');
+// Mark configuration as NOT loaded which is the default
+$GLOBALS['config_local_loaded'] = false;
+
// Is the local configuration there?
if (isIncludeReadable('inc/cache/config-local.php')) {
// Then load it
loadIncludeOnce('inc/cache/config-local.php');
+
+ // Mark configuration as loaded
+ $GLOBALS['config_local_loaded'] = true;
} elseif (isInstalling()) {
// Set some essential constants
// @TODO Rewrite them to avoid this else block
define('MAIN_TITLE', 'Your mail-exchanger title');
define('SLOGAN' , 'Your cool slogan here');
define('WEBMASTER' , 'you@some-hoster.tld.invalid');
+
+ // Set output mode here
+ setConfigEntry('OUTPUT_MODE', 'render');
} else {
// Problem in application detected
debug_report_bug('Wether we are not installing nor config-local.php is created!');
}
+// Check if the user setups his MySQL stuff...
+if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!REQUEST_ISSET_GET('installing')) && (isInstalled())) {
+ // No login entered and outside installation mode
+ OUTPUT_HTML('<strong>{--LANG_WARNING--}:</strong> ');
+ if (isInstalled()) {
+ // You have changed my configuration file!
+ app_die(__FILE__, __LINE__, '{--DIE_CONFIG_CHANGED_YOU--}');
+ } else {
+ // Please run the installation script (maybe again)
+ app_die(__FILE__, __LINE__, '{--DIE_RUN_INSTALL_MYSQL--}');
+ }
+} elseif ((!isInstalling()) && (empty($GLOBALS['mysql']['password'])) && (getConfig('WARN_NO_PASS') == 'Y')) {
+ // No database password entered!!!
+ OUTPUT_HTML('<div>{--LANG_WARNING--}:</div> {--WARN_NULL_PASSWORD--}');
+}
+
//
?>
// Set error handler
set_error_handler('__errorHandler');
-// Load configuration file(s) here
-loadIncludeOnce('inc/load_config.php');
-
// Set important header_sent
$GLOBALS['header_sent'] = 0;
-// Check if the user setups his MySQL stuff...
-if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!REQUEST_ISSET_GET('installing')) && (isInstalled())) {
- // No login entered and outside installation mode
- OUTPUT_HTML('<strong>{--LANG_WARNING--}:</strong> ');
- if (isInstalled()) {
- // You have changed my configuration file!
- app_die(__FILE__, __LINE__, '{--DIE_CONFIG_CHANGED_YOU--}');
- } else {
- // Please run the installation script (maybe again)
- app_die(__FILE__, __LINE__, '{--DIE_RUN_INSTALL_MYSQL--}');
- }
-} elseif ((!isInstalling()) && (empty($GLOBALS['mysql']['password'])) && (getConfig('WARN_NO_PASS') == 'Y')) {
- // No database password entered!!!
- OUTPUT_HTML('<div>{--LANG_WARNING--}:</div> {--WARN_NULL_PASSWORD--}');
-}
-
// Init fatal messages
initFatalMessages();
// Check if this file is writeable or read-only and warn the user
if ((!isInstalling()) && (isInstalled())) {
+ // Load configuration file(s) here
+ loadIncludeOnce('inc/load_config.php');
+
// Check for write-permission for config.php and inc directory
if (empty($GLOBALS['module'])) $GLOBALS['module'] = REQUEST_GET('module');
if (empty($GLOBALS['module'])) $GLOBALS['module'] = 'index';
function loadIncludeOnce ($INC) {
// Is it not loaded?
if (!isset($GLOBALS['load_once'][$INC])) {
+ // Mark it as loaded
+ $GLOBALS['load_once'][$INC] = "loaded";
+
// Then try to load it
loadInclude($INC);
-
- // And mark it as loaded
- $GLOBALS['load_once'][$INC] = "loaded";
} // END - if
}
// Check wether this script is installed
function isInstalled () {
- return (getConfig('MXCHANGE_INSTALLED') == 'Y');
+ return ((getConfig('MXCHANGE_INSTALLED') == 'Y') || (isIncludeReadable('inc/cache/config-local.php')));
}
// Check wether an admin is registered
return countSelection(REQUEST_POST('sel'));
}
+// Checks wether the config-local.php is loaded
+function isConfigLocalLoaded () {
+ return ((isset($GLOBALS['config_local_loaded'])) && ($GLOBALS['config_local_loaded'] === true));
+}
+
// [EOF]
?>
// Is the script installed?
if (isInstalled()) {
// Header
- loadInclude('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Fix missing array elements here
if (!isConfigEntrySet('index_delay')) setConfigEntry('index_delay' , 0);
}
// Footer
- loadInclude('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} else {
// You have to install first!
redirectToUrl('install.php');
// Load config file
require('inc/config-global.php');
-// Header
-loadInclude('inc/header.php');
-
-// Reload page to page=welcome when it is not specified
-if (!REQUEST_ISSET_GET('page')) {
- redirectToUrl('install.php?page=welcome');
-} // END - if
-
// Already installed?
-if ((isInstalled()) && (isAdminRegistered())) {
+if (isInstalled()) {
// Add fatal message
addFatalMessage(__FILE__, __LINE__, getMessage('ALREADY_INSTALLED'));
} // END - if
// Does something goes wrong?
if (getTotalFatalErrors() == 0) {
+ // Reload page to page=welcome when it is not specified
+ if (!REQUEST_ISSET_GET('page')) {
+ redirectToUrl('install.php?page=welcome');
+ } // END - if
+
+ // Load header here
+ loadIncludeOnce('inc/header.php');
+
// Add main installation table
LOAD_TEMPLATE('install_header');
// Close main installation table
LOAD_TEMPLATE('install_footer');
-}
-// Footer
-loadInclude('inc/footer.php');
+ // Footer
+ loadIncludeOnce('inc/footer.php');
+} else {
+ // Output fatal messages
+ loadInclude('inc/fatal_errors.php');
+}
//
?>
// Is the script installed?
if (isInstalled()) {
// Header
- loadInclude('inc/header.php');
+ loadIncludeOnce('inc/header.php');
// Initialize the array for the template
$content = array(
LOAD_TEMPLATE('lead_code', false, $content);
// Footer
- loadInclude('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} else {
// You have to install first!
redirectToUrl('install.php');
// List only rankings when script is installed
if (isInstalled()) {
// Include header
- loadInclude('inc/header.php');
+ loadIncludeOnce('inc/header.php');
if ((REQUEST_GET('uid') > 0) && (REQUEST_GET('d') > 0) && (REQUEST_ISSET_GET(('t')))) {
// Set row name
LOAD_TEMPLATE('show_bonus', false, $content);
// Include footer
- loadInclude('inc/footer.php');
+ loadIncludeOnce('inc/footer.php');
} else {
// You have to install first!
redirectToUrl('install.php');