X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilters.php;h=27e981fc0acd2989336659ebd9bde3d022da7127;hb=8848f4a3fd7b32a1bbd9139766171701b94b2f42;hp=e20d71821634e5103137441b894e0df7916b74cd;hpb=e5dffd4249c97200cbad02f3f4eaf5c373fdb89a;p=mailer.git diff --git a/inc/filters.php b/inc/filters.php index e20d718216..27e981fc0a 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -10,13 +10,8 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Allgemeine Filter * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * Copyright (c) 2009 - 2015 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -247,7 +242,7 @@ function FILTER_RUN_SQLS ($filterData) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Entered!'); // Is the array there? - if ((isSqlsValid()) && ((!isset($filterData['dry_run'])) || ($filterData['dry_run'] == FALSE))) { + if ((ifSqlsRegistered()) && ((!isset($filterData['dry_run'])) || ($filterData['dry_run'] == FALSE))) { // Run SQL commands //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Found ' . countSqls() . ' queries to run.'); foreach (getSqls() as $mode => $sqls) { @@ -711,25 +706,6 @@ function FILTER_FLUSH_OUTPUT () { outputHtml(); } -// Prepares an SQL statement part for HTML mail and/or holiday dependency -function FILTER_HTML_INCLUDE_USERS ($mode) { - // Exclude no users by default - $MORE = ''; - - // HTML mail? - if ($mode == 'html') { - $MORE = " AND `html`='Y'"; - } // END - if - - if (isExtensionInstalledAndNewer('holiday', '0.1.3')) { - // Add something for the holiday extension - $MORE .= " AND `holiday_active`='N'"; - } // END - if - - // Return result - return $MORE; -} - // Filter for determining what/action/module function FILTER_DETERMINE_WHAT_ACTION () { // In installation phase we don't have what/action @@ -826,22 +802,6 @@ function FILTER_TRIGGER_SENDING_POOL () { unset($GLOBALS['pool_cnt']); } -// Filter for checking and updating SVN revision -function FILTER_CHECK_REPOSITORY_REVISION () { - // Only execute this filter if installed and all config entries are there - if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) { - return; - } // END - if - - // Check for patch level differences between database and current hard-coded - if ((getCurrentRepositoryRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURRENT_REPOSITORY_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) { - // Update database and CONFIG array - updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrentRepositoryRevision(), 'UNIX_TIMESTAMP()')); - setConfigEntry('patch_level', getCurrentRepositoryRevision()); - setConfigEntry('patch_ctime', time()); - } // END - if -} - // Filter for running hourly reset function FILTER_RUN_HOURLY_RESET () { // Only execute this filter if installed @@ -920,12 +880,18 @@ function FILTER_RUN_YEARLY_RESET () { // Filter for loading more runtime includes (not for installation) function FILTER_LOAD_RUNTIME_INCLUDES () { // Load more includes - foreach (array('databases', 'session', 'versions') as $inc) { + foreach (array('databases') as $inc) { // Load the include loadIncludeOnce('inc/' . $inc . '.php'); } // END - foreach } +// Filter for initializing language by loading the language file +function FILTER_INIT_LANGUAGE () { + // Load language file(s) + loadLanguageFile(); +} + // Filter for checking admin ACL function FILTER_CHECK_ADMIN_ACL () { // Extension not installed so it's always allowed to access everywhere! @@ -1050,8 +1016,8 @@ function FILTER_HANDLE_FATAL_ERRORS () { 'corr' => $CORR ); - // Load footer - loadIncludeOnce('inc/header.php'); + // Load header + loadPageHeader(); // Load main template loadTemplate('fatal_errors', FALSE, $content); @@ -1060,7 +1026,7 @@ function FILTER_HANDLE_FATAL_ERRORS () { initFatalMessages(); // Load footer - loadIncludeOnce('inc/footer.php'); + loadPageFooter(); // Abort here doShutdown(); @@ -1257,7 +1223,7 @@ function FILTER_ACTIVATE_EXCHANGE () { // Check total amount of users if (getTotalConfirmedUser() >= getActivateXchange()) { // Activate System - addSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N',`hidden`='N',`mem_only`='Y' WHERE `module`='order' LIMIT 1"); + addSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N',`mem_only`='Y' WHERE `module`='order' LIMIT 1"); addSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `what`='order' OR `what`='unconfirmed' LIMIT 2"); // Run SQLs @@ -1302,27 +1268,34 @@ function FILTER_ADD_HISTORY_ENTRY ($filterData) { // Filter for initializing ext-sql_patches function FILTER_GENERATE_FILE_SECRET_HASH ($filterData) { - // Transfer POINTS word - if (isExtensionInstalledAndNewer('sql_patches', '0.0.3')) { - // Okay, recent enough, so transfer the word for POINTS - setConfigEntry('POINTS', getPointsWord()); + // Is ext-sql_patches installed and transfer POINTS word? + if ((!isExtensionInstalled('sql_patches')) || (!isExtensionInstalledAndNewer('sql_patches', '0.9.0'))) { + // Extension ext-sql_patches is missing, so better abort here + return; } // END - if + // Okay, recent enough, so transfer the word for POINTS + setConfigEntry('POINTS', getPointsWord()); + // Init key setConfigEntry('secret_key', ''); - // File hash fas generated so we can also file the secret file... hopefully. - $hashFile = sprintf('%s%s.%s.cache', getPath(), getCachePath(), getFileHash()); + // File hash was generated so we can also file the secret file... hopefully. + $hashFile = getGenericHashFileName(); // Read key from secret file if ((getFileHash() == '') || (getMasterSalt() == '') || (getPassScramble() == '') || (!isFileReadable($hashFile))) { // Maybe need setup of secret key! loadIncludeOnce('inc/gen_sql_patches.php'); + + // Generate file name again + $hashFile = getGenericHashFileName(); } // END - if // Test again if ((getFileHash() != '') && (getMasterSalt() != '') && (getPassScramble() != '')) { // Is the secret key file readable? + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'hashFile=' . $hashFile); if (isFileReadable($hashFile)) { // Read file setConfigEntry('secret_key', readFromFile($hashFile)); @@ -1365,7 +1338,7 @@ function FILTER_HANDLE_REFERRER_BANNER_CLICK ($filterData) { // Check required parameters if ((isGetRequestElementSet('user')) && (isGetRequestElementSet('banner'))) { // Update clicks counter... - sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1", + sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `clicks`=`clicks`+1 WHERE `id`=%s LIMIT 1', array(bigintval(getRequestElement('banner'))), __FUNCTION__, __LINE__); // A line has been updated? @@ -1384,7 +1357,7 @@ function FILTER_HANDLE_REFERRER_BANNER_VIEW ($filterData) { // Are all required parameters set if ((isGetRequestElementSet('user')) && (isGetRequestElementSet('banner'))) { // For later things... ;-) - $result = sqlQueryEscaped("SELECT `url` FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `id`=%s LIMIT 1", + $result = sqlQueryEscaped('SELECT `url` FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `id`=%s LIMIT 1', array(bigintval(getRequestElement('banner'))), __FUNCTION__, __LINE__); // Is there the banner? @@ -1393,7 +1366,7 @@ function FILTER_HANDLE_REFERRER_BANNER_VIEW ($filterData) { $data = sqlFetchArray($result); // Update counter - sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `counter`=`counter`+1 WHERE `id`=%s LIMIT 1", + sqlQueryEscaped('UPDATE `{?_MYSQL_PREFIX?}_refbanner` SET `counter`=`counter`+1 WHERE `id`=%s LIMIT 1', array(bigintval(getRequestElement('banner'))), __FUNCTION__, __LINE__); // Set header and ... @@ -1435,7 +1408,7 @@ function FILTER_REDIRECT_WRONG_SERVER_NAME ($filterData) { // Filter for adding hidden session id function FILTER_ADD_INPUT_HIDDEN_SESSION_ID ($filterData) { // Is a spider detected? - if ((!isSpider()) && (!isSessionValid()) && ($filterData['__form_method'] == 'get')) { + if ((!isSpider()) && (!isValidSession()) && ($filterData['__form_method'] == 'get')) { // No, then add the hidden field $filterData['__replacer'] .= ''; } // END - if