registerFilter(__FUNCTION__, __LINE__, 'init', 'COUNT_MODULE');
registerFilter(__FUNCTION__, __LINE__, 'init', 'UPDATE_LOGIN_DATA');
registerFilter(__FUNCTION__, __LINE__, 'init', 'ACTIVATE_EXCHANGE');
+ registerFilter(__FUNCTION__, __LINE__, 'init', 'REDIRECT_WRONG_SERVER_NAME');
// Page headers - pre-filter (normally, you want to register here)
registerFilter(__FUNCTION__, __LINE__, 'pre_page_header', 'LOAD_PAGE_HEADER');
}
}
+// Filter for redirecting on wrong server name (e.g. bad.your-server.tld will be redirected to your-server.tld)
+function FILTER_REDIRECT_WRONG_SERVER_NAME ($filterData) {
+ // Is the configured URL same as SERVER_NAME?
+ if (extractHostnameFromUrl(getUrl()) != detectServerName()) {
+ // Then redirect to configured URL
+ redirectToRequestUri();
+ } // END - if
+
+ // Return filter data
+ return $filterData;
+}
+
// [EOF]
?>
// CSS array
initExtensionCssFiles();
- if ((!empty($GLOBALS['mysql']['host'])) && (!empty($GLOBALS['mysql']['login'])) && (!empty($GLOBALS['mysql']['dbase']))) {
- // Connect to DB
- SQL_CONNECT($GLOBALS['mysql']['host'], $GLOBALS['mysql']['login'], $GLOBALS['mysql']['password'], __FILE__, __LINE__);
-
- // Is the link valid?
- if (SQL_IS_LINK_UP()) {
- // Enable exit on error
- enableExitOnError();
-
- // Is it a valid resource?
- if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FILE__, __LINE__) === TRUE) {
- // Set database name (required for ext-optimize and ifSqlTableExists())
- setConfigEntry('__DB_NAME', $GLOBALS['mysql']['dbase']);
-
- // Remove MySQL array from namespace
- unset($GLOBALS['mysql']);
-
- // Load cache
- loadIncludeOnce('inc/load_cache.php');
- } else {
- // Wrong database?
- reportBug(__FILE__, __LINE__, 'Wrong database selected.');
- }
- } else {
- // No link to database!
- reportBug(__FILE__, __LINE__, 'Database link is not yet up.');
- }
- } else {
- // Maybe you forgot to enter your database login?
- reportBug(__FILE__, __LINE__, 'Database login is missing.');
- }
+ // Initialize SQL link
+ initSqlLink();
} else {
// Default output is 'direct' for HTML output
setConfigEntry('OUTPUT_MODE', 'direct');
return $SQL;
}
+// Initializes the SQL link by bringing it up if set
+function initSqlLink () {
+ // Do this only if link is down
+ assert(!SQL_IS_LINK_UP());
+
+ // Is the configuration data set?
+ if ((!empty($GLOBALS['mysql']['host'])) && (!empty($GLOBALS['mysql']['login'])) && (!empty($GLOBALS['mysql']['dbase']))) {
+ // Remove cache
+ unset($GLOBALS['is_sql_link_up']);
+
+ // Connect to DB
+ SQL_CONNECT($GLOBALS['mysql']['host'], $GLOBALS['mysql']['login'], $GLOBALS['mysql']['password'], __FILE__, __LINE__);
+
+ // Is the link valid?
+ if (SQL_IS_LINK_UP()) {
+ // Enable exit on error
+ enableExitOnError();
+
+ // Is it a valid resource?
+ if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FILE__, __LINE__) === TRUE) {
+ // Set database name (required for ext-optimize and ifSqlTableExists())
+ setConfigEntry('__DB_NAME', $GLOBALS['mysql']['dbase']);
+
+ // Remove MySQL array from namespace
+ unset($GLOBALS['mysql']);
+
+ // Load cache
+ loadIncludeOnce('inc/load_cache.php');
+ } else {
+ // Wrong database?
+ reportBug(__FILE__, __LINE__, 'Wrong database selected.');
+ }
+ } else {
+ // No link to database!
+ reportBug(__FILE__, __LINE__, 'Database link is not yet up.');
+ }
+ } else {
+ // Maybe you forgot to enter your database login?
+ reportBug(__FILE__, __LINE__, 'Database login is missing.');
+ }
+}
+
// [EOF]
?>
if ($isValid === TRUE) {
// If time is zero seconds we have a sponsor mail. 1 Second shall be set to avoid problems
if (($time == '0') && ($payment > 0)) {
- $url = getUrl();
+ $url = getUrl();
$time = 1;
} // END - if