]> git.mxchange.org Git - mailer.git/blobdiff - inc/wrapper-functions.php
Further rewrites due to deprecated functions in 5.3.1
[mailer.git] / inc / wrapper-functions.php
index 9de0106688795fd32e271459b3955db2ff1afe76..43b1b306c4959d7982beb780ddac64ca98fc3cc9 100644 (file)
@@ -402,6 +402,7 @@ function copyFileVerified ($source, $dest, $chmod = '') {
 // Send a header but checks before if we can do so
 function sendHeader ($header) {
        // Send the header
+       //* DEBUG: */ logDebugMessage(__FUNCTION__ . ': header=' . $header);
        $GLOBALS['header'][] = trim($header);
 }
 
@@ -769,11 +770,20 @@ function getUserData ($column) {
 
 // Geter for whole user data array
 function getUserDataArray () {
+       // Get user id
+       $uid = getCurrentUserId();
+
        // User id should not be zero
-       if (getCurrentUserId() < 1) debug_report_bug(__FUNCTION__.': User id is zero.');
+       if ($uid < 1) debug_report_bug(__FUNCTION__.': User id is zero.');
 
-       // Get the whole array
-       return $GLOBALS['user_data'][getCurrentUserId()];
+       // Get the whole array if found
+       if (isset($GLOBALS['user_data'][$uid])) {
+               // Found, so return it
+               return $GLOBALS['user_data'][$uid];
+       } else {
+               // Return empty array
+               return array();
+       }
 }
 
 // Checks if the user data is valid, this may indicate that the user has logged
@@ -828,5 +838,16 @@ function getFetchedUserData ($keyColumn, $userId, $valueColumn) {
        return $data;
 }
 
+// Wrapper for strpos() to ease porting from deprecated ereg() function
+function isInString ($needle, $haystack) {
+       return (strpos($haystack, $needle) !== false);
+}
+
+// Wrapper for strpos() to ease porting from deprecated eregi() function
+// This function is case-insensitive
+function isInStringIgnoreCase ($needle, $haystack) {
+       return (isInString(strtolower($haystack), strtolower($needle)));
+}
+
 // [EOF]
 ?>