X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=c91f93e88c2ff2dacb6ec88956f376df6c1f8ae7;hp=a184c20331912e39e1c1e0651c62ed124c88bd51;hb=29b786a66a86385b5c3060c68834f30b89407a6b;hpb=30813af329c1e3f07932fc53adee1a37d78f01c2 diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index a184c20331..c91f93e88c 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -968,5 +968,81 @@ function compileSqlConfig ($sqlString) { return $sqlString; } +// 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; +} + // [EOF] ?>