Apache-NNTPGateway
view release on metacpan or search on metacpan
NNTPGateway.pm view on Meta::CPAN
&print_html_head( $r, $no_cache, &message( 'inv_id', $id ));
&print_html_menu( $r );
&print_html_error( $r, &message( 'inv_id', $id ));
}
# Print menu
&print_html_menu( $r );
# Print html footer
&print_html_foot( $r );
return;
} # end action_read();
### Sub action_followup() ###
# &action_followup( request [, id] ):
# - Description: Post a followup to an article
# - Arguments : The Apache request, article id to followup
###
sub action_followup ( $\$ ) {
my ($r, $id) = @_;
# Print html header
&print_html_head( $r );
# Print menu
&print_html_menu( $r );
$r->print( "\n<hr noshade>\n" );
# Get article Id to followup.
my $args = $Args->{action_args};
if ( $args && @$args ) {
# id of article to read
$id ||= $args->[0];
} elsif ( $id ) {
;
} else {
&print_html_error( $r, &message( 'no_ref' ));
# Print menu
$r->print( "\n<hr noshade>\n" );
&print_html_menu( $r );
# Print html footer
&print_html_foot( $r );
return;
}
# Get the article to followup.
my $Article = &nntp_get_article( $id, 0 );
if ( $Article ) {
# Prepare new subject
my $subject = $Article->{Header}{subject};
$subject = "Re: $subject" unless $subject =~ /^re\s*:/i;
# Add references
my $refs = $Article->{Header}{references};
my $msgid = $Article->{Header}{'message-id'};
$refs .= $msgid;
# Quote body
my $body = "\n " . &message( 'msg_cite', $msgid, $Article->{Header}{from} ) . ":\n\n";
$Article->{Body} =~ s/^\s*(.*)$/ > $1/gm;
$body .= $Article->{Body} . "\n\n";
# Print a form for user to edit fields and post.
&print_html_post_form( $r, $subject, $body, $refs );
# The remaining, that is the real NNTP posting is handled by
# action_post() which is called from a submit (POST method) with
# the form with the right arguments.
} else {
# invalid article id
&print_html_error( $r, &message( 'inv_id', $id ));
}
# Print menu
$r->print( "\n<hr noshade>\n" );
&print_html_menu( $r );
# Print html footer
&print_html_foot( $r );
return;
} # end action_followup();
### Sub action_post() ###
# &action_post( request ):
# - Description: Post an article
# - Arguments : The Apache request
###
sub action_post ( $ ) {
my ($r) = @_;
# Print html header
&print_html_head( $r );
# Print menu
&print_html_menu( $r );
$r->print( "\n<hr noshade>\n" );
# Check if nntp server allow us to post.
unless ( $NNTP->postok()) {
&print_html_error( $r, &message( 'no_post_ok' ));
# Print menu
$r->print( "\n<hr noshade>\n" );
&print_html_menu( $r );
# Print html footer
&print_html_foot( $r );
return;
}
if ( $r->method() eq 'POST' ) {
# This part is called when user submit the form that had been
# shown him within an action_post() but with a GET method. NNTP
# Post the article from here.
my $from = $Args->{from};
my $subject = $Args->{subject};
my $body = $Args->{body};
my $refs = $Args->{refs};
# Jie's modification for WASM authentication check.
# unless (defined $from && $from eq $ENV{'USER_NAME'}) {
# &print_html_error( $r, &message( 'You are only allowed to post as yourself.' ));
# &print_html_post_form( $r, $subject, $body );
( run in 1.057 second using v1.01-cache-2.11-cpan-524268b4103 )