set_session("mx_lang", $lang);
}
//
-function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0")
-{
+function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") {
global $DATA, $_CONFIG, $REPLACER;
// Keept for backward-compatiblity (please replace these variables against our new {--CONST--} syntax!)
}
// Expiration in a nice output format
- if ($_CONFIG['auto_purge'] == 0)
- {
+ if ($_CONFIG['auto_purge'] == 0) {
// Will never expire!
$EXPIRATION = MAIL_WILL_NEVER_EXPIRE;
- }
- elseif (function_exists('CREATE_FANCY_TIME'))
- {
+ } elseif (function_exists('CREATE_FANCY_TIME')) {
// Create nice date string
$EXPIRATION = CREATE_FANCY_TIME($_CONFIG['auto_purge']);
- }
- else
- {
+ } else {
// Display days only
$EXPIRATION = round($_CONFIG['auto_purge']/60/60/24)." "._DAYS;
}
+
switch ($template)
{
case "bonus-mail": // Load data for the bonus mail
case "back-admin":
case "back-member":
- $points = TRANSLATE_COMMA($DATA[10]);
+ $points = TRANSLATE_COMMA($DATA[10]);
break;
case "add-points":
- $points = bigintval($_POST['points']);
+ $points = bigintval($_POST['points']);
break;
case "guest_request_confirm":
}
// Load user's data
- if ($UID > 0)
- {
- if (EXT_IS_ACTIVE("nickname"))
- {
+ if ($UID > 0) {
+ if (EXT_IS_ACTIVE("nickname")) {
// Load nickname
$result = SQL_QUERY_ESC("SELECT surname, family, sex, email, nickname FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
array(bigintval($UID)), __FILE__, __LINE__);
list($surname, $family, $sex, $email, $nick) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- }
- else
- {
+ } else {
// Load normal data
$result = SQL_QUERY_ESC("SELECT surname, family, sex, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
array(bigintval($UID)), __FILE__, __LINE__);
SQL_FREERESULT($result);
$nick = "---";
}
- }
- else
- {
+ } else {
// Neutral sex and email address is default
$sex = 'N';
$email = WEBMASTER;
$BASE = PATH."templates/".GET_LANGUAGE()."/emails/";
// Check for admin/guest/member templates
- if (strpos($template, "admin_") > -1)
- {
+ if (strpos($template, "admin_") > -1) {
// Admin template found
$file = $BASE."admin/".$template.".tpl";
- }
- elseif (strpos($template, "guest_") > -1)
- {
+ } elseif (strpos($template, "guest_") > -1) {
// Guest template found
$file = $BASE."guest/".$template.".tpl";
- }
- elseif (strpos($template, "member_") > -1)
- {
+ } elseif (strpos($template, "member_") > -1) {
// Member template found
$file = $BASE."member/".$template.".tpl";
- }
- else
- {
+ } else {
// Test for extension
$test = substr($template, 0, strpos($template, "_"));
- if (EXT_IS_ACTIVE($test))
- {
+ if (EXT_IS_ACTIVE($test)) {
// Set extra path to extension's name
$file = $BASE.$test."/".$template.".tpl";
- }
- else
- {
+ } else {
// No special filename
$file = $BASE.$template.".tpl";
}
}
// Does the special template exists?
- if (!@file_exists($file))
- {
+ if ((!@file_exists($file)) || (!is_readable($file))) {
// Reset to default template
$file = $BASE.$template.".tpl";
}