/[debian]/nanobloggertrackback/branches/upstream/current/tb.cgi
ViewVC logotype

Diff of /nanobloggertrackback/branches/upstream/current/tb.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 282 by gregoa, Sat Apr 29 15:00:27 2006 UTC revision 283 by gregoa, Thu May 25 22:04:00 2006 UTC
# Line 2  Line 2 
2  # Copyright 2002 Benjamin Trott.  # Copyright 2002 Benjamin Trott.
3  # This code is released under the Artistic License.  # This code is released under the Artistic License.
4  #  #
5  # Original: http://www.movabletype.org/downloads/tb-standalone.tar.gz  # Changes:
6  # Docs: http://www.sixapart.com/movabletype/docs/tb-standalone  # Copyright gregor herrmann <gregor+debian@comodo.priv.at> 2005, 2006
7  #  # GPL 2 or later
 # Changed by gregor herrmann <gregor+debian@comodo.priv.at>, 2005, 2006  
8    
9  use strict;  use strict;
10  use warnings;  use warnings;
# Line 18  my $Footer = "BLOGDIR/tb/footer.txt"; Line 17  my $Footer = "BLOGDIR/tb/footer.txt";
17  my $Password = "PASSWORD";    my $Password = "PASSWORD";  
18  my $MailNotify = 'EMAIL';  my $MailNotify = 'EMAIL';
19  my $NBDataDir = "BLOGDIR/data";  my $NBDataDir = "BLOGDIR/data";
20    my $BLOGURL = "BLOGURL";
21    
22  use vars qw( $VERSION );  use vars qw( $VERSION );
23  $VERSION = '1.02';  $VERSION = '1.02-gh01';
24    
25  use CGI qw( :standard );  use CGI qw( :standard );
26  use File::Spec::Functions;  use File::Spec::Functions;
# Line 36  unless ($mode) { Line 36  unless ($mode) {
36      respond_exit("No URL (url)") unless $i->{url};      respond_exit("No URL (url)") unless $i->{url};
37      # require excerpt, even if not in TB specification, against spam      # require excerpt, even if not in TB specification, against spam
38      respond_exit("No excerpt") unless $i->{excerpt};      respond_exit("No excerpt") unless $i->{excerpt};
39        # let's look if our $BlogURL is in the submitted trackback URL
40        respond_exit("Blog URL not in trackback URL") unless blog_in_url($i->{url});
41      my $data = load_data($tb_id);      my $data = load_data($tb_id);
42      unshift @$data, $i;      unshift @$data, $i;
43      store_data($tb_id, $data);      store_data($tb_id, $data);
# Line 56  $me?__mode=list&tb_id=$tb_id Line 58  $me?__mode=list&tb_id=$tb_id
58  EOF  EOF
59      close(SENDMAIL)     or warn "sendmail didn't close nicely";      close(SENDMAIL)     or warn "sendmail didn't close nicely";
60      respond_exit();      respond_exit();
61    
62  } elsif ($mode eq 'list') {  } elsif ($mode eq 'list') {
63      my $tb_id = munge_tb_id(get_tb_id());      my $tb_id = munge_tb_id(get_tb_id());
64      die("No TrackBack ID (tb_id)") unless $tb_id;      die("No TrackBack ID (tb_id)") unless $tb_id;
# Line 314  sub from_file { Line 317  sub from_file {
317      $c;      $c;
318  }  }
319    
320    sub blog_in_url {
321        my $urlfound = '';
322        my $url = $_[0];
323        require LWP::UserAgent;
324        my $ua = LWP::UserAgent->new;
325        $ua->agent("TrackBack/$VERSION");
326        my $request = HTTP::Request->new(GET => $url);
327        my $response = $ua->request($request);
328        if ($response->is_success) {
329            $urlfound =  (grep(/$BlogURL/, $response->content) ? '1' : '');
330        }
331        return $urlfound;
332    }
333    
334    
335  __END__  __END__
336    
337  =head1 NAME  =head1 NAME

Legend:
Removed from v.282  
changed lines
  Added in v.283

  ViewVC Help
Powered by ViewVC 1.1.26