2020-11-29 01:55:31 +01:00
< ? php
2023-08-20 00:33:05 +02:00
/*
* rslight NNTP <-> HTTP Gateway
* Download : https :// news . novabbs . com / getrslight
2020-11-29 01:55:31 +01:00
*
2023-08-20 00:33:05 +02:00
* Based on Newsportal by Florian Amrhein
2020-11-29 01:55:31 +01:00
*
2023-08-20 00:33:05 +02:00
* E - Mail : retroguy @ novabbs . com
* Web : https :// news . novabbs . com
2020-11-29 01:55:31 +01:00
*
2023-08-20 00:33:05 +02:00
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
2020-11-29 01:55:31 +01:00
*
2023-08-20 00:33:05 +02:00
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
2020-11-29 01:55:31 +01:00
*
2023-08-20 00:33:05 +02:00
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2020-11-29 01:55:31 +01:00
*/
2024-07-20 17:01:24 +02:00
include " config.inc.php " ;
2024-09-07 15:03:57 +02:00
$CONFIG = include ( $config_file );
2024-07-20 17:01:24 +02:00
include $file_newsportal ;
include " head.inc " ;
if ( disable_page_by_user_agent ( $client_device , " bot " , " Post " )) {
echo " <center>Page Disabled</center> " ;
include " tail.inc " ;
exit ();
}
2023-12-23 21:07:03 +01:00
if ( ! isset ( $_SESSION [ 'last_access' ]) || ( time () - $_SESSION [ 'last_access' ]) > 60 ) {
$_SESSION [ 'last_access' ] = time ();
}
2024-07-20 17:01:24 +02:00
2023-10-04 15:26:37 +02:00
$logfile = $logdir . '/post.log' ;
2024-07-20 17:01:24 +02:00
@ $fieldnamedecrypt = $_REQUEST [ 'fielddecrypt' ];
@ $newsgroups = $_REQUEST [ " newsgroups " ];
@ $group = $_REQUEST [ " group " ];
@ $type = $_REQUEST [ " type " ];
@ $subject = stripslashes ( $_POST [ md5 ( $fieldnamedecrypt . " subject " )]);
@ $name = $_POST [ md5 ( $fieldnamedecrypt . " name " )];
@ $email = $_POST [ md5 ( $fieldnamedecrypt . " email " )];
@ $body = $_POST [ md5 ( $fieldnamedecrypt . " body " )];
@ $abspeichern = $_REQUEST [ " abspeichern " ];
@ $references = $_REQUEST [ " references " ];
@ $id = $_REQUEST [ " id " ];
2024-09-07 15:03:57 +02:00
if ( isset ( $_REQUEST [ 'followupto' ]) && trim ( $_REQUEST [ 'followupto' ]) != '' ) {
2024-08-28 12:51:07 +02:00
$followupto = trim ( $_REQUEST [ 'followupto' ]);
2024-09-20 00:43:59 +02:00
$followupto = sanitize_header ( $followupto );
2024-08-28 12:51:07 +02:00
} else {
$followupto = null ;
}
2024-09-20 00:43:59 +02:00
2024-09-20 00:49:27 +02:00
// Check some header strings for bad characters
2024-09-20 00:43:59 +02:00
$newsgroups = sanitize_header ( $newsgroups );
$subject = sanitize_header ( $subject );
$email = sanitize_header ( $email );
2024-07-20 17:01:24 +02:00
// Load name from cookies
if ( $setcookies ) {
if (( isset ( $_COOKIE [ " mail_name " ])) && ( ! isset ( $name )))
$name = $_COOKIE [ " mail_name " ];
}
2024-07-23 13:36:54 +02:00
// Truncate username at 30 characters to avoid abuse
$name = substr ( $name , 0 , 30 );
2024-09-20 00:49:27 +02:00
$name = sanitize_header ( $name );
2024-07-23 13:36:54 +02:00
2024-07-21 15:30:13 +02:00
$logged_in = false ;
2024-09-07 15:03:57 +02:00
if ( trim ( $name ) != '' ) {
2024-07-21 15:30:13 +02:00
$logged_in = verify_logged_in ( trim ( strtolower ( $name )));
2023-12-23 16:57:12 +01:00
}
2024-07-21 15:30:13 +02:00
2023-10-04 15:26:37 +02:00
// This will log user post info (group and username)
$enable_post_log = false ;
if ( $OVERRIDES [ 'enable_post_log' ] > 0 ) {
$enable_post_log = $OVERRIDES [ 'enable_post_log' ];
}
2023-08-20 00:33:05 +02:00
2024-07-18 15:11:14 +02:00
$allow_ng_header_edit_post = true ;
$allow_ng_header_edit_reply = false ;
2024-09-07 15:03:57 +02:00
if ( isset ( $OVERRIDES [ 'allow_ng_header_edit' ])) {
if ( $OVERRIDES [ 'allow_ng_header_edit' ] == 'post' ) {
2024-07-18 15:11:14 +02:00
$allow_ng_header_edit_post = true ;
} else {
$allow_ng_header_edit_post = false ;
}
2024-09-07 15:03:57 +02:00
if ( $OVERRIDES [ 'allow_ng_header_edit' ] == 'reply' ) {
2024-07-18 15:11:14 +02:00
$allow_ng_header_edit_reply = true ;
} else {
$allow_ng_header_edit_reply = false ;
}
2024-09-07 15:03:57 +02:00
if ( $OVERRIDES [ 'allow_ng_header_edit' ] == 'both' ) {
2024-07-18 15:11:14 +02:00
$allow_ng_header_edit_post = true ;
$allow_ng_header_edit_reply = true ;
}
2024-09-07 15:03:57 +02:00
if ( $OVERRIDES [ 'allow_ng_header_edit' ] == 'none' ) {
2024-07-18 15:11:14 +02:00
$allow_ng_header_edit_post = false ;
$allow_ng_header_edit_reply = false ;
}
}
$allow_ngs_edit = false ;
2024-09-07 15:03:57 +02:00
if ( $type == 'reply' ) {
if ( $allow_ng_header_edit_reply ) {
2024-07-18 15:11:14 +02:00
$allow_ngs_edit = true ;
}
2024-09-07 15:03:57 +02:00
if ( isset ( $OVERRIDES [ 'max_crosspost_reply' ]) && $OVERRIDES [ 'max_crosspost_reply' ] > 0 ) {
$max_crosspost = $OVERRIDES [ 'max_crosspost_reply' ];
} else {
$max_crosspost = 12 ;
}
2024-07-12 15:54:15 +02:00
} else {
2024-09-07 15:03:57 +02:00
if ( $allow_ng_header_edit_post ) {
2024-07-18 15:11:14 +02:00
$allow_ngs_edit = true ;
}
2024-09-07 15:03:57 +02:00
if ( isset ( $OVERRIDES [ 'max_crosspost_post' ]) && $OVERRIDES [ 'max_crosspost_post' ] > 0 ) {
$max_crosspost = $OVERRIDES [ 'max_crosspost_post' ];
} else {
$max_crosspost = 3 ;
}
2024-07-12 15:54:15 +02:00
}
2023-09-09 14:52:18 +02:00
if ( ! isset ( $group ) && isset ( $newsgroups )) {
2023-08-20 00:33:05 +02:00
$group = $newsgroups ;
2023-09-09 14:52:18 +02:00
}
2020-11-29 01:55:31 +01:00
// Save name in cookies
2023-12-23 16:57:12 +01:00
if ( strcmp ( stripslashes ( $name ), $CONFIG [ 'anonusername' ]) !== 0 ) {
if (( $setcookies == true ) && ( isset ( $abspeichern )) && ( $abspeichern == " ja " )) {
setcookie ( " mail_name " , stripslashes ( $name ), time () + ( 3600 * 24 * 90 ), " / " );
}
2023-08-20 00:33:05 +02:00
}
if (( isset ( $post_server )) && ( $post_server != " " ))
$server = $post_server ;
if (( isset ( $post_port )) && ( $post_port != " " ))
$port = $post_port ;
2020-11-29 01:55:31 +01:00
2023-08-20 00:33:05 +02:00
global $synchro_user , $synchro_pass ;
2020-11-29 01:55:31 +01:00
// check to which groups the user is allowed to post to
2023-08-20 00:33:05 +02:00
$thisgroup = _rawurldecode ( $_REQUEST [ 'group' ]);
2024-02-29 19:37:59 +01:00
// Is this a reply to an article containing Followup-To?
2024-04-15 12:47:44 +02:00
if ( isset ( $_REQUEST [ 'fgroups' ])) {
2024-08-28 12:51:07 +02:00
$thisgroup = preg_replace ( '!\s+!' , ',' , $_REQUEST [ 'fgroups' ]);
2024-08-28 13:25:10 +02:00
$thisgroup = preg_replace ( '/\,+/' , ',' , $thisgroup );
2024-02-29 19:37:59 +01:00
}
2024-02-25 04:33:14 +01:00
$newsgroups = $thisgroup ;
if ( $_REQUEST [ 'returngroup' ]) {
2024-02-25 02:57:10 +01:00
$returngroup = $_REQUEST [ 'returngroup' ];
} else {
$returngroup = $thisgroup ;
}
2024-07-12 15:54:15 +02:00
$linkgroups = preg_split ( " /[ \ s,]+/ " , $returngroup );
2024-09-07 15:03:57 +02:00
foreach ( $linkgroups as $linkgroup ) {
2024-07-12 15:54:15 +02:00
$linkgroup = trim ( $linkgroup );
if ( get_section_by_group ( $linkgroup )) {
$returngroup = $linkgroup ;
break ;
}
}
2023-08-20 00:33:05 +02:00
echo '<h1 class="np_thread_headline">' ;
echo '<a href="' . $file_index . '" target=' . $frame [ 'menu' ] . '>' . basename ( getcwd ()) . '</a> / ' ;
2024-03-01 00:34:24 +01:00
echo '<a href="' . $file_thread . '?group=' . rawurlencode ( $returngroup ) . '" target=' . $frame [ " content " ] . '>' . htmlspecialchars ( group_display_name ( $returngroup )) . '</a>' ;
2023-08-20 00:33:05 +02:00
if ( isset ( $type ) && $type == 'post' ) {
echo ' / ' . $subject . '</h1>' ;
} else {
2021-02-24 09:52:20 +01:00
echo '</h1>' ;
2023-08-20 00:33:05 +02:00
}
2023-04-22 20:29:58 +02:00
2020-11-29 01:55:31 +01:00
// has the user write-rights on the newsgroups?
2023-08-20 00:33:05 +02:00
if (( function_exists ( " npreg_group_has_read_access " ) && ! npreg_group_has_read_access ( $newsgroups )) || ( function_exists ( " npreg_group_has_write_access " ) && ! npreg_group_has_write_access ( $newsgroups ))) {
die ( " access denied " );
2020-11-29 01:55:31 +01:00
}
// Load name and email from the registration system, if available
2023-08-20 00:33:05 +02:00
if ( function_exists ( " npreg_get_name " )) {
$name = npreg_get_name ();
2020-11-29 01:55:31 +01:00
}
2023-08-20 00:33:05 +02:00
if ( function_exists ( " npreg_get_email " )) {
$email = npreg_get_email ();
$form_noemail = true ;
2020-11-29 01:55:31 +01:00
}
2023-08-20 00:33:05 +02:00
if ( ! strcmp ( $name , $CONFIG [ 'anonusername' ]) && ( isset ( $CONFIG [ 'anonuser' ]))) {
$userpass = $CONFIG [ 'anonuserpass' ];
$email = $name . $CONFIG [ 'email_tail' ];
2024-06-05 13:32:38 +02:00
$_SESSION [ 'pass' ] = false ;
2020-11-29 01:55:31 +01:00
} else {
2023-08-20 00:33:05 +02:00
$userpass = $email ;
$request = " email " ;
$get_email = get_user_config ( $name , $request );
if ( $get_email === FALSE ) {
$email = $name . $CONFIG [ 'email_tail' ];
} else {
$email = trim ( $get_email );
}
2020-11-29 01:55:31 +01:00
}
if ( isset ( $CONFIG [ 'synchronet' ]) && ( $CONFIG [ 'synchronet' ] == true )) {
2023-08-20 00:33:05 +02:00
$synchro_user = $name ;
$synchro_pass = $userpass ;
}
2020-11-29 01:55:31 +01:00
2023-08-20 00:33:05 +02:00
if ( $name == " " )
$name = $_SERVER [ 'REMOTE_USER' ];
2020-11-29 01:55:31 +01:00
2023-08-20 00:33:05 +02:00
if (( ! isset ( $references )) || ( $references == " " )) {
$references = false ;
2020-11-29 01:55:31 +01:00
}
2023-08-20 00:33:05 +02:00
if ( ! isset ( $type )) {
$type = " new " ;
2020-11-29 01:55:31 +01:00
}
2023-08-20 00:33:05 +02:00
if ( $type == " new " ) {
$subject = " " ;
$bodyzeile = " " ;
$show = 1 ;
2020-11-29 01:55:31 +01:00
}
// Is there a new article to post to the newsserver?
2023-08-20 00:33:05 +02:00
if ( $type == " post " ) {
$show = 0 ;
if ( ! $CONFIG [ 'synchronet' ]) {
2023-12-23 16:57:12 +01:00
if ( ! $logged_in ) {
if ( check_bbs_auth ( trim ( $name ), $userpass ) == FALSE ) {
$type = " retry " ;
$error = $text_error [ " auth_error " ];
$_SESSION [ 'pass' ] = false ;
$logged_in = false ;
} else {
$_SESSION [ 'pass' ] = true ;
$logged_in = true ;
2024-07-30 15:31:32 +02:00
if ( set_user_logged_in_cookies ( $name , $keys )) {
file_put_contents ( $auth_log , " \n " . logging_prefix () . " SET AUTH COOKIES for: " . $name , FILE_APPEND );
}
2023-12-23 16:57:12 +01:00
}
2024-07-17 15:34:52 +02:00
} else {
// Update cookie times to stay logged in
2024-07-30 15:31:32 +02:00
if ( set_user_logged_in_cookies ( $name , $keys )) {
file_put_contents ( $auth_log , " \n " . logging_prefix () . " UPDATED AUTH COOKIES for: " . $name , FILE_APPEND );
}
2020-12-04 07:12:04 +01:00
}
2023-04-14 03:52:30 +02:00
}
2024-01-14 14:53:33 +01:00
// Check that user has not been recently banned
2024-02-19 19:39:22 +01:00
if ( ! is_file ( $config_dir . '/users/' . strtolower ( trim ( $name )))) {
2024-01-14 14:53:33 +01:00
$type = " retry " ;
$error = $text_error [ " auth_error " ];
$_SESSION [ 'pass' ] = false ;
$logged_in = false ;
}
2023-08-20 00:33:05 +02:00
// error handling
if ( trim ( $body ) == " " ) {
$type = " retry " ;
$error = $text_post [ " missing_message " ];
}
if (( trim ( $email ) == " " ) && ( ! isset ( $anonym_address ))) {
$type = " retry " ;
$error = $text_post [ " missing_email " ];
}
if (( $email ) && ( ! validate_email ( trim ( $email )))) {
$type = " retry " ;
$error = $text_post [ " error_wrong_email " ];
}
if ( trim ( $name ) == " " ) {
$type = " retry " ;
$error = $text_post [ " missing_name " ];
}
if ( trim ( $subject ) == " " ) {
$type = " retry " ;
$error = $text_post [ " missing_subject " ];
}
2024-09-07 15:03:57 +02:00
if ( $allow_ngs_edit ) {
2024-07-17 00:14:24 +02:00
$grouptotal = preg_split ( " /( | \ ,)/ " , $newsgroups );
2024-09-07 15:03:57 +02:00
if ( count ( $grouptotal ) > $max_crosspost ) {
2024-07-12 15:54:15 +02:00
$type = " retry " ;
$error = " Too many newsgroups " ;
}
}
2023-08-20 00:33:05 +02:00
// captcha-check
if (( $post_captcha ) && ( captcha :: check () == false )) {
$type = " retry " ;
$error = $text_post [ " captchafail " ];
}
if ( $type == " post " ) {
$name = trim ( $name );
if ( ! $CONFIG [ 'readonly' ]) {
// post article to the newsserver
if ( $references )
$references_array = explode ( " " , $references );
else
$references_array = false ;
if (( $email == " " ) && ( isset ( $anonym_address )))
$nemail = $anonym_address ;
else
$nemail = $email ;
$rate_limit = get_user_config ( $name , 'rate_limit' );
if (( $rate_limit !== FALSE ) && ( $rate_limit > 0 )) {
$CONFIG [ 'rate_limit' ] = $rate_limit ;
}
if ( $CONFIG [ 'rate_limit' ] == true ) {
$postsremaining = check_rate_limit ( $name );
if ( $postsremaining < 1 ) {
$wait = check_rate_limit ( $name , 0 , 1 );
echo 'You have reached the limit of ' . $CONFIG [ 'rate_limit' ] . ' posts per hour.<br />Please wait ' . round ( $wait ) . ' minutes before posting again.' ;
2024-01-11 15:48:20 +01:00
echo '<p><a href="' . $file_thread . '?group=' . urlencode ( $returngroup ) . '">' . $text_post [ " button_back " ] . '</a> ' . $text_post [ " button_back2 " ] . ' ' . group_display_name ( $returngroup ) . '</p>' ;
2023-08-20 00:33:05 +02:00
return ;
}
}
2024-06-05 13:32:38 +02:00
2024-05-18 21:10:14 +02:00
// Wrap long lines in message body
$body = wrap_post ( $body );
2024-06-05 13:32:38 +02:00
2023-08-20 00:33:05 +02:00
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
2024-08-28 12:51:07 +02:00
$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' ], $followupto , true );
2024-05-05 19:21:25 +02:00
} else {
2024-08-28 12:51:07 +02:00
$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' ], $followupto );
2023-08-20 00:33:05 +02:00
}
// Article sent without errors, or duplicate?
if (( substr ( $message , 0 , 3 ) == " 240 " ) || ( substr ( $message , 0 , 7 ) == " 441 435 " )) {
2024-04-16 16:19:03 +02:00
// Is there a moderated group in Newsgroups: ?
2024-04-18 12:33:36 +02:00
if ( is_moderated ( $newsgroups )) {
2024-04-16 16:19:03 +02:00
echo '<p>** <i>Moderated Newsgroup **</p>' ;
echo '<p>** <i>Message Queued for Moderation **</p>' ;
} else {
echo '<p>' . $text_post [ " message_posted2 " ] . '</p>' ;
}
2023-08-20 00:33:05 +02:00
if ( isset ( $CONFIG [ 'auto_return' ]) && ( $CONFIG [ 'auto_return' ] == true )) {
2024-01-11 15:48:20 +01:00
echo '<meta http-equiv="refresh" content="0;url=' . $file_thread . '?group=' . urlencode ( $returngroup ) . '"' ;
2023-08-20 00:33:05 +02:00
}
if ( $CONFIG [ 'rate_limit' ] == true ) {
$postsremaining = check_rate_limit ( $name , 1 );
echo 'You have ' . $postsremaining . ' posts remaining of ' . $CONFIG [ 'rate_limit' ] . ' posts per hour.<br />' ;
if ( $postsremaining < 1 ) {
$wait = check_rate_limit ( $name , 0 , 1 );
echo 'Please wait ' . round ( $wait ) . ' minutes before posting again.<br />' ;
}
}
2024-07-16 13:51:33 +02:00
echo '<p><a href="' . $file_thread . '?group=' . urlencode ( $returngroup ) . '">Back</a></p>' ;
2023-08-20 00:33:05 +02:00
} else {
// article not accepted by the newsserver
$type = " retry " ;
$error = $text_post [ " error_newsserver " ] . " <br><pre> $message </pre> " ;
}
} else {
echo $text_post [ " error_readonly " ];
}
2020-11-29 01:55:31 +01:00
}
}
// A reply of an other article.
2023-08-20 00:33:05 +02:00
if ( $type == " reply " ) {
$message = message_read ( $id , 0 , $newsgroups );
$head = $message -> header ;
2024-06-30 09:53:56 +02:00
$body = explode ( " \n " , rtrim ( $message -> body [ 0 ]));
2023-08-20 00:33:05 +02:00
nntp_close ( $ns );
if ( $head -> name != " " ) {
$bodyzeile = $head -> name ;
2020-11-29 01:55:31 +01:00
} else {
2023-08-20 00:33:05 +02:00
$bodyzeile = $head -> from ;
2020-11-29 01:55:31 +01:00
}
2024-07-07 10:20:00 +02:00
// For Synchronet use (deprecated)
2023-08-20 00:33:05 +02:00
$fromname = $bodyzeile ;
2024-09-07 15:03:57 +02:00
2024-07-07 10:20:00 +02:00
// Set quote reply format (On date somebody wrote:)
2024-09-07 15:03:57 +02:00
if ( ! isset ( $OVERRIDES [ 'quote_head' ])) {
2024-07-07 10:20:00 +02:00
$OVERRIDES [ 'quote_head' ] = 'date_name' ;
}
2024-09-07 15:03:57 +02:00
switch ( $OVERRIDES [ 'quote_head' ]) {
2024-07-07 10:20:00 +02:00
case 'date_name' :
2024-07-08 09:30:07 +02:00
$bodyzeile = " On " . date ( " D, j M Y G:i:s O, " , $head -> date ) . " " . $bodyzeile . $text_post [ " wrote_suffix " ] . " \n \n " ;
2024-07-07 10:20:00 +02:00
break ;
case 'msgid_name' :
$bodyzeile = " In " . $head -> id . " , " . $bodyzeile . $text_post [ " wrote_suffix " ] . " \n \n " ;
break ;
case 'date_msgid_name' :
2024-07-08 09:30:07 +02:00
$bodyzeile = " On " . date ( " D, j M Y G:i:s O, " , $head -> date ) . " in " . $head -> id . " , " . $bodyzeile . $text_post [ " wrote_suffix " ] . " \n \n " ;
2024-07-07 10:20:00 +02:00
break ;
case 'name' :
$bodyzeile = $text_post [ " wrote_prefix " ] . $bodyzeile . $text_post [ " wrote_suffix " ] . " \n \n " ;
break ;
default :
2024-07-08 09:30:07 +02:00
$bodyzeile = " On " . date ( " D, j M Y G:i:s O, " , $head -> date ) . " " . $bodyzeile . $text_post [ " wrote_suffix " ] . " \n \n " ;
2024-07-07 10:20:00 +02:00
break ;
}
2024-09-07 15:03:57 +02:00
for ( $i = 0 ; $i <= count ( $body ) - 1 ; $i ++ ) {
2024-06-30 17:22:25 +02:00
if (( isset ( $cutsignature )) && ( $cutsignature == true ) && ( $body [ $i ] == '-- ' )) {
2023-08-20 00:33:05 +02:00
break ;
2024-06-30 17:22:25 +02:00
}
// Try not to quote blank lines at the end of all quotes
2024-09-07 15:03:57 +02:00
if (( trim ( $body [ $i ]) == " " ) && ( $body [ $i + 1 ] == '-- ' || $i >= count ( $body ) - 1 )) {
} else {
2024-06-30 17:22:25 +02:00
// Remove spaces from starting quote '>' characters
$body = preg_replace ( " /^> >/ " , " >> " , $body );
2024-06-30 09:53:56 +02:00
// Quote blank lines? YES by default
if ( ! isset ( $OVERRIDES [ 'quote_blank_lines' ]) || $OVERRIDES [ 'quote_blank_lines' ] == true ) {
if ( $body [ $i ][ 0 ] == '>' )
$bodyzeile .= " > " . $body [ $i ] . " \n " ;
else
$bodyzeile .= " > " . $body [ $i ] . " \n " ;
} else {
if ( trim ( $body [ $i ]) != " " ) {
if ( $body [ $i ][ 0 ] == '>' )
$bodyzeile .= " > " . $body [ $i ] . " \n " ;
else
$bodyzeile .= " > " . $body [ $i ] . " \n " ;
} else {
$bodyzeile .= " \n " ;
}
}
2023-08-20 00:33:05 +02:00
}
}
$subject = $head -> subject ;
2024-02-29 19:37:59 +01:00
// Offer choice of whether to use Followup-To
$has_followup = false ;
2023-08-20 00:33:05 +02:00
if ( isset ( $head -> followup ) && ( $head -> followup != " " )) {
$newsgroups = $head -> followup ;
2024-02-29 19:37:59 +01:00
$has_followup = $head -> newsgroups ;
2020-11-29 01:55:31 +01:00
} else {
2024-02-25 04:33:14 +01:00
$newsgroups = $head -> newsgroups ;
2020-11-29 01:55:31 +01:00
}
2023-08-20 00:33:05 +02:00
splitSubject ( $subject );
$subject = " Re: " . $subject ;
// Cut off old parts of a subject
// for example: 'foo (was: bar)' becomes 'foo'.
$subject = preg_replace ( '/(\(wa[sr]: .*\))$/i' , '' , $subject );
$show = 1 ;
$references = false ;
if ( isset ( $head -> references [ 0 ])) {
2024-09-07 15:03:57 +02:00
for ( $i = 0 ; $i <= count ( $head -> references ) - 1 ; $i ++ ) {
2023-08-20 00:33:05 +02:00
$references .= $head -> references [ $i ] . " " ;
}
2020-11-29 01:55:31 +01:00
}
2023-08-20 00:33:05 +02:00
$references .= $head -> id ;
2020-11-29 01:55:31 +01:00
}
2023-08-20 00:33:05 +02:00
if ( $type == " retry " ) {
$show = 1 ;
$bodyzeile = $body ;
2020-11-29 01:55:31 +01:00
}
2023-08-20 00:33:05 +02:00
if ( $show == 1 ) {
2020-11-29 01:55:31 +01:00
2023-08-20 00:33:05 +02:00
if ( $newsgroups == " " ) {
echo $text_post [ " followup_not_allowed " ];
echo " " . $newsgroups ;
} else {
2024-05-27 11:04:11 +02:00
// check that we can post to the newsgroup
$ngroups = preg_split ( " /[ \ s,]+/ " , $newsgroups );
$found = false ;
foreach ( $ngroups as $group ) {
2024-07-12 15:54:15 +02:00
$group = trim ( $group );
2024-06-05 13:32:38 +02:00
if ( get_section_by_group ( $group )) {
2024-05-27 11:04:11 +02:00
$found = true ;
break ;
}
}
2023-08-20 00:33:05 +02:00
// show post form
$fieldencrypt = md5 ( rand ( 1 , 10000000 ));
2024-09-08 13:05:45 +02:00
if ( $type == 'reply' ) {
echo '<h1 class="np_post_headline">' . $text_post [ " group_head_reply " ] . group_display_name ( $newsgroups ) . $text_post [ " group_tail " ];
} else {
echo '<h1 class="np_post_headline">' . $text_post [ " group_head " ] . group_display_name ( $newsgroups ) . $text_post [ " group_tail " ];
}
2024-06-05 13:32:38 +02:00
if ( ! $found ) {
2024-05-27 11:04:11 +02:00
echo ' (posting will fail - no such group)' ;
}
echo '</h1>' ;
2023-08-20 00:33:05 +02:00
if ( isset ( $error ))
echo " <p> $error </p> " ;
2024-01-07 23:52:50 +01:00
echo '<form action="' . $file_post . '" method="post" name="postform"' ;
echo 'enctype="multipart/form-data">' ;
echo '<div class="np_post_header">' ;
echo '<table><tr>' ;
echo '<td align="right"><b>' . $text_header [ " subject " ] . '</b></td>' ;
echo '<td><input class="post" type="text" ' ;
echo 'name="' . md5 ( $fieldencrypt . " subject " ) . '" ' ;
echo 'value="' . htmlspecialchars ( $subject ) . '" ' ;
echo 'size="40" maxlength="' . $thread_maxSubject . '"></td>' ;
echo '</tr><tr>' ;
2024-04-15 12:47:44 +02:00
if ( $has_followup ) {
2024-08-28 12:51:07 +02:00
echo '<td align="right"><b>Newsgroups: </b>' ;
2024-02-29 19:37:59 +01:00
echo '</td><td>' ;
2024-08-28 12:51:07 +02:00
echo '<input type="radio" id="hasfollowup" name="fgroups" value="' . $head -> followup . '" checked>' ;
echo ' ' ;
echo '<label for="followup">' . $head -> followup . ' (Followup-To is set' ;
2024-06-05 13:32:38 +02:00
if ( ! get_section_by_group ( $head -> followup )) {
2024-05-27 11:04:11 +02:00
echo ' but <b><i>posting will fail - no such group </i></b>' ;
}
echo ')</label></td>' ;
2024-02-29 19:37:59 +01:00
echo '</tr><tr>' ;
2024-08-28 12:51:07 +02:00
echo '<td align="right"><b>or: </b>' ;
2024-02-29 19:37:59 +01:00
echo '</td><td>' ;
2024-08-28 12:51:07 +02:00
echo '<input type="radio" id="nofollowup" name="fgroups" value="' . $head -> newsgroups . '">' ;
echo ' ' ;
2024-02-29 19:37:59 +01:00
echo '<label for="newsgroups">' . $head -> newsgroups . '</label>' ;
echo '</tr><tr>' ;
2024-07-12 15:54:15 +02:00
} else {
2024-09-07 15:03:57 +02:00
if ( ! isset ( $OVERRIDES [ 'disable_ngs_edit' ]) || $OVERRIDES [ 'disable_ngs_edit' ] == false ) {
2024-07-13 12:52:57 +02:00
echo '<td align="right"><b>Newsgroups:</b></td>' ;
echo '<td>' ;
2024-09-07 15:03:57 +02:00
if ( $allow_ngs_edit ) {
2024-08-28 12:51:07 +02:00
echo '<input tclass="post" type="text" name="fgroups" size="40" maxlength="240" value="' . $newsgroups . '">' ;
echo " (max $max_crosspost groups) " ;
echo '</td><td>' ;
2024-09-07 15:03:57 +02:00
echo '</tr><tr>' ;
2024-08-28 12:51:07 +02:00
echo '<td align="right"><b>Followup-To:</b></td>' ;
echo '<td>' ;
2024-09-07 16:41:19 +02:00
echo '<input tclass="post" type="text" name="followupto" size="40" value="' . $followupto . '" maxlength="80" placeholder="name of group to redirect replies">' ;
2024-08-28 12:51:07 +02:00
echo " (optional) " ;
2024-07-13 12:52:57 +02:00
} else {
echo '<input tclass="post" type="text" name="fgroups" size="40" value="' . $newsgroups . '" readonly>' ;
}
2024-07-12 15:54:15 +02:00
} else {
2024-07-13 12:52:57 +02:00
echo '<input tclass="post" type="hidden" name="fgroups" value="' . $newsgroups . '">' ;
2024-07-12 15:54:15 +02:00
}
echo '</td><td>' ;
echo '</tr><tr>' ;
2024-02-29 19:37:59 +01:00
}
2024-04-15 12:47:44 +02:00
2024-01-07 23:52:50 +01:00
echo '<td align="right"><b>' . $text_post [ " name " ] . '</b></td>' ;
echo '<td align="left">' ;
2023-08-20 00:33:05 +02:00
if ( ! isset ( $name ) && $CONFIG [ 'anonuser' ])
$name = $CONFIG [ 'anonusername' ];
2024-09-07 15:03:57 +02:00
echo '<input class="post" type="text" name="' . md5 ( $fieldencrypt . " name " ) . '"' ;
if ( isset ( $name ))
echo 'value="' . htmlspecialchars ( $name ) . '"' ;
if ( $logged_in && isset ( $name )) {
echo 'size="40" maxlength="40" readonly>' ;
file_put_contents ( $auth_log , " \n " . logging_prefix () . " AUTH SET for: " . $name , FILE_APPEND );
} else {
echo 'size="40" maxlength="40">' ;
file_put_contents ( $auth_log , " \n " . logging_prefix () . " AUTH NOT SET for: " . $name , FILE_APPEND );
}
if ( $CONFIG [ 'anonuser' ])
echo ' or "' . $CONFIG [ 'anonusername' ] . '" with no password' ;
2024-01-07 23:52:50 +01:00
echo '</td></tr><tr>' ;
2024-02-19 19:39:22 +01:00
echo '<td align="right"><b>' . $text_post [ " password " ] . '</b></td>' ;
2024-01-07 23:52:50 +01:00
echo '<td align="left">' ;
2023-12-23 16:57:12 +01:00
2024-07-15 00:32:02 +02:00
if ( $logged_in && isset ( $name )) {
2023-12-23 16:57:12 +01:00
echo '<input class="post" type="password" name="' . md5 ( $fieldencrypt . " email " ) . '"value="**********"' ;
echo 'size="40" maxlength="40" readonly>' ;
} else {
echo '<input class="post" type="password" name="' . md5 ( $fieldencrypt . " email " ) . '"' ;
echo 'size="40" maxlength="40">' ;
}
2024-02-20 00:33:44 +01:00
// Check for custom name/email from user configuration
if ( $OVERRIDES [ 'disable_change_name' ] != true ) {
$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>' ;
}
2024-02-19 19:39:22 +01:00
}
}
echo '<input class="post" type="hidden" name="fromname" value="' . $fromname . '">' ;
2024-01-07 23:52:50 +01:00
echo '</td></tr>' ;
2023-08-20 00:33:05 +02:00
// May we post encrypted messages to this group?
if ( check_encryption_groups ( $newsgroups )) {
2024-01-07 23:52:50 +01:00
echo '<tr>' ;
echo '<td align="left"><input type="checkbox" name="encryptthis"' ;
echo 'value="encrypt"> <b>Encrypt to:</b></td>' ;
2024-02-19 19:39:22 +01:00
echo '<td><input type="text" name="encryptto" value="' . $fromname . '"></td>' ;
2024-01-07 23:52:50 +01:00
echo '</tr>' ;
2023-08-20 00:33:05 +02:00
}
2024-01-07 23:52:50 +01:00
echo '</table></div>' ;
echo '<div class="np_post_body">' ;
echo '<table><tr>' ;
2024-09-19 14:19:26 +02:00
echo '<td><b>' . $text_post [ " message " ] . '</b>' ;
echo ' <font size="2em">(Lines will wrap at ' . $wrap_width . ' characters after posting)</font>' ;
echo '<br> <textarea cols="' . $wrap_width . '"' ;
echo 'class="postbody" id="postbody" cols="72"' ;
2024-01-07 23:52:50 +01:00
echo 'name="' . md5 ( $fieldencrypt . " body " ) . '" wrap="soft">' ;
2024-05-22 14:09:05 +02:00
$bodyzeile = wrap_post ( $bodyzeile );
2023-08-20 00:33:05 +02:00
if (( isset ( $bodyzeile )) && ( $post_autoquote ))
2024-06-26 08:26:32 +02:00
echo htmlspecialchars ( rtrim ( $bodyzeile ) . " \n " );
2023-08-20 00:33:05 +02:00
if ( is_string ( $body ))
2024-06-26 08:26:32 +02:00
echo htmlspecialchars ( rtrim ( $body ) . " \n " );
2024-01-07 23:52:50 +01:00
echo '</textarea></td></tr><tr><td>' ;
if ( ! $post_autoquote ) {
echo '<input type="hidden" id="hidebody"' ;
echo 'value="' ;
2024-05-22 14:09:05 +02:00
if ( isset ( $bodyzeile )) {
2024-06-26 08:26:32 +02:00
echo htmlspecialchars ( rtrim ( $bodyzeile ) . " \n " );
2024-05-22 14:09:05 +02:00
}
2024-01-07 23:52:50 +01:00
echo '">' ;
2024-02-19 19:39:22 +01:00
2024-09-07 15:03:57 +02:00
?>
< script language = " JavaScript " >
<!--
function quoten () {
document . getElementById ( " postbody " ) . value = document . getElementById ( " hidebody " ) . value ;
document . getElementById ( " hidebody " ) . value = " " ;
}
//
-->
</ script >
2020-11-29 01:55:31 +01:00
2024-09-07 15:03:57 +02:00
< ? php } ?>
2020-11-29 01:55:31 +01:00
2024-09-07 15:03:57 +02:00
< input type = " submit " value = " <?php echo $text_post["button_post"] ; ?> " >
< ? php if ( $setcookies == true ) { ?>
& nbsp ;
< input tabindex = " 100 " type = " Button " name = " quote "
value = " <?php echo $text_post["quote"] ?> "
onclick = " quoten(); this.style.visibility= 'hidden'; " >
& nbsp ;
2024-03-05 00:25:42 +01:00
2024-09-07 15:03:57 +02:00
< ? php
2024-04-15 12:47:44 +02:00
}
2024-04-18 12:33:36 +02:00
if ( ! isset ( $OVERRIDES [ 'disable_attach' ])) {
$OVERRIDES [ 'disable_attach' ] = array ();
}
if ( ! in_array ( $config_name , $OVERRIDES [ 'disable_attach' ])) {
2024-04-15 12:47:44 +02:00
echo ' ' ;
echo '<input type="file" name="photo" id="fileSelect" value="fileSelect" accept="image/*,audio/*,text/*,application/pdf">' ;
echo '</td></tr>' ;
}
2023-09-09 14:52:18 +02:00
if ( $post_captcha ) {
2023-08-20 00:33:05 +02:00
echo '<tr><td>' ;
echo captcha :: form ( $text_post [ " captchainfo1 " ], $text_post [ " captchainfo2 " ]);
echo '</td></tr>' ;
}
?>
2024-01-07 23:52:50 +01:00
2024-09-07 15:03:57 +02:00
</ table >
</ div >
< input type = " hidden " name = " type " value = " post " >
< input type = " hidden " name = " newsgroups "
value = " <?php echo htmlspecialchars( $newsgroups ); ?> " >
< input type = " hidden " name = " references "
value = " <?php echo htmlentities( $references ); ?> " >
< input type = " hidden " name = " group "
value = " <?php echo htmlspecialchars( $newsgroups ); ?> " >
< input type = " hidden " name = " returngroup "
value = " <?php echo htmlspecialchars( $thisgroup ); ?> " >
< input type = " hidden " name = " fielddecrypt "
value = " <?php echo htmlspecialchars( $fieldencrypt ); ?> " >
</ form >
< ? php }
} ?>