Extension ext-cprping introduced (dummy), 'install' directory excluded from GNU GPL:
[mailer.git] / inc / wrapper-functions.php
index 29638a8fc99c9d2fe42fe582c3f603d16c0f0ab2..308f7439a6b589421729f0fabed41f4b50deb8f0 100644 (file)
@@ -481,33 +481,6 @@ function copyFileVerified ($source, $dest, $chmod = '') {
        return $status;
 }
 
-// Wrapper function for header()
-// Send a header but checks before if we can do so
-function sendHeader ($header) {
-       // Send the header
-       //* DEBUG: */ logDebugMessage(__FUNCTION__ . ': header=' . $header);
-       $GLOBALS['header'][] = trim($header);
-}
-
-// Flushes all headers
-function flushHeaders () {
-       // Is the header already sent?
-       if (headers_sent()) {
-               // Then abort here
-               debug_report_bug(__FUNCTION__, __LINE__, 'Headers already sent!');
-       } // END - if
-
-       // Flush all headers if found
-       if ((isset($GLOBALS['header'])) && (is_array($GLOBALS['header']))) {
-               foreach ($GLOBALS['header'] as $header) {
-                       header($header);
-               } // END - foreach
-       } // END - if
-
-       // Mark them as flushed
-       $GLOBALS['header'] = array();
-}
-
 // Wrapper function for chmod()
 // @TODO Do some more sanity check here
 function changeMode ($FQFN, $mode) {
@@ -674,7 +647,7 @@ function isModuleSet ($strict =  false) {
        // Should we abort here?
        if (($strict === true) && ($isset === false)) {
                // Output backtrace
-               debug_report_bug(__FUNCTION__, __LINE__, 'module is empty.');
+               debug_report_bug(__FUNCTION__, __LINE__, 'Module is empty.');
        } // END - if
 
        // Return it
@@ -1148,10 +1121,10 @@ function sendRawRedirect ($url) {
                (preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($_SERVER['SERVER_SOFTWARE']), $matches)) &&
                ($matches[1] < 6)) {
                // Send the IIS header
-               sendHeader('Refresh: 0;url=' . $url);
+               addHttpHeader('Refresh: 0;url=' . $url);
        } else {
                // Send generic header
-               sendHeader('Location: ' . $url);
+               addHttpHeader('Location: ' . $url);
        }
 
        // Shutdown here
@@ -1523,11 +1496,11 @@ function isWhatTitleEnabled () {
 }
 
 // Checks wether stats are enabled
-function ifStatsAreEnabled () {
+function ifInternalStatsEnabled () {
        // Do we have cache?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Then determine it
-               $GLOBALS[__FUNCTION__] = (getConfig('stats_enabled') == 'Y');
+               $GLOBALS[__FUNCTION__] = (getConfig('internal_stats') == 'Y');
        } // END - if
 
        // Return cached value
@@ -2539,6 +2512,18 @@ function isDirectPaymentEnabled () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// Checks wether JavaScript-based admin menu is enabled
+function isAdminMenuJavascriptEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = ((isExtensionInstalledAndNewer('sql_patches', '0.8.7')) && (getConfig('admin_menu_javascript') == 'Y'));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // Wrapper to check if current task is for extension (not update)
 function isExtensionTask ($content) {
        // Do we have cache?
@@ -2657,16 +2642,23 @@ function convertCommaToDotInPostDataArray ($postEntries) {
  * @link       http://de.php.net/manual/en/function.floatval.php#92563
  */
 function parseFloat ($floatString){
-    $LocaleInfo = localeconv();
-    $floatString = str_replace($LocaleInfo['mon_thousands_sep'] , '', $floatString);
-    $floatString = str_replace($LocaleInfo['mon_decimal_point'] , '.', $floatString);
-    return floatval($floatString);
+       // Load locale info
+       $LocaleInfo = localeconv();
+
+       // Remove thousand separators
+       $floatString = str_replace($LocaleInfo['mon_thousands_sep'] , '' , $floatString);
+
+       // Convert decimal point
+       $floatString = str_replace($LocaleInfo['mon_decimal_point'] , '.', $floatString);
+
+       // Return float value of converted string
+       return floatval($floatString);
 }
 
 // Generates a YES/NO option list from given default
-function generateYesNoOptionList ($configValue = '') {
+function generateYesNoOptionList ($defaultValue = '') {
        // Generate it
-       return generateOptionList('/ARRAY/', array('Y', 'N'), array('{--YES--}', '{--NO--}'), $configValue);
+       return generateOptionList('/ARRAY/', array('Y', 'N'), array('{--YES--}', '{--NO--}'), $defaultValue);
 }
 
 // "Getter" for total available receivers