«
<p>
# Copyright 2001-2004 Six Apart. This code cannot be redistributed without<br /> # permission from www.movabletype.org.<br /> #<br /> # $Id: mt-comments.cgi,v 1.35 2004/05/17 19:51:25 ezra Exp $<br /> use strict;
</p>
<p>
use CGI;<br /> my $cgi = new CGI;<br /> my $commentText = $cgi->param(‘text’);
</p>
<p>
if ($commentText =~ m/http:/i)<br /> {<br /> print “Content-Type: text/html;\n”;<br /> print “Status: 404 Not Found\n”;<br /> print “\n”;<br /> }<br /> else<br /> {<br /> my($MT_DIR);<br /> BEGIN {<br /> if ($0 =~ m!(.*[/\\])!) {<br /> $MT_DIR = $1;<br /> } else {<br /> $MT_DIR = ‘./’;<br /> }<br /> unshift @INC, $MT_DIR . ‘lib’;<br /> unshift @INC, $MT_DIR . ‘extlib’;<br /> }
</p>
<p>
eval {<br /> require MT::App::Comments;<br /> my $app = MT::App::Comments->new( Config => $MT_DIR . ‘mt.cfg’,<br /> Directory => $MT_DIR )<br /> or die MT::App::Comments->errstr;<br /> local $SIG{__WARN__} = sub { $app->trace($_[0]) };<br /> $app->run;<br /> };<br /> if ($@) {<br /> print “Content-Type: text/html\n\n”;<br /> print “An error occurred: $@”;<br /> }<br /> }
</p></blockquote></div>