// Insert the code in $img_code into jpeg or PNG image
function generateImageOrCode ($img_code, $headerSent = true) {
// Is the code size oversized or shouldn't we display it?
- if ((strlen($img_code) > 6) || (empty($img_code)) || (getConfig('code_length') == '0')) {
+ if ((strlen($img_code) > 6) || (empty($img_code)) || (getCodeLength() == '0')) {
// Stop execution of function here because of over-sized code length
- debug_report_bug(__FUNCTION__, __LINE__, 'img_code ' . $img_code .' has invalid length. img_code()=' . strlen($img_code) . ' code_length=' . getConfig('code_length'));
+ debug_report_bug(__FUNCTION__, __LINE__, 'img_code ' . $img_code .' has invalid length. img_code()=' . strlen($img_code) . ' code_length=' . getCodeLength());
} elseif ($headerSent === false) {
// Return an HTML code here
return '<img src="{%url=img.php?code=' . $img_code . '%}" alt="Image" />';
$img = sprintf("%s/theme/%s/images/code_bg.%s",
getPath(),
getCurrentTheme(),
- getConfig('img_type')
+ getImgType()
);
// Is it readable?
if (isFileReadable($img)) {
// Switch image type
- switch (getConfig('img_type')) {
- case 'jpg':
- // Okay, load image and hide all errors
+ switch (getImgType()) {
+ case 'jpg': // Okay, load image and hide all errors
$image = imagecreatefromjpeg($img);
break;
- case 'png':
- // Okay, load image and hide all errors
+ case 'png': // Okay, load image and hide all errors
$image = imagecreatefrompng($img);
break;
} // END - switch
} else {
- // Exit function here
- logDebugMessage(__FUNCTION__, __LINE__, sprintf("File for image type %s not found.", getConfig('img_type')));
+ // Silently log the error
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("File for image-type %s in theme %s not found.", getImgType(), getCurrentTheme()));
return;
}
imagestring($image, 5, 14, 2, $img_code, $text_color);
// Return to browser
- sendHeader('Content-Type: image/' . getConfig('img_type'));
+ setContentType('image/' . getImgType());
// Output image with matching image factory
- switch (getConfig('img_type')) {
+ switch (getImgType()) {
case 'jpg': imagejpeg($image); break;
case 'png': imagepng($image); break;
} // END - switch
// Output error messages in a fasioned way and die...
function app_die ($F, $L, $message) {
// Check if Script is already dieing and not let it kill itself another 1000 times
- if (!isset($GLOBALS['app_died'])) {
- // Make sure, that the script realy realy diese here and now
- $GLOBALS['app_died'] = true;
+ if (isset($GLOBALS['app_died'])) {
+ // Script tried to kill itself twice
+ die('[' . __FUNCTION__ . ':' . __LINE__ . ']: Script wanted to kill itself more than once! Raw message=' . $message . ', file/function=' . $F . ', line=' . $L);
+ } // END - if
- // Set content type as text/html
- setContentType('text/html');
+ // Make sure, that the script realy realy diese here and now
+ $GLOBALS['app_died'] = true;
- // Load header
- loadIncludeOnce('inc/header.php');
+ // Set content type as text/html
+ setContentType('text/html');
- // Rewrite message for output
- $message = sprintf(getMessage('MAILER_HAS_DIED'), basename($F), $L, $message);
+ // Load header
+ loadIncludeOnce('inc/header.php');
- // Load the message template
- loadTemplate('app_die_message', false, $message);
+ // Rewrite message for output
+ $message = sprintf(getMessage('MAILER_HAS_DIED'), basename($F), $L, $message);
- // Load footer
- loadIncludeOnce('inc/footer.php');
- } else {
- // Script tried to kill itself twice
- die('['.__FUNCTION__.':'.__LINE__.']: Script wanted to kill itself more than once! Raw message=' . $message . ', file/function=' . $F . ', line=' . $L);
- }
+ // Load the message template
+ loadTemplate('app_die_message', false, $message);
+
+ // Load footer
+ loadIncludeOnce('inc/footer.php');
}
// Display parsing time and number of SQL queries in footer
// Add code
$r .= '<span class="linetext">' . encodeEntities($c) . '</span></div>';
- }
+ } // END - foreach
return '<div class="code">' . $r . '</div>';
}
// Send out mails depending on the 'mod/modes' combination
// @TODO Lame description for this function
function sendModeMails ($mod, $modes) {
+ // Init user data
+ $content = array ();
+
// Load hash
if (fetchUserData(getMemberId())) {
// Extract salt from cookie
$sub_mem = '{--MEMBER_CHANGED_DATA--}';
// Output success message
- $content = '<span class="message">{--MEMBER_MYDATA_MAIL_SENT--}</span>';
+ $content['message'] = '<span class="message">{--MEMBER_MYDATA_MAIL_SENT--}</span>';
break;
default: // Unsupported module!
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unsupported module %s detected.", $mod));
- $content = '<span class="notice">{--UNKNOWN_MODULE--}</span>';
+ $content['message'] = '<span class="notice">{--UNKNOWN_MODULE--}</span>';
break;
} // END - switch
} else {
// Passwords mismatch
- $content = '<span class="notice">{--MEMBER_PASSWORD_ERROR--}</span>';
+ $content['message'] = '<span class="notice">{--MEMBER_PASSWORD_ERROR--}</span>';
}
} else {
// Could not load profile
- $content = '<span class="notice">{--MEMBER_CANNOT_LOAD_PROFILE--}</span>';
+ $content['message'] = '<span class="notice">{--MEMBER_CANNOT_LOAD_PROFILE--}</span>';
}
// Send email to user if required
- if ((!empty($sub_mem)) && (!empty($message))) {
+ if ((!empty($sub_mem)) && (!empty($message)) && (!empty($content['email']))) {
// Send member mail
sendEmail($content['email'], $sub_mem, $message);
} // END - if
// Send only if no other error has occured
- if (empty($content)) {
- if ((!empty($sub_adm)) && (!empty($message_admin))) {
- // Send admin mail
- sendAdminNotification($sub_adm, $message_admin, $content, getMemberId());
- } elseif (isAdminNotificationEnabled()) {
- // Cannot send mails to admin!
- $content = '{--CANNOT_SEND_ADMIN_MAILS--}';
- } else {
- // No mail to admin
- $content = '<span class="message">{--MEMBER_MYDATA_MAIL_SENT--}</span>';
- }
- } // END - if
+ if ((!empty($sub_adm)) && (!empty($message_admin)) && (isAdminNotificationEnabled())) {
+ // Send admin mail
+ sendAdminNotification($sub_adm, $message_admin, $content, getMemberId());
+ } elseif (isAdminNotificationEnabled()) {
+ // Cannot send mails to admin!
+ $content['message'] = '{--CANNOT_SEND_ADMIN_MAILS--}';
+ } else {
+ // No mail to admin
+ $content['message'] = '<span class="message">{--MEMBER_MYDATA_MAIL_SENT--}</span>';
+ }
// Load template
- loadTemplate('admin_settings_saved', false, $content);
+ loadTemplate('admin_settings_saved', false, $content['message']);
}
// Generates a 'selection box' from given array
// Walk through all options
foreach ($options as $option) {
- // Add the <option> entry
+ // Add the <option> entry from ...
if (empty($optionContent)) {
- // ... from template
+ // ... template
$OUT .= loadTemplate('select_' . $name . $extraName . '_option', true, $option);
} else {
- // Direct HTML code
+ // ... direct HTML code
$OUT .= '<option value="' . $option[$optionValue] . '">' . $option[$optionContent] . '</option>';
}
} // END - foreach
return $return;
}
+// Translates the "pool type" into human-readable
+function translatePoolType ($type) {
+ // Return "translation"
+ return sprintf("{--POOL_TYPE_%s--}", strtoupper($type));
+}
+
//-----------------------------------------------------------------------------
-// Template Helper Functions
+// Template helper functions for EL
//-----------------------------------------------------------------------------
// Color-switch helper function
// Switch color if called from loadTemplate()
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SWITCH:' . $template);
$GLOBALS['color_switch'][$template] = 3 - $GLOBALS['color_switch'][$template];
- } // END - if
+ }
// Return CSS class name
if ($return === true) {