]> git.mxchange.org Git - mailer.git/blobdiff - inc/wrapper-functions.php
fooRequestElementBar() functions renamed, adding of request parameters added:
[mailer.git] / inc / wrapper-functions.php
index 7e2856402937a850599a48ed7f7f3b9287be0fce..c9f97c7b212f8f057c1dc78425d2b18761572cb5 100644 (file)
@@ -251,12 +251,23 @@ function detectReferer () {
        return $referer;
 }
 
+// "Getter" for request URI
+function detectRequestUri () {
+       // Return it
+       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
@@ -373,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()
@@ -415,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;
@@ -761,5 +783,20 @@ function isDebuggingTemplateCache () {
        return (getConfig('DEBUG_TEMPLATE_CACHE') == 'Y');
 }
 
+// Wrapper for fetchUserData() and getUserData() calls
+function getFetchedUserData ($keyColumn, $userId, $valueColumn) {
+       // Default is 'guest'
+       $data = getMessage('USERNAME_GUEST');
+
+       // Can we fetch the user data?
+       if (($userId > 0) && (fetchUserData($userId, $keyColumn))) {
+               // Now get the data back
+               $data = getUserData($valueColumn);
+       } // END - if
+
+       // Return it
+       return $data;
+}
+
 // [EOF]
 ?>