More filters created, TODOs.txt updated, config_mediadata fixed
[mailer.git] / inc / filters.php
index 5b007f3d2132d9721e619a87cf183e076d3acee6..a91dee3e0faae187ef5c8dc4fd714e0d8e3e1a13 100644 (file)
@@ -696,5 +696,122 @@ function FILTER_INIT_RANDOM_NUMBER () {
        setConfigEntry('CACHE_BUSTER', getConfig('RAND_NUMBER'));
 }
 
+// Update module counter
+function FILTER_COUNT_MODULE () {
+       // Do count all other modules but not accesses on CSS file css.php!
+       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `clicks`=`clicks`+1 WHERE `module`='%s' LIMIT 1",
+               array(getModule()), __FUNCTION__, __LINE__);
+}
+
+// Handles fatal errors
+function FILTER_HANDLE_FATAL_ERRORS () {
+       // Do we have errors to handle and right output mode?
+       if ((getTotalFatalErrors() == 0) || (getOutputMode() != 0)) {
+               // Abort executing here
+               return false;
+       } // END - if
+
+       // Set content type
+       setContentType('text/html');
+
+       // Load config here
+       loadIncludeOnce('inc/load_config.php');
+
+       // Set unset variable
+       if (empty($check)) $check = '';
+
+       // Default is none
+       $content = '';
+
+       // Installation phase or regular mode?
+       if ((isInstallationPhase())) {
+               // While we are installing ouput other header than while it is installed... :-)
+               $OUT = '';
+               foreach (getFatalArray() as $key => $value) {
+                       // Prepare content for the template
+                       $content = array(
+                               'key'   => ($key + 1),
+                               'value' => $value
+                       );
+
+                       // Load row template
+                       $OUT .= loadTemplate('install_fatal_row', true, $content);
+               }
+
+               // Load main template
+               $content = loadTemplate('install_fatal_table', true, $OUT);
+       } elseif (isInstalled()) {
+               // Display all runtime fatal errors
+               $OUT = '';
+               foreach (getFatalArray() as $key => $value) {
+                       // Prepare content for the template
+                       $content = array(
+                               'key'   => ($key + 1),
+                               'value' => $value
+                       );
+
+                       // Load row template
+                       $OUT .= loadTemplate('runtime_fatal_row', true, $content);
+               }
+
+               // Load main template
+               $content = loadTemplate('runtime_fatal_table', true, $OUT);
+       }
+
+       // Message to regular users (non-admin)
+       $CORR = getMessage('FATAL_REPORT_ERRORS');
+
+       // PHP warnings fixed
+       if ($check == 'done') {
+               if (isAdmin()) $CORR = getMessage('FATAL_CORRECT_ERRORS');
+       } // END - if
+
+       // Remember all in array
+       $content = array(
+               'rows' => $content,
+               'corr' => $CORR
+       );
+
+       // Load footer
+       loadIncludeOnce('inc/header.php');
+
+       // Load main template
+       loadTemplate('fatal_errors', false, $content);
+
+       // Delete all to prevent double-display
+       initFatalMessages();
+
+       // Load footer
+       loadIncludeOnce('inc/footer.php');
+
+       // Abort here
+       shutdown();
+}
+
+// Filter for displaying copyright line
+function FILTER_DISPLAY_COPYRIGHT () {
+       // Shall we display the copyright notice?
+       if ((!isGetRequestElementSet('frame')) && (basename($_SERVER['PHP_SELF']) != 'mailid_top.php') && ((getConfig('WRITE_FOOTER') == 'Y') || (isInstalling())) && ($GLOBALS['header_sent'] == 2)) {
+               // Backlink enabled?
+               if ((getConfig('ENABLE_BACKLINK') == 'Y') || (isInstalling())) {
+                       // Copyright with backlink, thanks! :-)
+                       loadTemplate('copyright_backlink');
+               } else {
+                       // No backlink in Copyright note
+                       loadTemplate('copyright');
+               }
+       } // END - if
+}
+
+// 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                       5       543    3                   4432    2             33     2    2                              21
+       if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (!isGetRequestElementSet('frame'))) || (isInstallationPhase())) && (getOutputMode() == 0) && ($GLOBALS['header_sent'] == 2)) {
+               // Then display it here
+               displayParsingTime();
+       } // END - if
+}
+
 // [EOF]
 ?>