X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=ff399cbf86e0066338a557a3293c8e1630b37751;hp=8877bcc150e85ff0c92416d0088ac8b35e44235e;hb=1c4e78c5d68b97b82a3b930aa6db1e6df188f653;hpb=7a2bf6b757eb25795956d48453f1afa940156bc5 diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 8877bcc150..ff399cbf86 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -697,7 +697,7 @@ function addPointsDirectly ($subject, $userid, $points) { // Wrapper function to redirect from member-only modules to index function redirectToIndexMemberOnlyModule () { // Do the redirect here - redirectToUrl('modules.php?module=index&code=' . getCode('MODULE_MEM_ONLY') . '&mod=' . getModule()); + redirectToUrl('modules.php?module=index&code=' . getCode('MODULE_MEMBER_ONLY') . '&mod=' . getModule()); } // Wrapper function to redirect to current URL @@ -722,7 +722,7 @@ function isExtensionInstalledAndNewer ($ext_name, $version) { } // Return it - //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=>'.$version.':'.intval($GLOBALS['ext_installed_newer'][$ext_name][$version]).'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':'.$ext_name.'=>'.$version.':'.intval($GLOBALS['ext_installed_newer'][$ext_name][$version])); return $GLOBALS['ext_installed_newer'][$ext_name][$version]; } @@ -737,7 +737,7 @@ function isExtensionInstalledAndOlder ($ext_name, $version) { } // Return it - //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'<'.$version.':'.intval($GLOBALS['ext_installed_older'][$ext_name][$version]).'
'; + //* DEBUG: */ debugOutput(__FUNCTION__.':'.$ext_name.'<'.$version.':'.intval($GLOBALS['ext_installed_older'][$ext_name][$version])); return $GLOBALS['ext_installed_older'][$ext_name][$version]; } @@ -956,5 +956,98 @@ function getHttpStatus () { return $GLOBALS['http_status']; } +// Setter for 'is_template_html' +function enableTemplateHtml ($enable = true) { + $GLOBALS['is_template_html'] = (bool) $enable; +} + +// Checks wether the template is HTML or not by previously set flag +// Default: true +function isTemplateHtml () { + // Is the output_mode other than 0 (HTML), then no comments are enabled + if (getOutputMode() != 0) { + // No HTML + return false; + } else { + // Maybe HTML? + return $GLOBALS['is_template_html']; + } +} + +/** + * Send a HTTP redirect to the browser. This function was taken from DokuWiki + * (GNU GPL 2; http://www.dokuwiki.org) and modified to fit into mailer project. + * + * ---------------------------------------------------------------------------- + * If you want to redirect, please use redirectToUrl(); instead + * ---------------------------------------------------------------------------- + * + * Works arround Microsoft IIS cookie sending bug. Does exit the script. + * + * @link http://support.microsoft.com/kb/q176113/ + * @author Andreas Gohr + * @access private + */ +function sendRawRedirect ($url) { + // always close the session + session_write_close(); + + // Revert entity & + $url = str_replace('&', '&', $url); + + // check if running on IIS < 6 with CGI-PHP + if ((isset($_SERVER['SERVER_SOFTWARE'])) && (isset($_SERVER['GATEWAY_INTERFACE'])) && + (strpos($_SERVER['GATEWAY_INTERFACE'],'CGI') !== false) && + (preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($_SERVER['SERVER_SOFTWARE']), $matches)) && + ($matches[1] < 6)) { + // Send the IIS header + sendHeader('Refresh: 0;url=' . $url); + } else { + // Send generic header + sendHeader('Location: ' . $url); + } + + // Shutdown here + shutdown(); +} + +// Determines the country of the given user id +function determineCountry ($userid) { + // Default is 'invalid' + $country = 'invalid'; + + // Is extension country active? + if (isExtensionActive('country')) { + // Determine the right country code through the country id + $id = getUserData('country_code'); + + // Then handle it over + $country = generateCountryInfo($id); + } else { + // Get raw code from user data + $country = getUserData('country'); + } + + // Return it + return $country; +} + +// "Getter" for total confirmed user accounts +function getTotalConfirmedUser () { + // Is it cached? + if (!isset($GLOBALS['total_confirmed_users'])) { + // Then do it + $GLOBALS['total_confirmed_users'] = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true); + } // END - if + + // Return cached value + return $GLOBALS['total_confirmed_users']; +} + +// Wrapper for writing debug informations to the browser +function debugOutput ($message) { + outputHtml('
' . $message . '
'); +} + // [EOF] ?>