]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
Caching of expensive PHP functions:
[mailer.git] / inc / filters.php
index a96ee6022a141e88199b0da125f3e4fc9aa2832a..2a099fe8026f25f775003715dfd625cc9c175825 100644 (file)
@@ -56,7 +56,7 @@ function FILTER_FLUSH_FILTERS () {
        // Is a database link here and not in installation mode?
        if ((!SQL_IS_LINK_UP()) && (!isInstalling())) {
                // Abort here
-               addFatalMessage(__FUNCTION__, __LINE__, getMessage('FILTER_FLUSH_FAILED_NO_DATABASE'));
+               addFatalMessage(__FUNCTION__, __LINE__, '{--FILTER_FLUSH_FAILED_NO_DATABASE--}');
                return false;
        } // END - if
 
@@ -436,7 +436,7 @@ function FILTER_COMPILE_CONFIG ($code, $compiled = false) {
        if ($compiled === true) {
                // Run the code
                $eval = "\$GLOBALS['compiled_config'][\$uncompiled] = \"" . $GLOBALS['compiled_config'][$uncompiled] . '";';
-               //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:<pre>' . str_replace('$', '&#36;', htmlentities($eval)) . '</pre>');
+               //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:<pre>' . encodeEntities($eval) . '</pre>');
                eval($eval);
        } // END - if
 
@@ -519,7 +519,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
 
 // Runs some generic filter update steps
 function FILTER_UPDATE_EXTENSION_DATA ($ext_name) {
-       // Create task
+       // Create task (we ignore the task id here)
        createExtensionUpdateTask(getCurrentAdminId(), $ext_name, $GLOBALS['update_ver'][$ext_name], SQL_ESCAPE(getExtensionNotes(getExtensionNotes())));
 
        // Update extension's version
@@ -548,7 +548,7 @@ function FILTER_RUN_RESET_INCLUDES () {
        // Is the config entry set?
        if (isExtensionInstalledAndNewer('sql_patches', '0.4.2')) {
                // Create current week mark
-               $currWeek = date('W', time());
+               $currWeek = getWeek();
 
                // Has it changed?
                if ((getConfig('last_week') != $currWeek) || ((isConfigEntrySet('DEBUG_WEEKLY')) && (getConfig('DEBUG_WEEKLY') == 'Y'))) {
@@ -560,7 +560,7 @@ function FILTER_RUN_RESET_INCLUDES () {
                } // END - if
 
                // Create current month mark
-               $currMonth = date('m', time());
+               $currMonth = getMonth();
 
                // Has it changed?
                if ((getConfig('last_month') != $currMonth) || ((isConfigEntrySet('DEBUG_MONTHLY')) && (getConfig('DEBUG_MONTHLY') == 'Y'))) {
@@ -708,7 +708,7 @@ function FILTER_RUN_DAILY_RESET () {
        if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) return;
 
        // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
-       if (((date('d', getConfig('last_update')) != date('d', time())) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (getOutputMode() != 1)) {
+       if (((getDay(getConfig('last_update')) != getDay()) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (getOutputMode() != 1)) {
                // Tell every module we are in reset-mode!
                doReset();
        } // END - if
@@ -940,7 +940,7 @@ function FILTER_DO_LOGIN_ADMIN ($data) {
        $GLOBALS['admin_login_success'] = ((
                setSession('admin_md5', encodeHashForCookie($data['pass_hash']))
        ) && (
-               setSession('admin_login', $data['login'])
+               setSession('admin_id', $data['id'])
        ) && (
                setSession('admin_last', time())
        ));