summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Wilenski <wooc@gazeta.pl>2011-10-21 16:00:12 +0000
committerŁukasz Wilenski <wooc@gazeta.pl>2011-10-21 16:00:12 +0000
commitd2fb37732f32f284b9b93b4eaf1885680b43bac5 (patch)
tree498fcf0f11a868477431d82afe3380f6016d827b
parent664f5a84cce34660e57e0ead947fc887e84c0cd0 (diff)
downloadwebtrees-d2fb37732f32f284b9b93b4eaf1885680b43bac5.tar.gz
webtrees-d2fb37732f32f284b9b93b4eaf1885680b43bac5.tar.bz2
webtrees-d2fb37732f32f284b9b93b4eaf1885680b43bac5.zip
fix: Bug #735875 - Registration email process flawed, svn 11128
Bug #822376 - Reply doesn't work when subject is in quotes Bug #821738 - Answering a private message does not work
-rw-r--r--includes/authentication.php84
-rw-r--r--login_register.php192
-rw-r--r--message.php100
-rw-r--r--modules_v3/user_messages/module.php74
4 files changed, 234 insertions, 216 deletions
diff --git a/includes/authentication.php b/includes/authentication.php
index 0c02a751da..34180d6d80 100644
--- a/includes/authentication.php
+++ b/includes/authentication.php
@@ -288,11 +288,10 @@ function AddToSearchLog($log_message, $geds) {
//----------------------------------- addMessage
//-- stores a new message in the database
function addMessage($message) {
- global $TEXT_DIRECTION;
- global $WEBTREES_EMAIL;
+ global $TEXT_DIRECTION, $WEBTREES_EMAIL;
//-- do not allow users to send a message to themselves
- if ($message["from"]==$message["to"]) {
+ if ($message['from']==$message['to']) {
return false;
}
@@ -310,24 +309,24 @@ function addMessage($message) {
WT_I18N::init(get_user_setting($user_id_from, 'language'));
//-- setup the message body for the "from" user
- $email2 = $message["body"];
- if (isset($message["from_name"]))
- $email2 = WT_I18N::translate('Your Name:')." ".$message["from_name"]."\r\n".WT_I18N::translate('Email Address:')." ".$message["from_email"]."\r\n\r\n".$email2;
- if (!empty($message["url"])) {
- if (strpos($message["url"],WT_SERVER_NAME.WT_SCRIPT_PATH)!==0) {
- $message["url"]=WT_SERVER_NAME.WT_SCRIPT_PATH.$message["url"];
+ $email2 = $message['body'];
+ if (isset($message['from_name']))
+ $email2 = WT_I18N::translate('Your Name:')." ".$message['from_name']."\r\n".WT_I18N::translate('Email Address:')." ".$message['from_email']."\r\n\r\n".$email2;
+ if (!empty($message['url'])) {
+ if (strpos($message['url'],WT_SERVER_NAME.WT_SCRIPT_PATH)!==0) {
+ $message['url']=WT_SERVER_NAME.WT_SCRIPT_PATH.$message['url'];
}
- $email2 .= "\r\n\r\n--------------------------------------\r\n\r\n".WT_I18N::translate('This message was sent while viewing the following URL: ')."\r\n".$message["url"]."\r\n";
+ $email2 .= "\r\n\r\n--------------------------------------\r\n\r\n".WT_I18N::translate('This message was sent while viewing the following URL: ')."\r\n".$message['url']."\r\n";
}
$email2 .= "\r\n=--------------------------------------=\r\nIP ADDRESS: ".$_SERVER['REMOTE_ADDR']."\r\n";
$email2 .= "DNS LOOKUP: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."\r\n";
$email2 .= "LANGUAGE: ".WT_LOCALE."\r\n";
- $subject2 = "[".WT_I18N::translate('webtrees Message').($TEXT_DIRECTION=="ltr"?"] ":" [").$message["subject"];
- $from ="";
+ $subject2 = "[".WT_I18N::translate('webtrees Message').($TEXT_DIRECTION=='ltr'?"] ":" [").$message['subject'];
+ $from ='';
if (!$user_id_from) {
- $from = $message["from"];
+ $from = $message['from'];
$email2 = WT_I18N::translate('You sent the following message to a webtrees administrator:')."\r\n\r\n".$email2;
- $fromFullName = $message["from"];
+ $fromFullName = $message['from'];
} else {
$fromFullName = getUserFullName($user_id_from);
if (!get_site_setting('SMTP_SIMPLE_MAIL'))
@@ -338,20 +337,20 @@ function addMessage($message) {
$email2 = WT_I18N::translate('You sent the following message to a webtrees user:').' '.$toFullName."\r\n\r\n".$email2;
}
- if ($message["method"]!="messaging") {
- $subject1 = "[".WT_I18N::translate('webtrees Message').($TEXT_DIRECTION=="ltr"?"] ":" [").$message["subject"];
+ if ($message['method']!='messaging') {
+ $subject1 = "[".WT_I18N::translate('webtrees Message').($TEXT_DIRECTION=='ltr'?"] ":" [").$message['subject'];
if (!$user_id_from) {
$email1 = WT_I18N::translate('The following message has been sent to your webtrees user account from ');
- if (!empty($message["from_name"])) {
- $email1 .= $message["from_name"]."\r\n\r\n".$message["body"];
+ if (!empty($message['from_name'])) {
+ $email1 .= $message['from_name']."\r\n\r\n".$message['body'];
} else {
- $email1 .= $from."\r\n\r\n".$message["body"];
+ $email1 .= $from."\r\n\r\n".$message['body'];
}
} else {
$email1 = WT_I18N::translate('The following message has been sent to your webtrees user account from ');
- $email1 .= $fromFullName."\r\n\r\n".$message["body"];
+ $email1 .= $fromFullName."\r\n\r\n".$message['body'];
}
- if (!isset($message["no_from"])) {
+ if (!isset($message['no_from'])) {
if (stristr($from, $WEBTREES_EMAIL)) {
$from = getUserEmail(get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID'));
}
@@ -361,41 +360,42 @@ function addMessage($message) {
$header2 = getUserEmail($user_id_to);;
}
if (!empty($header2)) {
- webtreesMail($from, $header2, $subject2, $email2);
+ if (!webtreesMail($from, $header2, $subject2, $email2)) {
+ return false;
+ }
}
}
}
//-- Load the "to" users language
WT_I18N::init(get_user_setting($user_id_to, 'language'));
- if (isset($message["from_name"]))
- $message["body"] = WT_I18N::translate('Your Name:')." ".$message["from_name"]."\r\n".WT_I18N::translate('Email Address:')." ".$message["from_email"]."\r\n\r\n".$message["body"];
- //-- [ webtrees-Feature Requests-1588353 ] Supress admin IP address in Outgoing PGV Email
+ if (isset($message['from_name']))
+ $message['body'] = WT_I18N::translate('Your Name:')." ".$message['from_name']."\r\n".WT_I18N::translate('Email Address:')." ".$message['from_email']."\r\n\r\n".$message['body'];
if (!userIsAdmin($user_id_from)) {
- if (!empty($message["url"]))
- $message["body"] .= "\r\n\r\n--------------------------------------\r\n\r\n".WT_I18N::translate('This message was sent while viewing the following URL: ')."\r\n".$message["url"]."\r\n";
- $message["body"] .= "\r\n=--------------------------------------=\r\nIP ADDRESS: ".$_SERVER['REMOTE_ADDR']."\r\n";
- $message["body"] .= "DNS LOOKUP: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."\r\n";
- $message["body"] .= "LANGUAGE: ".WT_LOCALE."\r\n";
+ if (!empty($message['url']))
+ $message['body'] .= "\r\n\r\n--------------------------------------\r\n\r\n".WT_I18N::translate('This message was sent while viewing the following URL: ')."\r\n".$message['url']."\r\n";
+ $message['body'] .= "\r\n=--------------------------------------=\r\nIP ADDRESS: ".$_SERVER['REMOTE_ADDR']."\r\n";
+ $message['body'] .= "DNS LOOKUP: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."\r\n";
+ $message['body'] .= "LANGUAGE: ".WT_LOCALE."\r\n";
}
- if (empty($message["created"]))
- $message["created"] = gmdate ("D, d M Y H:i:s T");
- if (get_site_setting('STORE_MESSAGES') && ($message["method"]!="messaging3" && $message["method"]!="mailto" && $message["method"]!="none")) {
+ if (empty($message['created']))
+ $message['created'] = gmdate ("D, d M Y H:i:s T");
+ if (get_site_setting('STORE_MESSAGES') && ($message['method']!='messaging3' && $message['method']!='mailto' && $message['method']!='none')) {
WT_DB::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)")
- ->execute(array($message["from"], $_SERVER['REMOTE_ADDR'], get_user_id($message["to"]), $message["subject"], $message["body"]));
+ ->execute(array($message['from'], $_SERVER['REMOTE_ADDR'], get_user_id($message['to']), $message['subject'], $message['body']));
}
- if ($message["method"]!="messaging") {
- $subject1 = "[".WT_I18N::translate('webtrees Message').($TEXT_DIRECTION=="ltr"?"] ":" [").$message["subject"];
+ if ($message['method']!='messaging') {
+ $subject1 = "[".WT_I18N::translate('webtrees Message').($TEXT_DIRECTION=='ltr'?"] ":" [").$message['subject'];
if (!$user_id_from) {
$email1 = WT_I18N::translate('The following message has been sent to your webtrees user account from ');
- if (!empty($message["from_name"])) {
- $email1 .= $message["from_name"]."\r\n\r\n".$message["body"];
+ if (!empty($message['from_name'])) {
+ $email1 .= $message['from_name']."\r\n\r\n".$message['body'];
} else {
- $email1 .= $from."\r\n\r\n".$message["body"];
+ $email1 .= $from."\r\n\r\n".$message['body'];
}
} else {
$email1 = WT_I18N::translate('The following message has been sent to your webtrees user account from ');
- $email1 .= $fromFullName."\r\n\r\n".$message["body"];
+ $email1 .= $fromFullName."\r\n\r\n".$message['body'];
}
if (!$user_id_to) {
//-- the to user must be a valid user in the system before it will send any mails
@@ -408,7 +408,9 @@ function addMessage($message) {
$to = getUserEmail($user_id_to);
}
if (getUserEmail($user_id_to)) {
- webtreesMail($to, $from, $subject1, $email1);
+ if (!webtreesMail($to, $from, $subject1, $email1)) {
+ return false;
+ }
}
}
diff --git a/login_register.php b/login_register.php
index 384affc6b1..de247f32fe 100644
--- a/login_register.php
+++ b/login_register.php
@@ -45,10 +45,10 @@ if (empty($action)) $action = safe_GET('action');
if (empty($user_name)) $user_name = safe_GET('user_name', WT_REGEX_USERNAME);
if (empty($user_hashcode)) $user_hashcode = safe_GET('user_hashcode');
-$message="";
+$message='';
switch ($action) {
- case "pwlost" :
+ case 'pwlost' :
print_header(WT_I18N::translate('Lost password request'));
?>
<script type="text/javascript">
@@ -83,24 +83,24 @@ switch ($action) {
<?php
break;
- case "requestpw" :
+ case 'requestpw' :
print_header(WT_I18N::translate('Lost password request'));
- echo "<div class=\"center\">";
+ echo '<div class="center">';
$user_id=get_user_id($user_name);
if (!$user_id) {
- AddToLog("New password requests for user ".$user_name." that does not exist", 'auth');
- echo "<span class=\"warning\">";
+ AddToLog('New password requests for user '.$user_name.' that does not exist', 'auth');
+ echo '<span class="warning">';
echo WT_I18N::translate('Could not verify the information you entered. Please try again or contact the site administrator for more information.');
- echo "</span><br />";
+ echo '</span><br />';
} else {
if (getUserEmail($user_id)=='') {
- AddToLog("Unable to send password to user ".$user_name." because they do not have an email address", 'auth');
- echo "<span class=\"warning\">";
+ AddToLog('Unable to send password to user '.$user_name.' because they do not have an email address', 'auth');
+ echo '<span class="warning">';
echo WT_I18N::translate('Could not verify the information you entered. Please try again or contact the site administrator for more information.');
- echo "</span><br />";
+ echo '</span><br />';
} else {
- $passchars = "abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- $user_new_pw = "";
+ $passchars = 'abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+ $user_new_pw = '';
$max = strlen($passchars)-1;
for ($i=0; $i<8; $i++) {
$index = rand(0,$max);
@@ -114,7 +114,7 @@ switch ($action) {
WT_I18N::init(get_user_setting($user_id, 'language'));
$newuserName=getUserFullName($user_id);
- $mail_body = "";
+ $mail_body = '';
$mail_body .= WT_I18N::translate('Hello %s ...', $newuserName) . "\r\n\r\n";
$mail_body .= WT_I18N::translate('A new password was requested for your user name.') . "\r\n\r\n";
$mail_body .= WT_I18N::translate('User name') . ": " . $user_name . "\r\n";
@@ -124,32 +124,32 @@ switch ($action) {
$mail_body .= WT_I18N::translate('Please click on the link below or paste it into your browser, login with the new password, and change it immediately to keep the integrity of your data secure.') . "\r\n\r\n";
$mail_body .= WT_I18N::translate('After you have logged in, select the «My Account» link under the «My Page» menu and fill in the password fields to change your password.') . "\r\n\r\n";
- if ($TEXT_DIRECTION=="rtl") $mail_body .= "<a href=\"".WT_SERVER_NAME.WT_SCRIPT_PATH."\">".WT_SERVER_NAME.WT_SCRIPT_PATH."</a>";
+ if ($TEXT_DIRECTION=='rtl') $mail_body .= "<a href=\"".WT_SERVER_NAME.WT_SCRIPT_PATH."\">".WT_SERVER_NAME.WT_SCRIPT_PATH."</a>";
else $mail_body .= WT_SERVER_NAME.WT_SCRIPT_PATH;
require_once WT_ROOT.'includes/functions/functions_mail.php';
- webtreesMail(getUserEmail($user_id), $WEBTREES_EMAIL, WT_I18N::translate('Data request at %s', WT_SERVER_NAME.WT_SCRIPT_PATH), $mail_body);
+ webtreesMail(getUserEmail($user_id), $WEBTREES_EMAIL, WT_I18N::translate('Data request at %s', get_gedcom_setting(WT_GED_ID, 'title').' - '.WT_SERVER_NAME.WT_SCRIPT_PATH), $mail_body);
?>
<table class="center facts_table">
<tr><td class="wrap <?php echo $TEXT_DIRECTION; ?>"><?php echo WT_I18N::translate('Hello...<br /><br />An email with your new password was sent to the address we have on file for <b>%s</b>.<br /><br />Please check your email account; you should receive our message soon.<br /><br />Recommendation:<br />You should login to this site with your new password as soon as possible, and you should change your password to maintain your data\'s security.', $user_name); ?></td></tr>
</table>
<?php
- AddToLog("Password request was sent to user: ".$user_name, 'auth');
+ AddToLog('Password request was sent to user: '.$user_name, 'auth');
WT_I18N::init(WT_LOCALE); // Reset language
}
}
- echo "</div>";
+ echo '</div>';
break;
- case "register" :
- $_SESSION["good_to_send"] = true;
+ case 'register' :
+ $_SESSION['good_to_send'] = true;
if (!get_site_setting('USE_REGISTRATION_MODULE')) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
exit;
}
- $message = "";
+ $message = '';
if (!$user_name) {
$message .= WT_I18N::translate('You must enter a user name.')."<br />";
$user_name_false = true;
@@ -186,7 +186,7 @@ switch ($action) {
if (!$user_comments) $user_comments_false = true;
else $user_comments_false = false;
- if ($user_name_false == false && $user_password01_false == false && $user_password02_false == false && $user_realname_false == false && $user_email_false == false && $user_language_false == false && $user_comments_false == false && $password_mismatch == false) $action = "registernew";
+ if ($user_name_false == false && $user_password01_false == false && $user_password02_false == false && $user_realname_false == false && $user_email_false == false && $user_language_false == false && $user_comments_false == false && $password_mismatch == false) $action = 'registernew';
else {
print_header(WT_I18N::translate('Request new user account'));
// Empty user array in case any details might be left
@@ -252,10 +252,10 @@ switch ($action) {
</script>
<?php
if ($SHOW_REGISTER_CAUTION) {
- echo "<center><table class=\"width50 ", $TEXT_DIRECTION, "\"><tr><td>";
+ echo '<center><table class="width50 ', $TEXT_DIRECTION, '"><tr><td>';
echo WT_I18N::translate('<div class="largeError">Notice:</div><div class="error">By completing and submitting this form, you agree:<ul><li>to protect the privacy of living people listed on our site;</li><li>and in the text box below, to explain to whom you are related, or to provide us with information on someone who should be listed on our site.</li></ul></div>');
- echo "<br />";
- echo "</td></tr></table></center>";
+ echo '<br />';
+ echo '</td></tr></table></center>';
}
?>
<div class="center">
@@ -270,8 +270,8 @@ switch ($action) {
<tr><td class="descriptionbox wrap <?php echo $TEXT_DIRECTION; ?>"><label for="user_password01"><?php echo WT_I18N::translate('Desired password'), '</label>', help_link('edituser_password'); ?></td><td class="optionbox <?php echo $TEXT_DIRECTION; ?>"><input type="password" id="user_password01" name="user_password01" value="" /> *</td></tr>
<tr><td class="descriptionbox wrap <?php echo $TEXT_DIRECTION; ?>"><label for="user_password02"><?php echo WT_I18N::translate('Confirm password'), '</label>', help_link('edituser_conf_password'); ?></td><td class="optionbox <?php echo $TEXT_DIRECTION; ?>"><input type="password" id="user_password02" name="user_password02" value="" /> *</td></tr>
<?php
- echo "<tr><td class=\"descriptionbox wrap ", $TEXT_DIRECTION, "\">";
- echo '<label for="user_language">', WT_I18N::translate('Change language'), '</label>', help_link('edituser_change_lang');
+ echo '<tr><td class="descriptionbox wrap ', $TEXT_DIRECTION, '">';
+ echo '<label for="user_language">', WT_I18N::translate('Language'), '</label>', help_link('edituser_change_lang');
echo '</td><td class="optionbox ', $TEXT_DIRECTION, '">';
echo edit_field_language('user_language', WT_LOCALE);
echo '</td></tr>';
@@ -289,44 +289,44 @@ switch ($action) {
break;
}
- case "registernew" :
+ case 'registernew' :
if (!get_site_setting('USE_REGISTRATION_MODULE')) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
exit;
}
- if ((stripos($user_name, "SUNTZU")!==false) || (stripos($user_email, "SUNTZU")!==false)) {
- AddToLog("SUNTZU hacker", 'auth');
- echo "Go Away!";
+ if ((stripos($user_name, 'SUNTZU')!==false) || (stripos($user_email, 'SUNTZU')!==false)) {
+ AddToLog('SUNTZU hacker', 'auth');
+ echo 'Go Away!';
exit;
}
//-- check referer for possible spam attack
- if (!isset($_SERVER['HTTP_REFERER']) || stristr($_SERVER['HTTP_REFERER'],"login_register.php")===false) {
- echo "<center><br /><span class=\"error\">Invalid page referer.</span>";
- echo "<br /><br /></center>";
+ if (!isset($_SERVER['HTTP_REFERER']) || stristr($_SERVER['HTTP_REFERER'],'login_register.php')===false) {
+ echo '<center><br /><span class="error">Invalid page referer.</span>';
+ echo '<br /><br /></center>';
AddToLog('Invalid page referer while trying to register a user. Possible spam attack.', 'auth');
exit;
}
- if ((!isset($_SESSION["good_to_send"]))||($_SESSION["good_to_send"]!==true)) {
+ if ((!isset($_SESSION['good_to_send']))||($_SESSION['good_to_send']!==true)) {
AddToLog('Invalid session reference while trying to register a user. Possible spam attack.', 'auth');
exit;
}
- $_SESSION["good_to_send"] = false;
+ $_SESSION['good_to_send'] = false;
if (isset($user_name)) {
print_header(WT_I18N::translate('New Account confirmation'));
- echo "<div class=\"center\">";
+ echo '<div class="center">';
$user_created_ok = false;
- AddToLog("User registration requested for: ".$user_name, 'auth');
+ AddToLog('User registration requested for: '.$user_name, 'auth');
if (get_user_id($user_name)) {
- echo "<span class=\"warning\">".WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.')."</span><br /><br />";
- echo "<a href=\"javascript:history.back()\">".WT_I18N::translate('Back')."</a><br />";
+ echo '<span class="warning">', WT_I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'), '</span><br /><br />';
+ echo '<a href="javascript:history.back()">', WT_I18N::translate('Back'), '</a><br />';
} elseif (get_user_by_email($user_email)) {
- echo "<span class=\"warning\">".WT_I18N::translate('Duplicate email address. A user with that email already exists.')."</span><br /><br />";
- echo "<a href=\"javascript:history.back()\">".WT_I18N::translate('Back')."</a><br />";
+ echo '<span class="warning">', WT_I18N::translate('Duplicate email address. A user with that email already exists.'), '</span><br /><br />';
+ echo '<a href="javascript:history.back()">', WT_I18N::translate('Back'), '</a><br />';
} elseif ($user_password01 == $user_password02) {
if ($user_id=create_user($user_name, $user_realname, $user_email, $user_password01)) {
set_user_setting($user_id, 'language', $user_language);
@@ -334,7 +334,7 @@ switch ($action) {
set_user_setting($user_id, 'verified_by_admin', !$REQUIRE_ADMIN_AUTH_REGISTRATION);
set_user_setting($user_id, 'reg_timestamp', date('U'));
set_user_setting($user_id, 'reg_hashcode', md5(uniqid(rand(), true)));
- set_user_setting($user_id, 'contactmethod', "messaging2");
+ set_user_setting($user_id, 'contactmethod', 'messaging2');
set_user_setting($user_id, 'visibleonline', 1);
set_user_setting($user_id, 'editaccount', 1);
set_user_setting($user_id, 'auto_accept', 0);
@@ -342,43 +342,44 @@ switch ($action) {
set_user_setting($user_id, 'sessiontime', 0);
$user_created_ok = true;
} else {
- echo "<span class=\"warning\">".WT_I18N::translate('Unable to add user. Please try again.')."<br /></span>";
- echo "<a href=\"javascript:history.back()\">".WT_I18N::translate('Back')."</a><br />";
+ echo '<span class="warning">', WT_I18N::translate('Unable to add user. Please try again.'), '<br /></span>';
+ echo '<a href="javascript:history.back()">', WT_I18N::translate('Back'), '</a><br />';
}
} else {
- echo "<span class=\"warning\">".WT_I18N::translate('Passwords do not match.')."</span><br />";
- echo "<a href=\"javascript:history.back()\">".WT_I18N::translate('Back')."</a><br />";
+ echo '<span class="warning">', WT_I18N::translate('Passwords do not match.'), '</span><br />';
+ echo '<a href="javascript:history.back()">', WT_I18N::translate('Back'), '</a><br />';
}
if ($user_created_ok) {
// switch to the user's language
WT_I18N::init($user_language);
$mail_body = "";
$mail_body .= WT_I18N::translate('Hello %s ...', $user_realname) . "\r\n\r\n";
- $mail_body .= /* I18N: %s placeholders are the site URL and an email address */ WT_I18N::translate('A request was received at %s to create a webtrees account with your email address %s.', WT_SERVER_NAME.WT_SCRIPT_PATH, $user_email) . " ";
+ $mail_body .= /* I18N: %s placeholders are the site URL and an email address */ WT_I18N::translate('A request was received at %s to create a webtrees account with your email address %s.', get_gedcom_setting(WT_GED_ID, 'title').' - '.WT_SERVER_NAME.WT_SCRIPT_PATH, $user_email) . " ";
$mail_body .= WT_I18N::translate('Information about the request is shown under the link below.') . "\r\n\r\n";
$mail_body .= WT_I18N::translate('Please click on the following link and fill in the requested data to confirm your request and email address.') . "\r\n\r\n";
- if ($TEXT_DIRECTION=="rtl") {
+ if ($TEXT_DIRECTION=='rtl') {
$mail_body .= "<a href=\"";
$mail_body .= WT_SERVER_NAME.WT_SCRIPT_PATH . "login_register.php?user_name=".urlencode($user_name)."&user_hashcode=".urlencode(get_user_setting($user_id, 'reg_hashcode'))."&action=userverify\">";
}
$mail_body .= WT_SERVER_NAME.WT_SCRIPT_PATH . "login_register.php?user_name=".urlencode($user_name)."&user_hashcode=".urlencode(get_user_setting($user_id, 'reg_hashcode'))."&action=userverify";
- if ($TEXT_DIRECTION=="rtl") $mail_body .= "</a>";
+ if ($TEXT_DIRECTION=='rtl') $mail_body .= "</a>";
$mail_body .= "\r\n";
$mail_body .= WT_I18N::translate('User name') . " " . $user_name . "\r\n";
$mail_body .= WT_I18N::translate('Verification code:') . " " . get_user_setting($user_id, 'reg_hashcode') . "\r\n\r\n";
$mail_body .= WT_I18N::translate('Comments').": " . $user_comments . "\r\n\r\n";
$mail_body .= WT_I18N::translate('If you didn\'t request an account, you can just delete this message.') . " ";
$mail_body .= WT_I18N::translate('You won\'t get any more email from this site, because the account request will be deleted automatically after seven days.') . "\r\n";
+
require_once WT_ROOT.'includes/functions/functions_mail.php';
- webtreesMail($user_email, $WEBTREES_EMAIL, WT_I18N::translate('Your registration at %s', WT_SERVER_NAME.WT_SCRIPT_PATH), $mail_body);
+ webtreesMail($user_email, $WEBTREES_EMAIL, WT_I18N::translate('Your registration at %s', get_gedcom_setting(WT_GED_ID, 'title').' - '.WT_SERVER_NAME.WT_SCRIPT_PATH), $mail_body);
// switch language to webmaster settings
$webmaster_user_id=get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID');
WT_I18N::init(get_user_setting($webmaster_user_id, 'language'));
- $mail_body = "";
+ $mail_body = '';
$mail_body .= WT_I18N::translate('Hello Administrator ...') . "\r\n\r\n";
- $mail_body .= WT_I18N::translate('A prospective user has registered with webtrees at %s.', WT_SERVER_NAME.WT_SCRIPT_PATH) . "\r\n\r\n";
+ $mail_body .= WT_I18N::translate('A prospective user has registered with webtrees at %s.', get_gedcom_setting(WT_GED_ID, 'title').' - '.WT_SERVER_NAME.WT_SCRIPT_PATH) . "\r\n\r\n";
$mail_body .= WT_I18N::translate('User name') . " " . $user_name . "\r\n";
$mail_body .= WT_I18N::translate('Real name') . " " . $user_realname . "\r\n";
$mail_body .= WT_I18N::translate('Email Address:') . " " . $user_email . "\r\n\r\n";
@@ -388,13 +389,20 @@ switch ($action) {
else $mail_body .= WT_I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. After this, the user will be able to login without any action on your part.') . "\r\n";
$message = array();
- $message["to"]=get_user_name($webmaster_user_id);
- $message["from"]=$user_name;
- $message["subject"] = WT_I18N::translate('New registration at %s', WT_SERVER_NAME.WT_SCRIPT_PATH);
- $message["body"] = $mail_body;
- $message["created"] = $time;
- $message["method"] = get_user_setting($webmaster_user_id, 'contact_method');
- addMessage($message);
+ $message['to']=get_user_name($webmaster_user_id);
+ $message['from']=$user_name;
+ $message['subject'] = WT_I18N::translate('New registration at %s', get_gedcom_setting(WT_GED_ID, 'title').' - '.WT_SERVER_NAME.WT_SCRIPT_PATH);
+ $message['body'] = $mail_body;
+ $message['body'] .= "\r\n=--------------------------------------=\r\nIP ADDRESS: ".$_SERVER['REMOTE_ADDR']."\r\n";
+ $message['body'] .= "DNS LOOKUP: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."\r\n";
+ $message['body'] .= "LANGUAGE: ".WT_LOCALE."\r\n";
+ $message['created'] = $time;
+ $message['method'] = get_user_setting($webmaster_user_id, 'contact_method');
+ webtreesMail($WEBTREES_EMAIL, $user_email, $message['subject'], $message['body']);
+ if (get_site_setting('STORE_MESSAGES') && ($message['method']!='messaging3' && $message['method']!='mailto' && $message['method']!='none')) {
+ WT_DB::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)")
+ ->execute(array($message['from'], $_SERVER['REMOTE_ADDR'], get_user_id($message['to']), $message['subject'], $message['body']));
+ }
// switch language to user's settings
WT_I18N::init($user_language);
@@ -410,14 +418,14 @@ switch ($action) {
<?php
WT_I18N::init(WT_LOCALE); // Reset language
}
- echo "</div>";
+ echo '</div>';
} else {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php');
exit;
}
break;
- case "userverify" :
+ case 'userverify' :
if (!get_site_setting('USE_REGISTRATION_MODULE')) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
exit;
@@ -428,7 +436,7 @@ switch ($action) {
WT_I18N::init(get_user_setting($user_id, 'language'));
print_header(WT_I18N::translate('User verification'));
- echo "<div class=\"center\">";
+ echo '<div class="center">';
?>
<form name="verifyform" method="post" action="" onsubmit="t = new Date(); document.verifyform.time.value=t.toUTCString();">
<input type="hidden" name="action" value="verify_hash" />
@@ -448,22 +456,22 @@ switch ($action) {
<?php
break;
- case "verify_hash" :
+ case 'verify_hash' :
if (!get_site_setting('USE_REGISTRATION_MODULE')) {
header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH);
exit;
}
- AddToLog("User attempted to verify hashcode: ".$user_name, 'auth');
+ AddToLog('User attempted to verify hashcode: '.$user_name, 'auth');
// Change to the new user's language
$user_id=get_user_id($user_name);
WT_I18N::init(get_user_setting($user_id, 'language'));
print_header(WT_I18N::translate('User verification')); // <-- better verification of authentication code
- echo "<div class=\"center\">";
- echo "<table class=\"center facts_table wrap ".$TEXT_DIRECTION."\">";
- echo "<tr><td class=\"topbottombar\">".WT_I18N::translate('User verification')."</td></tr>";
- echo "<tr><td class=\"optionbox\">";
+ echo '<div class="center">';
+ echo '<table class="center facts_table wrap '.$TEXT_DIRECTION.'">';
+ echo '<tr><td class="topbottombar">'.WT_I18N::translate('User verification').'</td></tr>';
+ echo '<tr><td class="optionbox">';
echo WT_I18N::translate('The data for the user <b>%s</b> was checked.', $user_name);
if ($user_id) {
$pw_ok = check_user_password($user_id, $user_password);
@@ -476,19 +484,19 @@ switch ($action) {
if (!$REQUIRE_ADMIN_AUTH_REGISTRATION) {
set_user_setting($user_id, 'verified_by_admin', 1);
}
- AddToLog("User verified: ".$user_name, 'auth');
+ AddToLog('User verified: '.$user_name, 'auth');
// switch language to webmaster settings
$webmaster_user_id=get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID');
WT_I18N::init(get_user_setting($webmaster_user_id, 'language'));
- $mail_body = "";
+ $mail_body = '';
$mail_body .= WT_I18N::translate('Hello Administrator ...') . "\r\n\r\n";
$mail_body .= /* I18N: User <login-id> (<real name>) has ... */ WT_I18N::translate('User %s (%s) has confirmed their request for an account.', $user_name, getUserFullName($user_id)) . "\r\n\r\n";
if ($REQUIRE_ADMIN_AUTH_REGISTRATION) $mail_body .= WT_I18N::translate('Please click on the link below to login to your site. You must Edit the user to activate the account so that he can login to your site.') . "\r\n";
else $mail_body .= WT_I18N::translate('You do not have to take any action; the user can now login.') . "\r\n";
- if ($TEXT_DIRECTION=="rtl") {
+ if ($TEXT_DIRECTION=='rtl') {
$mail_body .= "<a href=\"";
$mail_body .= WT_SERVER_NAME.WT_SCRIPT_PATH."admin_users.php?action=edituser&username=" . urlencode($user_name) . "\">";
}
@@ -497,34 +505,42 @@ switch ($action) {
$mail_body .= "\r\n";
$message = array();
- $message["to"]=get_user_name($webmaster_user_id);
- $message["from"]=$user_name;
- $message["subject"] = WT_I18N::translate('New user at %s', WT_SERVER_NAME.WT_SCRIPT_PATH);
- $message["body"] = $mail_body;
- $message["created"] = $time;
- $message["method"] = get_user_setting($webmaster_user_id, 'CONTACT_METHOD');
- addMessage($message);
+ $message['to']=get_user_name($webmaster_user_id);
+ $message['from']=$user_name;
+ $message['subject'] = WT_I18N::translate('New user at %s', get_gedcom_setting(WT_GED_ID, 'title').' - '.WT_SERVER_NAME.WT_SCRIPT_PATH);
+ $message['body'] = $mail_body;
+ $message['body'] .= "\r\n=--------------------------------------=\r\nIP ADDRESS: ".$_SERVER['REMOTE_ADDR']."\r\n";
+ $message['body'] .= "DNS LOOKUP: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."\r\n";
+ $message['body'] .= "LANGUAGE: ".WT_LOCALE."\r\n";
+ $message['created'] = $time;
+ $message['method'] = get_user_setting($webmaster_user_id, 'CONTACT_METHOD');
+ require_once WT_ROOT.'includes/functions/functions_mail.php';
+ webtreesMail($WEBTREES_EMAIL, $user_email, $message['subject'], $message['body']);
+ if (get_site_setting('STORE_MESSAGES') && ($message['method']!='messaging3' && $message['method']!='mailto' && $message['method']!='none')) {
+ WT_DB::prepare("INSERT INTO `##message` (sender, ip_address, user_id, subject, body) VALUES (? ,? ,? ,? ,?)")
+ ->execute(array($message['from'], $_SERVER['REMOTE_ADDR'], get_user_id($message['to']), $message['subject'], $message['body']));
+ }
WT_I18N::init(WT_LOCALE); // Reset language
- echo "<br /><br />".WT_I18N::translate('You have confirmed your request to become a registered user.')."<br /><br />";
+ echo '<br /><br />'.WT_I18N::translate('You have confirmed your request to become a registered user.').'<br /><br />';
if ($REQUIRE_ADMIN_AUTH_REGISTRATION) echo WT_I18N::translate('The Administrator has been informed. As soon as he gives you permission to login, you can login with your user name and password.');
else echo WT_I18N::translate('You can now login with your user name and password.');
- echo "<br /><br /></td></tr>";
+ echo '<br /><br /></td></tr>';
} else {
- echo "<br /><br />";
- echo "<span class=\"warning\">";
+ echo '<br /><br />';
+ echo '<span class="warning">';
echo WT_I18N::translate('Data was not correct, please try again');
- echo "</span><br /><br /></td></tr>";
+ echo '</span><br /><br /></td></tr>';
}
} else {
- echo "<br /><br />";
- echo "<span class=\"warning\">";
+ echo '<br /><br />';
+ echo '<span class="warning">';
echo WT_I18N::translate('Could not verify the information you entered. Please try again or contact the site administrator for more information.');
- echo "</span><br /><br /></td></tr>";
+ echo '</span><br /><br /></td></tr>';
}
- echo "</table>";
- echo "</div>";
+ echo '</table>';
+ echo '</div>';
break;
default :
diff --git a/message.php b/message.php
index 8f2d83abc4..48d5fa9bc9 100644
--- a/message.php
+++ b/message.php
@@ -45,7 +45,7 @@ if (empty($to)) {
print_simple_footer();
exit;
}
-if ($to=="all" && !WT_USER_IS_ADMIN) {
+if ($to=='all' && !WT_USER_IS_ADMIN) {
echo '<p class="ui-state-error">'.WT_I18N::translate('No recipient user was provided. Cannot continue.').'</p>';
print_simple_footer();
exit;
@@ -63,14 +63,14 @@ if (!WT_USER_ID) {
}
}
-if (($action=="send")&&(isset($_SESSION["good_to_send"]))&&($_SESSION["good_to_send"]===true)) {
- $_SESSION["good_to_send"] = false;
+if (($action=='send')&&(isset($_SESSION['good_to_send']))&&($_SESSION['good_to_send']===true)) {
+ $_SESSION['good_to_send'] = false;
if (!empty($from_email)) $from = $from_email;
if (!get_user_id($from)) {
$mt = preg_match("/(.+)@(.+)/", $from, $match);
if ($mt>0) {
$host = trim($match[2]);
- if (function_exists("checkdnsrr")) {
+ if (function_exists('checkdnsrr')) {
$ip = checkdnsrr($host);
if ($ip === false) {
//$host = "www.".$host;
@@ -95,12 +95,12 @@ if (($action=="send")&&(isset($_SESSION["good_to_send"]))&&($_SESSION["good_to_s
AddToLog('Invalid page referer while trying to send a message. Possible spam attack.', 'auth');
$action="compose";
}
- if ($action!="compose") {
+ if ($action!='compose') {
$toarray = array($to);
- if ($to == "all") {
+ if ($to == 'all') {
$toarray = get_all_users();
}
- if ($to == "never_logged") {
+ if ($to == 'never_logged') {
$toarray = array();
foreach (get_all_users() as $user_id=>$user_name) {
// SEE Bug [ 1827547 ] Message to inactive users sent to newcomers
@@ -109,7 +109,7 @@ if (($action=="send")&&(isset($_SESSION["good_to_send"]))&&($_SESSION["good_to_s
}
}
}
- if ($to == "last_6mo") {
+ if ($to == 'last_6mo') {
$toarray = array();
$sixmos = 60*60*24*30*6; //-- timestamp for six months
foreach (get_all_users() as $user_id=>$user_name) {
@@ -126,38 +126,38 @@ if (($action=="send")&&(isset($_SESSION["good_to_send"]))&&($_SESSION["good_to_s
$i = 0;
foreach ($toarray as $indexval => $to) {
$message = array();
- $message["to"]=$to;
- $message["from"]=$from;
+ $message['to']=$to;
+ $message['from']=$from;
if (!empty($from_name)) {
- $message["from_name"] = $from_name;
- $message["from_email"] = $from_email;
+ $message['from_name'] = $from_name;
+ $message['from_email'] = $from_email;
}
- $message["subject"] = $subject;
+ $message['subject'] = $subject;
$url = preg_replace("/".WT_SESSION_NAME."=.*/", "", $url);
- $message["body"] = $body;
- $message["created"] = $time;
- $message["method"] = $method;
- if ($i>0) $message["no_from"] = true;
+ $message['body'] = $body;
+ $message['created'] = $time;
+ $message['method'] = $method;
+ if ($i>0) $message['no_from'] = true;
if (addMessage($message)) {
$to_user_id=get_user_id($to);
if ($to_user_id) {
- echo WT_I18N::translate('Message successfully sent to %s', "<b>".getUserFullName($to_user_id)."</b>");
- echo "<br />";
+ echo WT_I18N::translate('Message successfully sent to %s', '<b>'.getUserFullName($to_user_id).'</b>');
+ echo '<br />';
} else {
AddToLog('Invalid TO user.'.$to.' Possible spam attack.', 'auth');
}
} else {
+ echo WT_I18N::translate('Message was not sent'), '<br />';
AddToLog('Unable to send message. TO:'.$to.' FROM:'.$from, 'error');
}
$i++;
}
}
-}
-else if ($action=="send") AddToLog('Invalid Compose Session while trying to send a message. Possible spam attack.', 'auth');
+} else if ($action=='send') AddToLog('Invalid Compose Session while trying to send a message. Possible spam attack.', 'auth');
-if ($action=="compose") {
- echo '<span class="subheaders">'.WT_I18N::translate('Send Message').'</span>';
- $_SESSION["good_to_send"] = true;
+if ($action=='compose') {
+ echo '<span class="subheaders">', WT_I18N::translate('Send Message'), '</span>';
+ $_SESSION['good_to_send'] = true;
?>
<script type="text/javascript">
function validateEmail(email) {
@@ -184,43 +184,43 @@ if ($action=="compose") {
</script>
<?php
if (!WT_USER_ID) {
- echo "<br /><br />".WT_I18N::translate('<b>Please Note:</b> Private information of living individuals will only be given to family relatives and close friends. You will be asked to verify your relationship before you will receive any private data. Sometimes information of dead persons may also be private. If this is the case, it is because there is not enough information known about the person to determine whether they are alive or not and we probably do not have more information on this person.<br /><br />Before asking a question, please verify that you are inquiring about the correct person by checking dates, places, and close relatives. If you are submitting changes to the genealogical data, please include the sources where you obtained the data.');
+ echo '<br /><br />', WT_I18N::translate('<b>Please Note:</b> Private information of living individuals will only be given to family relatives and close friends. You will be asked to verify your relationship before you will receive any private data. Sometimes information of dead persons may also be private. If this is the case, it is because there is not enough information known about the person to determine whether they are alive or not and we probably do not have more information on this person.<br /><br />Before asking a question, please verify that you are inquiring about the correct person by checking dates, places, and close relatives. If you are submitting changes to the genealogical data, please include the sources where you obtained the data.');
}
- echo "<br /><form name=\"messageform\" method=\"post\" action=\"message.php\" onsubmit=\"t = new Date(); document.messageform.time.value=t.toUTCString(); ";
- if (!WT_USER_ID) echo "return validateEmail(document.messageform.from_email);";
- else echo "return checkForm(this);";
- echo "\">";
- echo "<table>";
+ echo '<br /><form name="messageform" method="post" action="message.php" onsubmit="t = new Date(); document.messageform.time.value=t.toUTCString(); ';
+ if (!WT_USER_ID) echo 'return validateEmail(document.messageform.from_email);';
+ else echo 'return checkForm(this);';
+ echo '">';
+ echo '<table>';
$to_user_id=get_user_id($to);
if ($to_user_id) {
- echo "<tr><td></td><td>".WT_I18N::translate('This message will be sent to %s', "<b>".getUserFullName($to_user_id)."</b>")."<br />";
- echo WT_I18N::translate('This user prefers to receive messages in %s', Zend_Locale::getTranslation(get_user_setting($to_user_id, 'language'), 'language', WT_LOCALE))."</td></tr>";
+ echo '<tr><td></td><td>', WT_I18N::translate('This message will be sent to %s', '<b>'.getUserFullName($to_user_id).'</b>'), '<br />';
+ echo WT_I18N::translate('This user prefers to receive messages in %s', Zend_Locale::getTranslation(get_user_setting($to_user_id, 'language'), 'language', WT_LOCALE)), '</td></tr>';
}
if (!WT_USER_ID) {
- echo "<tr><td valign=\"top\" width=\"15%\" align=\"right\">".WT_I18N::translate('Your Name:')."</td>";
- echo "<td><input type=\"text\" name=\"from_name\" size=\"40\" value=\"$from_name\" /></td></tr><tr><td valign=\"top\" align=\"right\">".WT_I18N::translate('Email Address:')."</td><td><input type=\"text\" name=\"from_email\" size=\"40\" value=\"$from_email\" /><br />".WT_I18N::translate('Please provide your email address so that we may contact you in response to this message. If you do not provide your email address we will not be able to respond to your inquiry. Your email address will not be used in any other way besides responding to this inquiry.')."<br /><br /></td></tr>";
+ echo '<tr><td valign="top" width="15%" align="right">', WT_I18N::translate('Your Name:'), '</td>';
+ echo '<td><input type="text" name="from_name" size="40" value="', addslashes($from_name), '" /></td></tr><tr><td valign="top" align="right">', WT_I18N::translate('Email Address:'), '</td><td><input type="text" name="from_email" size="40" value="', $from_email, '" /><br />', WT_I18N::translate('Please provide your email address so that we may contact you in response to this message. If you do not provide your email address we will not be able to respond to your inquiry. Your email address will not be used in any other way besides responding to this inquiry.'), '<br /><br /></td></tr>';
}
- echo "<tr><td align=\"right\">".WT_I18N::translate('Subject:')."</td>";
- echo "<td>";
+ echo '<tr><td align="right">', WT_I18N::translate('Subject:'), '</td>';
+ echo '<td>';
if (WT_USER_ID) {
- echo "<input type=\"hidden\" name=\"from\" value=\"".WT_USER_NAME."\" />";
+ echo '<input type="hidden" name="from" value="', WT_USER_NAME, '" />';
}
- echo "<input type=\"hidden\" name=\"action\" value=\"send\" />";
- echo "<input type=\"hidden\" name=\"to\" value=\"$to\" />";
- echo "<input type=\"hidden\" name=\"time\" value=\"\" />";
- echo "<input type=\"hidden\" name=\"method\" value=\"$method\" />";
- echo "<input type=\"hidden\" name=\"url\" value=\"$url\" />";
- echo "<input type=\"text\" name=\"subject\" size=\"50\" value=\"$subject\" /><br /></td></tr>";
- echo "<tr><td valign=\"top\" align=\"right\">".WT_I18N::translate('Body:')."<br /></td><td><textarea name=\"body\" cols=\"50\" rows=\"7\">$body</textarea><br /></td></tr>";
- echo "<tr><td></td><td><input type=\"submit\" value=\"".WT_I18N::translate('Send')."\" /></td></tr>";
- echo "</table>";
- echo "</form>";
- if ($method=="messaging2") echo WT_I18N::translate('When you send this message you will receive a copy sent via email to the address you provided.');
+ echo '<input type="hidden" name="action" value="send" />';
+ echo '<input type="hidden" name="to" value="', $to, '" />';
+ echo '<input type="hidden" name="time" value="" />';
+ echo '<input type="hidden" name="method" value="', $method, '" />';
+ echo '<input type="hidden" name="url" value="', $url, '" />';
+ echo '<input type="text" name="subject" size="50" value="', $subject, '" /><br /></td></tr>';
+ echo '<tr><td valign="top" align="right">', WT_I18N::translate('Body:'), '<br /></td><td><textarea name="body" cols="50" rows="7">', $body, '</textarea><br /></td></tr>';
+ echo '<tr><td></td><td><input type="submit" value="', WT_I18N::translate('Send'), '" /></td></tr>';
+ echo '</table>';
+ echo '</form>';
+ if ($method=='messaging2') echo WT_I18N::translate('When you send this message you will receive a copy sent via email to the address you provided.');
}
-else if ($action=="delete") {
+else if ($action=='delete') {
if (deleteMessage($id)) echo WT_I18N::translate('Message Deleted');
}
-echo "<center><br /><br /><a href=\"javascript:;\" onclick=\"if (window.opener.refreshpage) window.opener.refreshpage(); window.close();\">".WT_I18N::translate('Close Window')."</a><br /></center>";
+echo '<center><br /><br /><a href="javascript:;" onclick="if (window.opener.refreshpage) window.opener.refreshpage(); window.close();">', WT_I18N::translate('Close Window'), '</a><br /></center>';
print_simple_footer();
diff --git a/modules_v3/user_messages/module.php b/modules_v3/user_messages/module.php
index c573031607..ffb8c86b66 100644
--- a/modules_v3/user_messages/module.php
+++ b/modules_v3/user_messages/module.php
@@ -69,20 +69,20 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block {
$id=$this->getName().$block_id;
$title=WT_I18N::plural('%s message', '%s messages',count($usermessages), count($usermessages));
- $content = "";
+ $content = '';
$content .= "<form name=\"messageform\" action=\"index.php?ctype={$ctype}\" method=\"get\" onsubmit=\"return confirm('".WT_I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.')."');\">";
if (get_user_count()>1) {
$content .= '<br />'.WT_I18N::translate('Send Message')." <select name=\"touser\">";
$content .= '<option value="">' . WT_I18N::translate('&lt;select&gt;') . '</option>';
foreach (get_all_users() as $user_id=>$user_name) {
if ($user_id!=WT_USER_ID && get_user_setting($user_id, 'verified_by_admin') && get_user_setting($user_id, 'contactmethod')!='none') {
- $content .= "<option value=\"".$user_name."\">".PrintReady(getUserFullName($user_id))." ";
- if ($TEXT_DIRECTION=="ltr") {
- $content .= stripLRMRLM(getLRM()." - ".$user_name.getLRM());
+ $content .= "<option value=\"".$user_name."\">".PrintReady(getUserFullName($user_id)).' ';
+ if ($TEXT_DIRECTION=='ltr') {
+ $content .= stripLRMRLM(getLRM().' - '.$user_name.getLRM());
} else {
- $content .= stripLRMRLM(getRLM()." - ".$user_name.getRLM());
+ $content .= stripLRMRLM(getRLM().' - '.$user_name.getRLM());
}
- $content .= "</option>";
+ $content .= '</option>';
}
}
$content .= "</select> <input type=\"button\" value=\"".WT_I18N::translate('Send')."\" onclick=\"message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, 'messaging2', ''); return false;\" /><br /><br />";
@@ -92,56 +92,56 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block {
} else {
$content .= WT_JS_START.'function select_all() {';
foreach ($usermessages as $message) {
- $content .= 'var cb=document.getElementById("cb_message'.$message["id"].'");';
+ $content .= 'var cb=document.getElementById("cb_message'.$message['id'].'");';
$content .= 'cb.checked=!cb.checked;';
}
$content .= 'return false;}'.WT_JS_END;
- $content .= "<input type=\"hidden\" name=\"action\" value=\"deletemessage\" />";
- $content .= "<table class=\"list_table\"><tr>";
- $content .= "<td class=\"list_label\">".WT_I18N::translate('Delete')."<br /><a href=\"javascript:;\" onclick=\"return select_all();\">".WT_I18N::translate('All')."</a></td>";
- $content .= "<td class=\"list_label\">".WT_I18N::translate('Subject:')."</td>";
- $content .= "<td class=\"list_label\">".WT_I18N::translate('Date Sent:')."</td>";
- $content .= "<td class=\"list_label\">".WT_I18N::translate('Email Address:')."</td>";
- $content .= "</tr>";
+ $content .= '<input type="hidden" name="action" value="deletemessage" />';
+ $content .= '<table class="list_table"><tr>';
+ $content .= '<td class="list_label">'.WT_I18N::translate('Delete')."<br /><a href=\"javascript:;\" onclick=\"return select_all();\">".WT_I18N::translate('All').'</a></td>';
+ $content .= '<td class="list_label">'.WT_I18N::translate('Subject:').'</td>';
+ $content .= '<td class="list_label">'.WT_I18N::translate('Date Sent:').'</td>';
+ $content .= '<td class="list_label">'.WT_I18N::translate('Email Address:').'</td>';
+ $content .= '</tr>';
foreach ($usermessages as $key=>$message) {
- if (isset($message["id"])) $key = $message["id"];
- $content .= "<tr>";
+ if (isset($message['id'])) $key = $message['id'];
+ $content .= '<tr>';
$content .= "<td class=\"list_value_wrap\"><input type=\"checkbox\" id=\"cb_message$key\" name=\"message_id[]\" value=\"$key\" /></td>";
- $showmsg=preg_replace("/(\w)\/(\w)/","\$1/<span style=\"font-size:1px;\"> </span>\$2",PrintReady($message["subject"]));
+ $showmsg=preg_replace("/(\w)\/(\w)/","\$1/<span style=\"font-size:1px;\"> </span>\$2",PrintReady($message['subject']));
$showmsg=str_replace("@","@<span style=\"font-size:1px;\"> </span>",$showmsg);
- $content .= "<td class=\"list_value_wrap\"><a href=\"javascript:;\" onclick=\"expand_layer('message{$key}'); return false;\"><img id=\"message{$key}_img\" src=\"".$WT_IMAGES["plus"]."\" border=\"0\" alt=\"".WT_I18N::translate('Show Details')."\" title=\"".WT_I18N::translate('Show Details')."\" /> <b>".$showmsg."</b></a></td>";
- $content .= "<td class=\"list_value_wrap\">".format_timestamp($message['created'])."</td>";
- $content .= "<td class=\"list_value_wrap\">";
- $user_id=get_user_id($message["from"]);
+ $content .= "<td class=\"list_value_wrap\"><a href=\"javascript:;\" onclick=\"expand_layer('message{$key}'); return false;\"><img id=\"message{$key}_img\" src=\"".$WT_IMAGES['plus']."\" border=\"0\" alt=\"".WT_I18N::translate('Show Details')."\" title=\"".WT_I18N::translate('Show Details')."\" /> <b>".$showmsg."</b></a></td>";
+ $content .= '<td class="list_value_wrap">'.format_timestamp($message['created']).'</td>';
+ $content .= '<td class="list_value_wrap">';
+ $user_id=get_user_id($message['from']);
if ($user_id) {
$content .= PrintReady(getUserFullName($user_id));
- if ($TEXT_DIRECTION=="ltr") {
- $content .= " " . getLRM() . " - ".htmlspecialchars(getUserEmail($user_id)) . getLRM();
+ if ($TEXT_DIRECTION=='ltr') {
+ $content .= ' '.getLRM().' - '.htmlspecialchars(getUserEmail($user_id)) . getLRM();
} else {
- $content .= " " . getRLM() . " - ".htmlspecialchars(getUserEmail($user_id)) . getRLM();
+ $content .= ' '.getRLM().' - '.htmlspecialchars(getUserEmail($user_id)) . getRLM();
}
} else {
- $content .= "<a href=\"mailto:".$message["from"]."\">".str_replace("@","@<span style=\"font-size:1px;\"> </span>",$message["from"])."</a>";
+ $content .= "<a href=\"mailto:".$message['from']."\">".str_replace("@","@<span style=\"font-size:1px;\"> </span>",$message['from']).'</a>';
}
- $content .= "</td>";
- $content .= "</tr>";
+ $content .= '</td>';
+ $content .= '</tr>';
$content .= "<tr><td class=\"list_value_wrap\" colspan=\"5\"><div id=\"message$key\" style=\"display: none;\">";
- $message["body"] = nl2br(htmlspecialchars($message["body"]));
- $message["body"] = expand_urls($message["body"]);
+ $message['body'] = nl2br(htmlspecialchars($message['body']));
+ $message['body'] = expand_urls($message['body']);
- $content .= PrintReady($message["body"])."<br /><br />";
- if (strpos($message["subject"], "RE:")===false) {
- $message["subject"]="RE:".$message["subject"];
+ $content .= PrintReady($message['body']).'<br /><br />';
+ if (strpos($message['subject'], /* I18N: Shortcut for answer the message */ WT_I18N::translate('RE:'))===false) {
+ $message['subject']= /* I18N: Shortcut for answer the message */ WT_I18N::translate('RE:').$message['subject'];
}
if ($user_id) {
- $content .= "<a href=\"javascript:;\" onclick=\"reply('".$user_id."', '".$message["subject"]."'); return false;\">".WT_I18N::translate('Reply')."</a> | ";
+ $content .= "<a href=\"javascript:;\" onclick=\"reply('".addslashes($message['from'])."', '".addslashes($message['subject'])."'); return false;\">".WT_I18N::translate('Reply').'</a> | ';
}
- $content .= "<a href=\"index.php?action=deletemessage&amp;message_id={$key}\" onclick=\"return confirm('".WT_I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.')."');\">".WT_I18N::translate('Delete')."</a></div></td></tr>";
+ $content .= "<a href=\"index.php?action=deletemessage&amp;message_id={$key}\" onclick=\"return confirm('".WT_I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.')."');\">".WT_I18N::translate('Delete').'</a></div></td></tr>';
}
- $content .= "</table>";
- $content .= "<input type=\"submit\" value=\"".WT_I18N::translate('Delete Selected Messages')."\" /><br />";
+ $content .= '</table>';
+ $content .= '<input type="submit" value="'.WT_I18N::translate('Delete Selected Messages').'" /><br />';
}
- $content .= "</form>";
+ $content .= '</form>';
if ($template) {
if ($block) {