reportBug(__FUNCTION__, __LINE__, 'No database link is up. Cannot flush filters.');
} elseif ((isInstallationPhase()) && (!SQL_IS_LINK_UP())) {
// If the link is not up in installation phase, skip flushing filters
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot flush filters: No link is up.');
return;
}
- // Is the extension ext-sql_patches updated and not in installation phase?
- if ((!isInstallationPhase()) && ((!isExtensionInstalled('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.9')))) {
+ // Is the extension ext-sql_patches updated?
+ if (((!isExtensionInstalled('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.9'))) && (!isInstallationPhase())) {
// Log only in debug mode
if (isDebugModeEnabled()) {
logDebugMessage(__FUNCTION__, __LINE__, 'Cannot flush filters, ext-sql_patches might be missing. isExtensionInstalled()=' . intval(isExtensionInstalled('sql_patches')) . ',isExtensionInstalledAndOlder()=' . intval(isExtensionInstalledAndOlder('sql_patches', '0.5.9')));
// Walk through all filters
foreach ($filterArray as $filterFunction => $active) {
// Is this filter loaded?
- //* DEBUG: */ debugOutput('FOUND:'.$filterName.'/'.$filterFunction.'='.$active);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'FOUND:'.$filterName.'/'.$filterFunction.'='.$active);
if (((!isset($GLOBALS['cache_array']['filter']['loaded'][$filterName][$filterFunction])) && ($active != 'R')) || ($active == 'A')) {
// Is this filter already in database?
if (countSumTotalData($filterFunction, 'filters', 'filter_name', 'filter_function', TRUE, sprintf(" AND `filter_name`='%s'", SQL_ESCAPE($filterName))) == 0) {
// Add this filter (all filters are active by default)
- //* DEBUG: */ debugOutput('ADD:'.$filterName.'/'.$filterFunction);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ADD:'.$filterName.'/'.$filterFunction);
$insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction);
$inserted++;
} elseif (isDebugModeEnabled()) {
}
} elseif ($active == 'R') {
// Remove this filter
- //* DEBUG: */ debugOutput('REMOVE:'.$filterName.'/'.$filterFunction);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'REMOVE:'.$filterName.'/'.$filterFunction);
$removeSQL .= sprintf(" (`filter_name`='%s' AND `filter_function`='%s') OR", $filterName, $filterFunction);
$removed++;
}
} // END - foreach
} // END - foreach
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'inserted=' . $inserted . ',removed=' . $removed . ' - AFTER COLLECTION');
+
// Something has been added?
if ($inserted > 0) {
// Finish SQL command and add it
return $content;
}
-// Filter for redirecting to logout if ext-sql_patches has been installed
-function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () {
- // Remove this filter
- unregisterFilter(__FUNCTION__, __LINE__, 'shutdown', __FUNCTION__);
-
- // Is the element set?
- if (isset($GLOBALS['ext_load_mode'])) {
- // Redirect here
- redirectToUrl('modules.php?module=admin&logout=1&' . $GLOBALS['ext_load_mode'] . '=sql_patches');
- } // END - if
-
- // This should not happen!
- logDebugMessage(__FUNCTION__, __LINE__, 'Cannot auto-logout because no extension load-mode has been set.');
-}
-
// Filter for auto-activation of a extension
function FILTER_AUTO_ACTIVATE_EXTENSION ($filterData) {
// Debug message
} // END - foreach
} // END - if
- // Is there non-HTML mode?
- if (!isHtmlOutputMode()) {
+ // Is there non-HTML/AJAX mode?
+ if ((!isHtmlOutputMode()) && (!isAjaxOutputMode())) {
$filterData = decodeEntities($filterData);
} // END - if
setIncludePool('hourly', getArrayFromDirectory('inc/hourly/', 'hourly_'));
// Update database
- if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) {
+ if ((!isConfigEntrySet('DEBUG_HOURLY')) || (!isDebugHourlyEnabled())) {
updateConfiguration('last_hour', getHour());
} // END - if
// Filter for flushing the output
function FILTER_FLUSH_OUTPUT () {
+ // Is this filter called?
+ if (isset($GLOBALS[__FUNCTION__])) {
+ // Abort here
+ reportBug(__FUNCTION__, __LINE__, 'Double call of ' . __FUNCTION__ . ' causes problems with sent headers.');
+ } // END - if
+
+ // Mark this filter as called
+ $GLOBALS[__FUNCTION__] = TRUE;
+
// Simple, he?
outputHtml();
}
// Are we in normal output mode?
if (!isHtmlOutputMode()) {
// Only in normal output mode to prevent race-conditons!
+ return;
} // END - if
// Init counter
} // END - if
// Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
- if (((getDay(getConfig('last_update')) != getDay()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (!isCssOutputMode())) {
+ if (((getDay(getConfig('last_update')) != getDay()) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('setup')) && (!isCssOutputMode())) {
// Tell every module we are in reset-mode!
doReset();
} // END - if
} // END - if
// Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
- if ((((isConfigEntrySet('last_hour')) && (getConfig('last_hour') != getHour())) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (!isCssOutputMode())) {
+ if ((((isConfigEntrySet('last_hour')) && (getConfig('last_hour') != getHour())) || (isDebugHourlyEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('setup')) && (!isCssOutputMode())) {
// Tell every module we are in reset-mode!
doHourly();
} // END - if
// Filter for displaying copyright line
function FILTER_DISPLAY_COPYRIGHT () {
// Shall we display the copyright notice?
- if ((isFullPage()) && ((getConfig('WRITE_FOOTER') == 'Y') || (isInstalling())) && ($GLOBALS['__header_sent'] == 2) && (ifCopyrightFooterEnabled())) {
+ if ((isFullPage()) && ((getWriteFooter() == 'Y') || (isInstalling())) && ($GLOBALS['__header_sent'] == 2) && (ifCopyrightFooterEnabled())) {
// Backlink enabled?
if (((isConfigEntrySet('ENABLE_BACKLINK')) && (getConfig('ENABLE_BACKLINK') == 'Y')) || (isInstalling())) {
// Copyright with backlink, thanks! :-)
// Filter for displaying parsing time
function FILTER_DISPLAY_PARSING_TIME () {
// Shall we display the parsing time and number of queries?
- // 1234 5 54 4 5 5 4 4 5543 3 4432 2 332 2 21
- if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (isFullPage())) && (!isInstallationPhase())) && (isHtmlOutputMode()) && ($GLOBALS['__header_sent'] == 2)) {
+ // 1234 5 54 4 554 4 5543 3 4432 2 332 2 21
+ if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (isShowTimingsEnabled()) && (isFullPage())) && (!isInstallationPhase())) && (isHtmlOutputMode()) && ($GLOBALS['__header_sent'] == 2)) {
// Then display it here
displayParsingTime();
} // END - if
// Filter for flushing template cache
function FILTER_FLUSH_TEMPLATE_CACHE () {
// Do not flush when debugging the template cache
- if (isDebuggingTemplateCache()) {
+ if (isDebugTemplateCacheEnabled()) {
// Do not flush templates in debug-mode
return;
} // END - if
// Is there cached eval() data?
if ((isset($GLOBALS['template_eval'])) && (count($GLOBALS['template_eval']) > 0)) {
- // Now flush all
+ // Flush all
foreach ($GLOBALS['template_eval'] as $prefix => $templateArray) {
foreach ($templateArray as $template => $eval) {
// Flush the cache (if not yet found)
// Filter for loading user data
function FILTER_FETCH_USER_DATA ($userid = NULL) {
- // Is the userid not set? Then use member id
- if (!isValidUserId($userid)) {
+ // Is the userid not set?
+ if (!isValidId($userid)) {
+ // Then use member id
$userid = getMemberId();
} // END - if
// Get user data
if (!fetchUserData($userid)) {
// Userid is not valid
- reportBug(__FUNCTION__, __LINE__, 'User id '.$userid . ' is invalid.');
+ reportBug(__FUNCTION__, __LINE__, 'User id ' . $userid . ' is invalid.');
} // END - if
// Set member id
setMemberId($userid);
+
+ // Continue with next filter
+ return $userid;
}
// Filter for reseting users' last login failure, only available with latest ext-sql_patches
// Filter for generating mails links for 'pool' mails
function FILTER_GENERATE_POOL_MAIL_LINKS ($filterData) {
- // Is type 'mid'?
- if ($filterData['type'] == 'mid') {
+ // Is type 'normal'?
+ if ($filterData['type'] == 'normal') {
// Load template
$filterData['__output'] .= loadTemplate('admin_links_' . strtolower($filterData['mail_status']) . '_pool_mail', TRUE, $filterData);
} // END - if
return $filterData;
}
+// Filter to exclude default referral id
+function FILTER_EXCLUDE_DEFAULT_REFID ($filterData = array()) {
+ // Is it valid?
+ if (isValidId(getDefRefid())) {
+ // Exclude it
+ array_push($filterData, '{?def_refid?}');
+ } // END - if
+
+ // Return it
+ return $filterData;
+}
+
// [EOF]
?>