Add overrides option to disable changing name/email display in Configure.

This commit is contained in:
Retro_Guy 2024-02-19 16:33:44 -07:00
parent 0c9674d36e
commit 3d9c35f01a
3 changed files with 54 additions and 42 deletions

View File

@ -416,7 +416,7 @@ function check_rate_limit($name, $set = 0, $gettime = 0)
*/ */
function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis = null, $encryptto = null, $authname = null, $fromname, $followupto = null, $do_attach = null) function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis = null, $encryptto = null, $authname = null, $fromname, $followupto = null, $do_attach = null)
{ {
global $server, $port, $send_poster_host, $text_error, $CONFIG; global $server, $port, $send_poster_host, $text_error, $CONFIG, $OVERRIDES;
global $www_charset, $config_dir, $spooldir; global $www_charset, $config_dir, $spooldir;
global $msgid_generate, $msgid_fqdn, $rslight_version; global $msgid_generate, $msgid_fqdn, $rslight_version;
@ -497,21 +497,24 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
} }
} }
} }
// Check for custom name/email from user configuration // Check for custom name/email from user configuration
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . $authname . '.config')); if ($OVERRIDES['disable_change_name'] != true) {
if(trim($user_config['display_name']) == '') { $user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . $authname . '.config'));
unset($user_config['display_name']); if (trim($user_config['display_name']) == '') {
} unset($user_config['display_name']);
if(trim($user_config['display_email']) == '') { }
unset($user_config['display_email']); if (trim($user_config['display_email']) == '') {
} unset($user_config['display_email']);
if (isset($user_config['display_name']) && isset($user_config['display_email'])) { }
fputs($ns, 'From: ' . $user_config['display_name'] .' <' .$user_config['display_email'] . ">\r\n"); if (isset($user_config['display_name']) && isset($user_config['display_email'])) {
fputs($ns, 'From: ' . $user_config['display_name'] . ' <' . $user_config['display_email'] . ">\r\n");
} else {
fputs($ns, 'From: ' . $from . "\r\n");
}
} else { } else {
fputs($ns, 'From: ' . $from . "\r\n"); fputs($ns, 'From: ' . $from . "\r\n");
} }
if ($followupto !== null) { if ($followupto !== null) {
fputs($ns, 'Followup-To: ' . $followupto . "\r\n"); fputs($ns, 'Followup-To: ' . $followupto . "\r\n");
} }

View File

@ -408,16 +408,19 @@ if ($show == 1) {
echo '<input class="post" type="password" name="' . md5($fieldencrypt . "email") . '"'; echo '<input class="post" type="password" name="' . md5($fieldencrypt . "email") . '"';
echo 'size="40" maxlength="40">'; echo 'size="40" maxlength="40">';
} }
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . strtolower($name) . '.config')); // Check for custom name/email from user configuration
if (isset($user_config['display_name']) && trim($user_config['display_name']) != '') { if ($OVERRIDES['disable_change_name'] != true) {
if (isset($user_config['display_email']) && trim($user_config['display_email']) != '') { $user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . strtolower($name) . '.config'));
echo '<tr><td align="right">'; if (isset($user_config['display_name']) && trim($user_config['display_name']) != '') {
echo '<b>From: </b></td>'; if (isset($user_config['display_email']) && trim($user_config['display_email']) != '') {
$showemail = '<' . $user_config['display_email'] . '>'; echo '<tr><td align="right">';
echo '<td align="left">'; echo '<b>From: </b></td>';
echo '<input class="post" type="text" value="' . $user_config['display_name'] . ' ' . htmlspecialchars($showemail) . '" size="40" maxlength="40" readonly>'; $showemail = '<' . $user_config['display_email'] . '>';
// echo $user_config['display_name'] . ' ' . htmlspecialchars($showemail); echo '<td align="left">';
echo '</td></tr>'; echo '<input class="post" type="text" value="' . $user_config['display_name'] . ' ' . htmlspecialchars($showemail) . '" size="40" maxlength="40" readonly>';
// echo $user_config['display_name'] . ' ' . htmlspecialchars($showemail);
echo '</td></tr>';
}
} }
} }
echo '<input class="post" type="hidden" name="fromname" value="' . $fromname . '">'; echo '<input class="post" type="hidden" name="fromname" value="' . $fromname . '">';

View File

@ -204,8 +204,10 @@ if ($_POST['command'] != 'Configuration' && $_POST['command'] != 'SaveConfig') {
} }
// Apply Config // Apply Config
if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') { if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') {
$user_config['display_name'] = $_POST['display_name']; if ($OVERRIDES['disable_change_name'] != true) {
$user_config['display_email'] = $_POST['display_email']; $user_config['display_name'] = $_POST['display_name'];
$user_config['display_email'] = $_POST['display_email'];
}
$user_config['signature'] = $_POST['signature']; $user_config['signature'] = $_POST['signature'];
$user_config['xface'] = $_POST['xface']; $user_config['xface'] = $_POST['xface'];
$user_config['timezone'] = $_POST['timezone']; $user_config['timezone'] = $_POST['timezone'];
@ -247,16 +249,18 @@ if (is_dir($themedir)) {
} }
// Get settings for name and email // Get settings for name and email
if (isset($user_config['display_name'])) { if ($OVERRIDES['disable_change_name'] != true) {
$display_name = $user_config['display_name']; if (isset($user_config['display_name'])) {
} else { $display_name = $user_config['display_name'];
$display_name = $_POST['username']; } else {
} $display_name = $_POST['username'];
if (isset($user_config['display_email'])) { }
$display_email = $user_config['display_email']; if (isset($user_config['display_email'])) {
} else { $display_email = $user_config['display_email'];
if (($display_email = get_user_config($_POST['username'], 'email')) == false) { } else {
$display_email = $_POST['username'] . '@' . $CONFIG['email_tail']; if (($display_email = get_user_config($_POST['username'], 'email')) == false) {
$display_email = $_POST['username'] . '@' . $CONFIG['email_tail'];
}
} }
} }
sort($themes); sort($themes);
@ -267,14 +271,16 @@ if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
echo '<tr class="np_thread_head"><td class="np_thread_head"><h2>Settings for ' . $_POST['username'] . ':</h2></td></tr>'; echo '<tr class="np_thread_head"><td class="np_thread_head"><h2>Settings for ' . $_POST['username'] . ':</h2></td></tr>';
echo '<form method="post" action="user.php">'; echo '<form method="post" action="user.php">';
echo '<tr class="np_result_line1">'; echo '<tr class="np_result_line1">';
// User Display Name if ($OVERRIDES['disable_change_name'] != true) {
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Display Name for posts: </h3>'; // User Display Name
echo '<input name="display_name" type="text" id="username"value="' . $display_name . '" maxlength="40"></td>'; echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Display Name for posts: </h3>';
echo '</tr>'; echo '<input name="display_name" type="text" id="username"value="' . $display_name . '" maxlength="40"></td>';
// User Display Email echo '</tr>';
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Display Email for posts: </h3>'; // User Display Email
echo '<input name="display_email" type="text" id="username"value="' . $display_email . '" maxlength="40"></td>'; echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Display Email for posts: </h3>';
echo '</tr>'; echo '<input name="display_email" type="text" id="username"value="' . $display_email . '" maxlength="40"></td>';
echo '</tr>';
}
// Signature // Signature
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Signature:</h3></td>'; echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Signature:</h3></td>';
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><textarea class="configuration" id="signature" name="signature" rows="6" cols="70">' . $user_config['signature']; echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><textarea class="configuration" id="signature" name="signature" rows="6" cols="70">' . $user_config['signature'];