Allow configuration of name/email for messages in user config.
This commit is contained in:
parent
2140df64f1
commit
0c9674d36e
|
@ -419,7 +419,7 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
|
|||
global $server, $port, $send_poster_host, $text_error, $CONFIG;
|
||||
global $www_charset, $config_dir, $spooldir;
|
||||
global $msgid_generate, $msgid_fqdn, $rslight_version;
|
||||
|
||||
|
||||
flush();
|
||||
$attachment_temp_dir = $spooldir . "/tmp/";
|
||||
if (! is_dir($attachment_temp_dir)) {
|
||||
|
@ -477,7 +477,7 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
|
|||
fputs($ns, 'Subject: ' . encode_subject($subject) . "\r\n");
|
||||
// For Synchronet use
|
||||
if (isset($CONFIG['synchronet']) && ($CONFIG['synchronet'] == true)) {
|
||||
if(!isset($fromname) || trim($fromname) == '') {
|
||||
if (! isset($fromname) || trim($fromname) == '') {
|
||||
$fromname = 'ALL';
|
||||
}
|
||||
fputs($ns, 'To: ' . $fromname . "\r\n");
|
||||
|
@ -497,8 +497,21 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fputs($ns, 'From: ' . $from . "\r\n");
|
||||
|
||||
// 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");
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ if ($type == "post") {
|
|||
}
|
||||
}
|
||||
// Check that user has not been recently banned
|
||||
if(!is_file($config_dir.'/users/'.strtolower(trim($name)))) {
|
||||
if (! is_file($config_dir . '/users/' . strtolower(trim($name)))) {
|
||||
$type = "retry";
|
||||
$error = $text_error["auth_error"];
|
||||
$_SESSION['pass'] = false;
|
||||
|
@ -272,16 +272,16 @@ 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
|
||||
$type = "retry";
|
||||
|
@ -395,7 +395,7 @@ if ($show == 1) {
|
|||
echo ' or "' . $CONFIG['anonusername'] . '" with no password';
|
||||
}
|
||||
echo '</td></tr><tr>';
|
||||
echo '<td align="right"><b>'.$text_post["password"].'</b></td>';
|
||||
echo '<td align="right"><b>' . $text_post["password"] . '</b></td>';
|
||||
echo '<td align="left">';
|
||||
// if (strcmp($user, $CONFIG['anonusername']) === 0) {
|
||||
// $logged_in = false;
|
||||
|
@ -408,21 +408,33 @@ if ($show == 1) {
|
|||
echo '<input class="post" type="password" name="' . md5($fieldencrypt . "email") . '"';
|
||||
echo 'size="40" maxlength="40">';
|
||||
}
|
||||
echo '<input class="post" type="hidden" name="fromname" value="'.$fromname.'">';
|
||||
$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?
|
||||
if (check_encryption_groups($newsgroups)) {
|
||||
echo '<tr>';
|
||||
echo '<td align="left"><input type="checkbox" name="encryptthis"';
|
||||
echo 'value="encrypt"> <b>Encrypt to:</b></td>';
|
||||
echo '<td><input type="text" name="encryptto" value="'.$fromname.'"></td>';
|
||||
echo '<td><input type="text" name="encryptto" value="' . $fromname . '"></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table></div>';
|
||||
|
||||
echo '<div class="np_post_body">';
|
||||
echo '<table><tr>';
|
||||
echo '<td><b>'.$text_post["message"].'</b><br> <textarea ';
|
||||
echo '<td><b>' . $text_post["message"] . '</b><br> <textarea ';
|
||||
echo 'class="postbody" id="postbody" ';
|
||||
echo 'name="' . md5($fieldencrypt . "body") . '" wrap="soft">';
|
||||
|
||||
|
@ -437,7 +449,7 @@ if ($show == 1) {
|
|||
if (isset($bodyzeile))
|
||||
echo htmlspecialchars($bodyzeile);
|
||||
echo '">';
|
||||
|
||||
|
||||
?>
|
||||
<script language="JavaScript">
|
||||
<!--
|
||||
|
|
|
@ -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