Fix for latest PHP 5.4.x changes
[mailer.git] / inc / wrapper-functions.php
index f9ebb56b1177e7f68491d5bb84d5a1ef21e392d3..5195c0c1e7c716abe6bffe17f24367b875cb2994 100644 (file)
@@ -540,12 +540,12 @@ function isNicknameUsed ($userid) {
 }
 
 // Getter for 'what' value
-function getWhat () {
+function getWhat ($strict = true) {
        // Default is null
        $what = NULL;
 
        // Is the value set?
-       if (isWhatSet(true)) {
+       if (isWhatSet($strict)) {
                // Then use it
                $what = $GLOBALS['__what'];
        } // END - if
@@ -677,7 +677,9 @@ function getScriptOutputMode () {
 
 // Setter for 'output_mode' value
 function setOutputMode ($newOutputMode) {
-       $GLOBALS['output_mode'] = (int) $newOutputMode;
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'output_mode=' . $newOutputMode);
+       $GLOBALS['output_mode']         = (int) $newOutputMode;
+       $GLOBALS['getScriptOutputMode'] = (int) $newOutputMode;
 }
 
 // Checks wether output_mode is set and optionally aborts on miss
@@ -1106,6 +1108,15 @@ function getHttpStatus () {
  * @access  private
  */
 function sendRawRedirect ($url) {
+       // Clear output buffer
+       clearOutputBuffer();
+
+       // Clear own output buffer
+       $GLOBALS['output'] = '';
+
+       // To make redirects working (no content type), output mode must be raw
+       setOutputMode(-1);
+
        // Send helping header
        setHttpStatus('302 Found');
 
@@ -1221,6 +1232,12 @@ function getTotalRandomRefidUser () {
 
 // Is given userid valid?
 function isValidUserId ($userid) {
+       // Handle NULL
+       if (is_null($userid)) {
+               // Do not handle this as of below isset() will always return false
+               return false;
+       } // END - if
+
        // Do we have cache?
        if (!isset($GLOBALS[__FUNCTION__][$userid])) {
                // Check it out
@@ -2572,6 +2589,12 @@ function isAjaxOutputMode () {
        return (getScriptOutputMode() == -2);
 }
 
+// Wrapper to check if output mode is image
+function isImageOutputMode () {
+       // Determine it
+       return (getScriptOutputMode() == -3);
+}
+
 // Wrapper to generate a user email link
 function generateWrappedUserEmailLink ($email) {
        // Just call the inner function