X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=ee75b3a0d2c0e3c098b30175aad2cc8e380061b6;hp=f9bdf90e029da5655300645f60fee2986f20b986;hb=0366eb054abf51874a4272fc9b89673af1fb793b;hpb=d92a340159ca45047eafc111fcac64933a7babeb
diff --git a/inc/functions.php b/inc/functions.php
index f9bdf90e02..ee75b3a0d2 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -820,10 +820,10 @@ function translateGender ($gender) {
case 'F': $ret = getMessage('GENDER_F'); break;
case 'C': $ret = getMessage('GENDER_C'); break;
default:
- // Log unknown gender
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown gender %s detected.", $gender));
+ // Please report bugs on unknown genders
+ debug_report_bug(sprintf("Unknown gender %s detected.", $gender));
break;
- }
+ } // END - switch
// Return translated gender
return $ret;
@@ -845,8 +845,8 @@ function translateUserStatus ($status) {
break;
default:
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status));
- $ret = getMaskedMessage('UNKNOWN_STATUS', $status);
+ // Please report all unknown status
+ debug_report_bug(sprintf("Unknown status %s detected.", $status));
break;
} // END - switch
@@ -922,7 +922,7 @@ function makeTime ($hours, $minutes, $seconds, $stamp) {
}
// Redirects to an URL and if neccessarry extends it with own base URL
-function redirectToUrl ($URL) {
+function redirectToUrl ($URL, $allowSpider = true) {
// Compile out codes
eval('$URL = "' . compileRawCode(encodeUrl($URL)) . '";');
@@ -941,7 +941,7 @@ function redirectToUrl ($URL) {
//* DEBUG: */ die($URL);
// Simple probe for bots/spiders from search engines
- if (isSpider()) {
+ if ((isSpider()) && ($allowSpider === true)) {
// Secure the URL against bad things such als HTML insertions and so on...
$URL = secureString($URL);
@@ -1648,10 +1648,9 @@ function createFancyTime ($stamp) {
// Generates a navigation row for listing emails
function addEmailNavigation ($PAGES, $offset, $show_form, $colspan, $return=false) {
- $SEP = ''; $TOP = '';
+ $TOP = '';
if ($show_form === false) {
$TOP = " top";
- $SEP = "
|
";
}
$NAV = '';
@@ -1687,7 +1686,6 @@ function addEmailNavigation ($PAGES, $offset, $show_form, $colspan, $return=fals
$content['nav'] = $NAV;
$content['span'] = $colspan;
$content['top'] = $TOP;
- $content['sep'] = $SEP;
// Load navigation template
$OUT = loadTemplate('admin_email_nav_row', true, $content);
@@ -2281,6 +2279,12 @@ function app_die ($F, $L, $message) {
// Make sure, that the script realy realy diese here and now
$GLOBALS['app_died'] = true;
+ // Set content type if not set
+ if (!isContentTypeSet()) {
+ // text/html is the right one
+ setContentType('text/html');
+ } // END - if
+
// Load header
loadIncludeOnce('inc/header.php');
@@ -3679,7 +3683,7 @@ function isTemplateCached ($template) {
// Do we have cached this result?
if (!isset($GLOBALS['template_cache'][$template])) {
// Generate FQFN
- $FQFN = sprintf("%s_compiled/templates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
+ $FQFN = generateCacheFqfn($template);
// Is it there?
$GLOBALS['template_cache'][$template] = isFileReadable($FQFN);
@@ -3694,7 +3698,7 @@ function flushTemplateCache ($template, $eval) {
// Is this cache flushed?
if ((isDebuggingTemplateCache() === false) && (isTemplateCached($template) === false) && ($eval != '404')) {
// Generate FQFN
- $FQFN = sprintf("%s_compiled/templates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
+ $FQFN = generateCacheFqfn($template);
// Replace username with a call
$eval = str_replace('$username', '".getUsername()."', $eval);
@@ -3709,7 +3713,7 @@ function readTemplateCache ($template) {
// Check it again
if ((isDebuggingTemplateCache() === false) && (isTemplateCached($template))) {
// Generate FQFN
- $FQFN = sprintf("%s_compiled/templates/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
+ $FQFN = generateCacheFqfn($template);
// And read from it
$GLOBALS['template_eval'][$template] = readFromFile($FQFN);
@@ -3812,21 +3816,21 @@ function sendModeMails ($mod, $modes) {
$sub_mem = getMessage('MEMBER_CHANGED_DATA');
// Output success message
- $content = "{--MYDATA_MAIL_SENT--}";
+ $content = '{--MYDATA_MAIL_SENT--}';
break;
default: // Unsupported module!
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unsupported module %s detected.", $mod));
- $content = "{--UNKNOWN_MODULE--}";
+ $content = '{--UNKNOWN_MODULE--}';
break;
} // END - switch
} else {
// Passwords mismatch
- $content = "{--MEMBER_PASSWORD_ERROR--}";
+ $content = '{--MEMBER_PASSWORD_ERROR--}';
}
} else {
// Could not load profile
- $content = "{--MEMBER_CANNOT_LOAD_PROFILE--}";
+ $content = '{--MEMBER_CANNOT_LOAD_PROFILE--}';
}
// Send email to user if required
@@ -3907,8 +3911,8 @@ function getModuleFromFileName ($file, $accessLevel) {
// Encodes an URL for adding session id, etc.
function encodeUrl ($url, $outputMode = '0') {
- // Do we have already have a PHPSESSID inside? Then it is already converted...
- if (strpos($url, session_name()) !== false) return $url;
+ // Do we have already have a PHPSESSID inside or view.php is called? Then abort here
+ if ((strpos($url, session_name()) !== false) || (getOutputMode() == -3)) return $url;
// Do we have a valid session?
if (((!isset($GLOBALS['valid_session'])) || ($GLOBALS['valid_session'] === false) || (!isset($_COOKIE[session_name()]))) && (isSpider() === false)) {
@@ -4011,6 +4015,18 @@ function generateMetaDescriptionCode () {
unset($GLOBALS['ref_level']);
}
+// Generates an FQFN for template cache from the given template name
+function generateCacheFqfn ($template) {
+ // Is this cached?
+ if (!isset($GLOBALS['template_cache_fqfn'][$template])) {
+ // Generate the FQFN
+ $GLOBALS['template_cache_fqfn'][$template] = sprintf("%s_compiled/html/%s.tpl.cache", getConfig('CACHE_PATH'), $template);
+ } // END - if
+
+ // Return it
+ return $GLOBALS['template_cache_fqfn'][$template];
+}
+
//////////////////////////////////////////////////
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
//////////////////////////////////////////////////
@@ -4025,7 +4041,7 @@ if (!function_exists('html_entity_decode')) {
} // END - if
if (!function_exists('http_build_query')) {
- // Taken from documentation on www.php.net, credits to Marco K. (Germany)
+ // Taken from documentation on www.php.net, credits to Marco K. (Germany) and some light mods by R.Haeder
function http_build_query($data, $prefix = '', $sep = '', $key = '') {
$ret = array();
foreach ((array)$data as $k => $v) {
@@ -4033,7 +4049,7 @@ if (!function_exists('http_build_query')) {
$k = urlencode($prefix . $k);
} // END - if
- if ((!empty($key)) || ($key === 0)) $k = $key.'['.urlencode($k).']';
+ if ((!empty($key)) || ($key === 0)) $k = $key . '[' . urlencode($k) . ']';
if (is_array($v) || is_object($v)) {
array_push($ret, http_build_query($v, '', $sep, $k));