X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=f4b8f68b43b79f79f81ede0d7881bfc1e57d4bf8;hb=c1e83a8a85569bd7e8204471f90dcc0ae6247522;hp=c7711857d65a7010d4f249c7e64b5e3320931989;hpb=0a8aa21fd12518fb7549b2ea225f75f5a24cd309;p=mailer.git diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index c7711857d6..f4b8f68b43 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) { + $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] ?>