X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=01accde60d52451f13fe0b5e0f8249e84eecfd1c;hp=c7711857d65a7010d4f249c7e64b5e3320931989;hb=5a8c537bc2633402ca515964c9a3a2674f37edc2;hpb=9eb4caf6c374ebfb37b73e4549ef6fba9462dcee diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index c7711857d6..01accde60d 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1,7 +1,7 @@ '; - debug_print_backtrace(); - die(' 1)); +} + +// Setter for current userid +function setCurrentUserId ($userid) { + logDebugMessage(__FUNCTION__, __LINE__, 'userid='.$userid); + $GLOBALS['current_userid'] = bigintval($userid); +} + +// Getter for current userid +function getCurrentUserId () { + // Userid must be set before it can be used + if (!isCurrentUserIdSet()) { + // Not set + debug_report_bug('User id is not set.'); + } // END - if + + // Return the userid + return $GLOBALS['current_userid']; +} + +// Checks if current userid is set +function isCurrentUserIdSet () { + return isset($GLOBALS['current_userid']); +} + +// Checks wether we are debugging template cache +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] ?>