// Send mail out to an email address
function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '') {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'toEmail=' . $toEmail . ',subject=' . $subject . ',isHtml=' . $isHtml);
+ // Empty parameters should be avoided, so we need to find them
+ if (empty($isHtml)) {
+ // isHtml is empty
+ debug_report_bug(__FUNCTION__, __LINE__, 'isHtml is empty.');
+ } // END - if
// Set from header
if ((!isInStringIgnoreCase('@', $toEmail)) && ($toEmail > 0)) {
// Does the user exist?
- if (fetchUserData($toEmail)) {
+ if ((isExtensionActive('user')) && (fetchUserData($toEmail))) {
// Get the email
$toEmail = getUserData('email');
} else {
}
} // END - if
- // Fix HTML parameter (default is no!)
- if (empty($isHtml)) {
- $isHtml = 'N';
- } // END - if
-
// Debug mode enabled?
if (isDebugModeEnabled()) {
// In debug mode we want to display the mail instead of sending it away so we can debug this part
// Generates a human-readable timestamp from the Uni* stamp
function generateDateTime ($time, $mode = '0') {
// If the stamp is zero it mostly didn't "happen"
- if ($time == '0') {
+ if (($time == '0') || (is_null($time))) {
// Never happend
return '{--NEVER_HAPPENED--}';
} // END - if
case getCode('COOKIES_DISABLED') : $message = '{--LOGIN_COOKIES_DISABLED--}'; break;
case getCode('BEG_SAME_AS_OWN') : $message = '{--BEG_SAME_USERID_AS_OWN--}'; break;
case getCode('LOGIN_FAILED') : $message = '{--GUEST_LOGIN_FAILED_GENERAL--}'; break;
- case getCode('MODULE_MEMBER_ONLY') : $message = getMaskedMessage('MODULE_MEMBER_ONLY', getRequestParameter('mod')); break;
+ case getCode('MODULE_MEMBER_ONLY') : $message = '{%message,MODULE_MEMBER_ONLY=' . getRequestParameter('mod') . '%}'; break;
case getCode('OVERLENGTH') : $message = '{--MEMBER_TEXT_OVERLENGTH--}'; break;
case getCode('URL_FOUND') : $message = '{--MEMBER_TEXT_CONTAINS_URL--}'; break;
case getCode('SUBJECT_URL') : $message = '{--MEMBER_SUBJECT_CONTAINS_URL--}'; break;
default:
// Missing/invalid code
- $message = getMaskedMessage('UNKNOWN_MAILID_CODE', $code);
+ $message = '{%message,UNKNOWN_MAILID_CODE=' . $code . '%}';
// Log it
logDebugMessage(__FUNCTION__, __LINE__, $message);
}
// Converts a userid so it can be used in SQL queries
-function makeDatabaseUserId ($userid) {
+function makeZeroToNull ($number) {
// Is it a valid username?
- if (isValidUserId($userid)) {
+ if ((!is_null($number)) && ($number > 0)) {
// Always secure it
- $userid = bigintval($userid);
+ $number = bigintval($number);
} else {
// Is not valid or zero
- $userid = 'NULL';
+ $number = 'NULL';
}
// Return it
- return $userid;
+ return $number;
}
// Capitalizes a string with underscores, e.g.: some_foo_string will become SomeFooString
return $GLOBALS['refid'];
}
+// Converts a boolean variable into 'Y' for true and 'N' for false
+function convertBooleanToYesNo ($boolean) {
+ // Default is 'N'
+ $converted = 'N';
+ if ($boolean === true) {
+ // Set 'Y'
+ $converted = 'Y';
+ } // END - if
+
+ // Return it
+ return $converted;
+}
+
+// Translates task type to a human-readable version
+function translateTaskType ($taskType) {
+ // Construct message id
+ $messageId = 'ADMIN_TASK_TYPE_' . strtoupper($taskType) . '';
+
+ // Is the message id there?
+ if (isMessageIdValid($messageId)) {
+ // Then construct message
+ $message = '{--' . $messageId . '--}';
+ } else {
+ // Else it is an unknown task type
+ $message = '{%message,ADMIN_TASK_TYPE_UNKNOWN=' . $taskType . '%}';
+ } // END - if
+
+ // Return message
+ return $message;
+}
+
//-----------------------------------------------------------------------------
// Automatically re-created functions, all taken from user comments on www.php.net
//-----------------------------------------------------------------------------