X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=9de0106688795fd32e271459b3955db2ff1afe76;hp=0bcd4f09b13e06a15bacda74b794b3857a516568;hb=25b4a580b4c7e0d429eb8e436785d3c2ef304f8e;hpb=9afd6ec5878544a7982c50ed9c0dd7de37606d5b diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 0bcd4f09b1..9de0106688 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1,7 +1,7 @@ '; - debug_print_backtrace(); - die(' 1)); @@ -752,12 +793,40 @@ function setCurrentUserId ($userid) { // Getter for current userid function getCurrentUserId () { - // Return zero if not set - if (!isset($GLOBALS['current_userid'])) return 0; + // 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] ?>