X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=38a6eb12d2288b27863acdfe0948e317ce16fae9;hb=98a2635f8981bed79299e60de1ccc2cf094f2d03;hp=de2d8c0fdb9c613f1c536a6b6047d13474174ccf;hpb=62b4ef5bb0b63f7cac5f0dccd816246a108a5d83;p=mailer.git diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index de2d8c0fdb..38a6eb12d2 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -257,12 +257,17 @@ function detectRequestUri () { return (getenv('REQUEST_URI')); } +// "Getter" for query string +function detectQueryString () { + return str_replace('&', '&', (getenv('QUERY_STRING'))); +} + // Check wether we are installing function isInstalling () { // Determine wether we are installing if (!isset($GLOBALS['mxchange_installing'])) { // Check URL (css.php/js.php need this) - $GLOBALS['mxchange_installing'] = isGetRequestElementSet('installing'); + $GLOBALS['mxchange_installing'] = isGetRequestParameterSet('installing'); } // END - if // Return result @@ -379,14 +384,25 @@ function copyFileVerified ($source, $dest, $chmod = '') { // Wrapper function for header() // Send a header but checks before if we can do so function sendHeader ($header) { + // Send the header + $GLOBALS['header'][] = trim($header); +} + +// Flushes all headers +function flushHeaders () { // Is the header already sent? if (headers_sent()) { // Then abort here debug_report_bug('Headers already sent!'); } // END - if - // Send the header - header(trim($header)); + // Flush all headers + foreach ($GLOBALS['header'] as $header) { + header($header); + } // END - foreach + + // Mark them as flushed + $GLOBALS['header'] = array(); } // Wrapper function for chmod() @@ -421,9 +437,9 @@ function removeFile ($FQFN) { // Wrapper for $_POST['sel'] function countPostSelection ($element = 'sel') { // Is it set? - if (isPostRequestElementSet($element)) { + if (isPostRequestParameterSet($element)) { // Return counted elements - return countSelection(postRequestElement($element)); + return countSelection(postRequestParameter($element)); } else { // Return zero if not found return 0; @@ -488,7 +504,7 @@ function setWhatFromConfig ($configEntry) { // Checks wether what is set and optionally aborts on miss function isWhatSet ($strict = false) { // Check for it - $isset = (isset($GLOBALS['what'])); + $isset = isset($GLOBALS['what']); // Should we abort here? if (($strict === true) && ($isset === false)) { @@ -523,7 +539,7 @@ function setAction ($newAction) { // Checks wether action is set and optionally aborts on miss function isActionSet ($strict = false) { // Check for it - $isset = (isset($GLOBALS['action'])); + $isset = ((isset($GLOBALS['action'])) && (!empty($GLOBALS['action']))); // Should we abort here? if (($strict === true) && ($isset === false)) { @@ -659,7 +675,17 @@ function setUsername ($userName) { // Get username function getUsername () { - return $GLOBALS['username']; + // default is guest + $username = getMessage('USERNAME_GUEST'); + + // User name set? + if (isset($GLOBALS['username'])) { + // Use the set name + $username = $GLOBALS['username']; + } // END - if + + // Return it + return $username; } // Wrapper function for installation phase