]> git.mxchange.org Git - mailer.git/blobdiff - inc/filters.php
Installer content encapsulated in inc/install-functions.php
[mailer.git] / inc / filters.php
index 254630b39eb25aca5da88beeb32fc74b9b8a978f..2a11b82da0c121311e25cf6a305aeaf741d82578 100644 (file)
@@ -165,10 +165,12 @@ function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () {
 
 // Filter for auto-activation of a extension
 function FILTER_AUTO_ACTIVATE_EXTENSION ($data) {
+       // Debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $data['ext_name'] . ',isExtensionAlwaysActive()=' . intval(isExtensionAlwaysActive()));
+
        // Is this extension always activated?
        if (isExtensionAlwaysActive()) {
                // Then activate the extension
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "ext_name={$data['ext_name']}<br />");
                doActivateExtension($data['ext_name']);
        } // END - if
 
@@ -242,13 +244,16 @@ function FILTER_LOAD_INCLUDES ($pool) {
 // Filter for running SQL commands
 function FILTER_RUN_SQLS ($data) {
        // Debug message
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "- Entered!");
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Entered!');
 
        // Is the array there?
        if ((isSqlsValid()) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) {
                // Run SQL commands
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "- Found ".countSqls()." queries to run.");
-               foreach (getSqls() as $sqls) {
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Found ' . countSqls() . ' queries to run.');
+               foreach (getSqls() as $mode=>$sqls) {
+                       // Debug message
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mode=' . $mode . ',count()=' . count($sqls));
+
                        // New cache format...
                        foreach ($sqls as $sql) {
                                // Trim spaces away
@@ -266,7 +271,7 @@ function FILTER_RUN_SQLS ($data) {
                                                SQL_ALTER_TABLE($sql, __FUNCTION__, __LINE__, $data['enable_codes']);
                                        } else {
                                                // Run regular SQL command
-                                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Running regular query: ' . $sql . ',enable_codes=' . intval($data['enable_codes']);
+                                               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Running regular query: ' . $sql . ',enable_codes=' . intval($data['enable_codes']));
                                                SQL_QUERY($sql, __FUNCTION__, __LINE__, $data['enable_codes']);
                                        }
                                } // END - if
@@ -275,7 +280,7 @@ function FILTER_RUN_SQLS ($data) {
        } // END - if
 
        // Debug message
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "- Left!");
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Left!');
 }
 
 // Filter for updating/validating login data
@@ -497,7 +502,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                        } // END - if
 
                        // Construct call-back function name for the command
-                       $commandFunction = 'doExpression' . ucfirst(strtolower($cmd));
+                       $commandFunction = 'doExpression' . capitalizeUnderscoreString($cmd);
 
                        // Is this function there?
                        if (function_exists($commandFunction)) {
@@ -518,7 +523,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                                $code = call_user_func($commandFunction, $data);
                        } else {
                                // Unsupported command detected
-                               debug_report_bug(__FUNCTION__, __LINE__, 'Command=' . $cmd . ', callback=' . $callback . ', extra=' . $extraFunction . ' is unsupported.');
+                               logDebugMessage(__FUNCTION__, __LINE__, 'Command=' . $cmd . ', callback=' . $callback . ', extra=' . $extraFunction . ' is unsupported.');
                        }
                } // END - foreach
        } // END - if
@@ -969,11 +974,8 @@ function FILTER_DO_LOGIN_ADMIN ($data) {
 
 // Filter for loading page header, this should be ran first!
 function FILTER_LOAD_PAGE_HEADER () {
-       // Determine the page title
-       $content['header_title'] = determinePageTitle();
-
        // Output page header code
-       $GLOBALS['page_header'] = loadTemplate('page_header', true, $content);
+       $GLOBALS['page_header'] = loadTemplate('page_header', true);
 
        // Include meta data in 'guest' module
        if (getModule() == 'index') {
@@ -1014,5 +1016,15 @@ function FILTER_CLEANUP_DNS_CACHE () {
        } // END - if
 }
 
+// Filter for setting CURRENT_DATE, this is required after initialization of extensions
+function FILTER_SET_CURRENT_DATE () {
+       // Set current date
+       setConfigEntry('CURRENT_DATE', generateDateTime(time(), '3'));
+
+       // Timestamp for yesterday, today ... all at 00:00 am
+       setConfigEntry('START_YDAY', makeTime(0, 0, 0, time() - getConfig('ONE_DAY')));
+       setConfigEntry('START_TDAY', makeTime(0, 0, 0, time()));
+}
+
 // [EOF]
 ?>