Fix headers for posting through Synchronet.

This commit is contained in:
Retro_Guy 2024-02-09 10:39:09 -07:00
parent 754ac06b8c
commit 7ed204fc03
3 changed files with 12 additions and 9 deletions

View File

@ -414,11 +414,12 @@ function check_rate_limit($name, $set = 0, $gettime = 0)
* $ref: The references of the article
* $body: The article itself
*/
function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis = null, $encryptto = null, $authname = null, $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 $www_charset, $config_dir, $spooldir;
global $msgid_generate, $msgid_fqdn, $rslight_version;
flush();
$attachment_temp_dir = $spooldir . "/tmp/";
if (! is_dir($attachment_temp_dir)) {
@ -475,10 +476,12 @@ function message_post($subject, $from, $newsgroups, $ref, $body, $encryptthis =
fputs($ns, 'Subject: ' . encode_subject($subject) . "\r\n");
// For Synchronet use
if (isset($fromname) && (isset($CONFIG['synchronet']) && ($CONFIG['synchronet'] == true))) {
// if ( isset($fromname) && isset($CONFIG['synchronet']) ) {
if (isset($CONFIG['synchronet']) && ($CONFIG['synchronet'] == true)) {
if(!isset($fromname) || trim($fromname) == '') {
$fromname = 'ALL';
}
fputs($ns, 'To: ' . $fromname . "\r\n");
$fromname = "";
fputs($ns, 'X-Comment-To: ' . $fromname . "\r\n");
}
// X-Rslight headers

View File

@ -1237,8 +1237,8 @@ function check_bbs_auth($username, $password)
function check_encryption_groups($request)
{
global $config_path;
$groupsFilename = $config_path . "encryption_ok.txt";
global $config_dir;
$groupsFilename = $config_dir . "encryption_ok.txt";
if ($groupsFileHandle = @fopen($groupsFilename, 'r')) {
while (! feof($groupsFileHandle)) {
$buffer = fgets($groupsFileHandle);

View File

@ -26,7 +26,6 @@ session_start();
if (! isset($_SESSION['last_access']) || (time() - $_SESSION['last_access']) > 60) {
$_SESSION['last_access'] = time();
}
include "config.inc.php";
$CONFIG = include ($config_file);
$logfile = $logdir . '/post.log';
@ -248,9 +247,9 @@ if ($type == "post") {
if (isset($_FILES["photo"]) && $_FILES["photo"]["error"] == 0) {
$_FILES['photo']['name'] = preg_replace('/[^a-zA-Z0-9\.]/', '_', $_FILES['photo']['name']);
// There is an attachment to handle
$message = message_post(quoted_printable_encode($subject), $nemail . " (" . quoted_printable_encode($name) . ")", $newsgroups, $references_array, addslashes($body), $_POST['encryptthis'], $_POST['encryptto'], strtolower($name), null, true);
$message = message_post(quoted_printable_encode($subject), $nemail . " (" . quoted_printable_encode($name) . ")", $newsgroups, $references_array, addslashes($body), $_POST['encryptthis'], $_POST['encryptto'], strtolower($name), $_POST['fromname'], null, true);
} else {
$message = message_post(quoted_printable_encode($subject), $nemail . " (" . quoted_printable_encode($name) . ")", $newsgroups, $references_array, addslashes($body), $_POST['encryptthis'], $_POST['encryptto'], strtolower($name));
$message = message_post(quoted_printable_encode($subject), $nemail . " (" . quoted_printable_encode($name) . ")", $newsgroups, $references_array, addslashes($body), $_POST['encryptthis'], $_POST['encryptto'], strtolower($name), $_POST['fromname']);
}
// Article sent without errors, or duplicate?
if ((substr($message, 0, 3) == "240") || (substr($message, 0, 7) == "441 435")) {
@ -409,6 +408,7 @@ 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.'">';
echo '</td></tr>';
// May we post encrypted messages to this group?
if (check_encryption_groups($newsgroups)) {