Allow configuration of name/email for messages in user config.
This commit is contained in:
parent
2140df64f1
commit
0c9674d36e
|
@ -498,7 +498,20 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
|
|||
}
|
||||
}
|
||||
|
||||
// Check for custom name/email from user configuration
|
||||
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . $authname . '.config'));
|
||||
if(trim($user_config['display_name']) == '') {
|
||||
unset($user_config['display_name']);
|
||||
}
|
||||
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");
|
||||
} else {
|
||||
fputs($ns, 'From: ' . $from . "\r\n");
|
||||
}
|
||||
|
||||
if ($followupto !== null) {
|
||||
fputs($ns, 'Followup-To: ' . $followupto . "\r\n");
|
||||
}
|
||||
|
|
|
@ -272,15 +272,15 @@ if ($type == "post") {
|
|||
}
|
||||
echo '<p><a href="' . $file_thread . '?group=' . $returngroup . '">Back</a></p>';
|
||||
/*
|
||||
if (isset($_REQUEST['returngroup']) && $_REQUEST['returngroup'] !== '') {
|
||||
echo '<p><a href="' . $file_thread . '?group=' . $_REQUEST['returngroup'] . '">Your post will appear in ' . group_display_name($_REQUEST['returngroup']) . '</a></p>';
|
||||
}
|
||||
if (isset($_SESSION['return_page'])) {
|
||||
echo '<p><a href="' . $file_thread . '?group=' . $returngroup . '">Back</a></p>';
|
||||
//echo '<p><a href="' . $_SESSION['return_page'] . '">Back to Previous Page</a></p>';
|
||||
} else {
|
||||
echo '<p><a href="' . $file_thread . '?group=' . $returngroup . '">Back</a></p>';
|
||||
}
|
||||
* if (isset($_REQUEST['returngroup']) && $_REQUEST['returngroup'] !== '') {
|
||||
* echo '<p><a href="' . $file_thread . '?group=' . $_REQUEST['returngroup'] . '">Your post will appear in ' . group_display_name($_REQUEST['returngroup']) . '</a></p>';
|
||||
* }
|
||||
* if (isset($_SESSION['return_page'])) {
|
||||
* echo '<p><a href="' . $file_thread . '?group=' . $returngroup . '">Back</a></p>';
|
||||
* //echo '<p><a href="' . $_SESSION['return_page'] . '">Back to Previous Page</a></p>';
|
||||
* } else {
|
||||
* echo '<p><a href="' . $file_thread . '?group=' . $returngroup . '">Back</a></p>';
|
||||
* }
|
||||
*/
|
||||
} else {
|
||||
// article not accepted by the newsserver
|
||||
|
@ -408,6 +408,18 @@ if ($show == 1) {
|
|||
echo '<input class="post" type="password" name="' . md5($fieldencrypt . "email") . '"';
|
||||
echo 'size="40" maxlength="40">';
|
||||
}
|
||||
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . strtolower($name) . '.config'));
|
||||
if (isset($user_config['display_name']) && trim($user_config['display_name']) != '') {
|
||||
if (isset($user_config['display_email']) && trim($user_config['display_email']) != '') {
|
||||
echo '<tr><td align="right">';
|
||||
echo '<b>From: </b></td>';
|
||||
$showemail = '<' . $user_config['display_email'] . '>';
|
||||
echo '<td align="left">';
|
||||
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 '</td></tr>';
|
||||
// May we post encrypted messages to this group?
|
||||
|
|
|
@ -204,6 +204,8 @@ if ($_POST['command'] != 'Configuration' && $_POST['command'] != 'SaveConfig') {
|
|||
}
|
||||
// Apply Config
|
||||
if (isset($_POST['command']) && $_POST['command'] == 'SaveConfig') {
|
||||
$user_config['display_name'] = $_POST['display_name'];
|
||||
$user_config['display_email'] = $_POST['display_email'];
|
||||
$user_config['signature'] = $_POST['signature'];
|
||||
$user_config['xface'] = $_POST['xface'];
|
||||
$user_config['timezone'] = $_POST['timezone'];
|
||||
|
@ -243,26 +245,52 @@ if (is_dir($themedir)) {
|
|||
closedir($theme_list);
|
||||
}
|
||||
}
|
||||
|
||||
// Get settings for name and email
|
||||
if (isset($user_config['display_name'])) {
|
||||
$display_name = $user_config['display_name'];
|
||||
} else {
|
||||
$display_name = $_POST['username'];
|
||||
}
|
||||
if (isset($user_config['display_email'])) {
|
||||
$display_email = $user_config['display_email'];
|
||||
} else {
|
||||
if (($display_email = get_user_config($_POST['username'], 'email')) == false) {
|
||||
$display_email = $_POST['username'] . '@' . $CONFIG['email_tail'];
|
||||
}
|
||||
}
|
||||
sort($themes);
|
||||
if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
||||
// Show Config
|
||||
echo '<hr><h1 class="np_thread_headline">Configuration:</h1>';
|
||||
echo '<hr><h1 class="np_thread_headline"></h1>';
|
||||
echo '<table cellspacing="0" width="100%" class="np_results_table">';
|
||||
echo '<tr class="np_thread_head"><td class="np_thread_head">Settings for ' . $_POST['username'] . ' (leave blank for none):</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 '<tr class="np_result_line1">';
|
||||
// User Display Name
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Display Name for posts: </h3>';
|
||||
echo '<input name="display_name" type="text" id="username"value="' . $display_name . '" maxlength="40"></td>';
|
||||
echo '</tr>';
|
||||
// User Display Email
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Display Email for posts: </h3>';
|
||||
echo '<input name="display_email" type="text" id="username"value="' . $display_email . '" maxlength="40"></td>';
|
||||
echo '</tr>';
|
||||
// Signature
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";>Signature:</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 '</textarea></td>';
|
||||
echo '</tr>';
|
||||
// X-Face
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";>X-Face:</td>';
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>X-Face:</h3></td>';
|
||||
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><textarea class="configuration" id="xface" name="xface" rows="4" cols="80">' . $user_config['xface'];
|
||||
echo '</textarea></td>';
|
||||
echo '</tr>';
|
||||
// Theme
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";>Theme: (' . $user_config['theme'] . ')</td>';
|
||||
if (isset($user_config['theme'])) {
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Theme: (' . $user_config['theme'] . ')</h3></td>';
|
||||
} else {
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Theme:</h3></td>';
|
||||
}
|
||||
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word">';
|
||||
echo '<select name="listbox" class="theme_listbox" size="10">';
|
||||
foreach ($themes as $theme) {
|
||||
|
@ -276,7 +304,7 @@ if (isset($_POST['command']) && $_POST['command'] == 'Configuration') {
|
|||
echo '</td>';
|
||||
echo '</tr>';
|
||||
// Subscriptions
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";>Subscribed:</td>';
|
||||
echo '<td class="np_result_line1" style="word-wrap:break-word";><h3>Subscribed:</h3></td>';
|
||||
echo '</tr><tr><td class="np_result_line1" style="word-wrap:break-word";><textarea class="configuration" id="subscribed" name="subscribed" rows="10" cols="40">';
|
||||
foreach ($userdata as $key => $value) {
|
||||
echo $key . "\n";
|
||||
|
|
Loading…
Reference in New Issue