ZofCMS/Plugin/Comments.pm

filter: Statementstmt 13.6% 23 / 168 Branchbran 0.0% 0 / 58 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 15 Subroutinesub 31.8% 7 / 22 Podpod 0.0% 0 / 2 totaltotal 10.3% 30 / 289 CC 41 SCAR 47.4
CC
41
Cov
9%
process
240.0
_is_valid_form
210.0
_moderate_comment
42.0
CRAP 114.8
« ZofCMS/Plugin/Debug/Validator/HTML.pm ↑ Summary ZofCMS/Template.pm »
1 package App::ZofCMS::Plugin::Comments;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '1.001010'; # VERSION
7  
8 1 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use HTML::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use HTML::Entities;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Storable (qw/lock_store lock_retrieve/);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 0 ▶sub new { return bless {}, shift }
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
15  
16 0 ▶sub process {
Subroutine process: not called CC=15 SCAR=54.8
Pod undocumented
17 0 my ( $self, $template, $query, $config ) = @_;
18  
19 my $plug_conf = {
20 0 ▶ %{ $config->conf->{comments_plugin} || {} },
Condition0%0/2
$config->conf->{'comments_plugin'} || {}
l!l
00
MC/DC0%0/1
$config->conf->{'comments_plugin'} || {}
$config->conf->{'comments_plugin'}
Truth table0%0/2
A
A= $config->conf->{'comments_plugin'}
Aresult
11
00
21 0 ▶ %{ delete $template->{comments_plugin} || {} },
Condition0%0/2
delete $template->{'comments_plugin'} || {}
l!l
00
MC/DC0%0/1
delete $template->{'comments_plugin'} || {}
delete $template->{'comments_plugin'}
Truth table0%0/2
A
A= delete $template->{'comments_plugin'}
Aresult
11
00
22 };
23  
24 return
25 0 ▶ unless keys %$plug_conf;
Branch: 1 branch
BranchTrueFalseTotal
unless keys %$plug_conf 0 0 0
26  
27 return
28 0 ▶ unless $plug_conf->{dsn};
Branch: 1 branch
BranchTrueFalseTotal
unless $plug_conf->{"dsn"} 0 0 0
29  
30 0 ▶ my %no_pages = map { $_ => 1 } @{ $plug_conf->{no_pages} || [] };
Condition0%0/2
$plug_conf->{'no_pages'} || []
l!l
00
MC/DC0%0/1
$plug_conf->{'no_pages'} || []
$plug_conf->{'no_pages'}
Truth table0%0/2
A
A= $plug_conf->{'no_pages'}
Aresult
11
00
31  
32 return
33 0 ▶ if exists $no_pages{ $query->{dir} . $query->{page} };
Branch: 1 branch
BranchTrueFalseTotal
if exists $no_pages{$query->{"dir"} . $query->{"page"}} 0 0 0
34  
35 return
36 if $plug_conf->{page} eq $query->{dir} . $query->{page}
37 0 ▶ and not exists $query->{zofcms_comments_page};
Branch: 1 branch
BranchTrueFalseTotal
if $plug_conf->{"page"} eq $query->{"dir"} . $query->{"page"} and not exists $query->{"zofcms_comments_page"} 0 0 0
Condition0%0/3
$plug_conf->{"page"} eq $query->{"dir"} . $query->{"page"} and not exists $query->{"zofcms_comments_page"}
!ll&&!rl&&r
000
MC/DC0%0/2
$plug_conf->{"page"} eq $query->{"dir"} . $query->{"page"} and not exists $query->{"zofcms_comments_page"}
$plug_conf->{"page"} eq $query->{"dir"} . $query->{"page"} not exists $query->{"zofcms_comments_page"}
Truth table0%0/3
A and not(B)
A= $plug_conf->{"page"} eq $query->{"dir"} . $query->{"page"}B= not exists $query->{"zofcms_comments_page"}
ABresult
0X0
100
111
38  
39 $plug_conf->{comments_page} = exists $query->{zofcms_comments_page}
40 ? $query->{zofcms_comments_page}
41 0 ▶ : $query->{dir} . $query->{page};
Branch: 1 branch
BranchTrueFalseTotal
exists $query->{'zofcms_comments_page'} ? : 0 0 0
42  
43 0 $plug_conf = $self->_fill_defaults( $plug_conf );
44 0 $plug_conf->{remote_host} = $config->cgi->remote_host();
45  
46 my $dbh = DBI->connect_cached(
47 0 ▶ @$plug_conf{ qw/dsn user pass opts/ }
Branch: 1 branch
BranchTrueFalseTotal
my $dbh = "DBI"->connect_cached(@$plug_conf{"dsn", "user", "pass", "opts"}) or die "Failed to connect" 0 0 0
48 ) or die "Failed to connect";
49  
50 0 ▶ if ( $query->{zofcms_comments_approve}
Branch: 1 branch
BranchTrueFalseTotal
if ($query->{"zofcms_comments_approve"} or $query->{"zofcms_comments_deny"}) 0 0 0
Condition0%0/3
$query->{"zofcms_comments_approve"} or $query->{"zofcms_comments_deny"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$query->{"zofcms_comments_approve"} or $query->{"zofcms_comments_deny"}
$query->{"zofcms_comments_approve"} $query->{"zofcms_comments_deny"}
Truth table0%0/3
A or B
A= $query->{"zofcms_comments_approve"}B= $query->{"zofcms_comments_deny"}
ABresult
1X1
011
000
51 or $query->{zofcms_comments_deny} ) {
52 0 $self->_moderate_comment( $dbh, $plug_conf, $query );
53 }
54  
55 my $html_template = $self->_prepare_html_template(
56 $plug_conf->{comments_page},
57 $plug_conf->{page},
58 0 $query,
59 );
60  
61 0 ▶ if ( defined $query->{zofcms_comments_username}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $query->{"zofcms_comments_username"} and $query->{"zofcms_comments_username"} eq "your user name") 0 0 0
Condition0%0/3
defined $query->{"zofcms_comments_username"} and $query->{"zofcms_comments_username"} eq "your user name"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $query->{"zofcms_comments_username"} and $query->{"zofcms_comments_username"} eq "your user name"
defined $query->{"zofcms_comments_username"} $query->{"zofcms_comments_username"} eq "your user name"
Truth table0%0/3
A and B
A= defined $query->{"zofcms_comments_username"}B= $query->{"zofcms_comments_username"} eq "your user name"
ABresult
0X0
100
111
62 and $query->{zofcms_comments_username} eq 'your user name'
63 ) {
64 0 $self->_enter_comment( $dbh, $plug_conf, $html_template, $query );
65 }
66  
67 0 @{ $template->{t} }{ qw/zofcms_comments zofcms_comments_form/ }
68 = (
69 $self->_fetch_comments( $dbh, $plug_conf, $query ),
70 $html_template->output,
71 );
72  
73 0 eval {
74 0 $dbh->commit;
75 0 $dbh->disconnect;
76 };
77  
78 0 return 1;
79 }
80  
81 0 ▶sub _moderate_comment {
Subroutine _moderate_comment: not called CC=6 SCAR=37.4
82 0 my ( $self, $dbh, $plug_conf, $query ) = @_;
83  
84 return
85 0 ▶ unless exists $query->{zofcms_comment_id};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $query->{"zofcms_comment_id"} 0 0 0
86  
87 my $comments = $dbh->selectall_arrayref(
88 "SELECT * FROM $plug_conf->{mod_table} WHERE id = ?;",
89 undef,
90 $query->{zofcms_comment_id}
91 0 );
92  
93 0 ▶ unless ( @$comments ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@$comments) 0 0 0
94 0 $self->_print_moderation("No such comment found");
95 }
96  
97 0 ▶ if ( exists $query->{zofcms_comments_approve} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $query->{"zofcms_comments_approve"}) 0 0 0
98 $dbh->do(
99 "INSERT INTO $plug_conf->{table} VALUES(?, ?, ?, ?, ?, ?);",
100 undef,
101 0 @{ shift @$comments },
102 );
103 }
104  
105 0 ▶ if ( $plug_conf->{mod_out_time} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plug_conf->{"mod_out_time"}) 0 0 0
106 $dbh->do(
107 "DELETE FROM $plug_conf->{mod_table} WHERE time < ?;",
108 undef,
109 time() - $plug_conf->{mod_out_time},
110 0 );
111 }
112  
113 $dbh->do(
114 "DELETE FROM $plug_conf->{mod_table} WHERE id = ?;",
115 undef,
116 $query->{zofcms_comment_id},
117 0 );
118  
119 $self->_print_moderation("Comment was successfuly denied")
120 0 ▶ if exists $query->{zofcms_comments_deny};
Branch: 1 branch
BranchTrueFalseTotal
if exists $query->{"zofcms_comments_deny"} 0 0 0
121  
122 0 $self->_print_moderation("Comment was successfuly approved");
123 }
124  
125 0 ▶sub _print_moderation {
Subroutine _print_moderation: not called CC=1 SCAR=6.9
126 0 my ( $self, $message ) = @_;
127 0 print "Content-type: text/plain\n\n";
128 0 print "$message\n";
129 0 exit;
130 }
131  
132 0 ▶sub _fetch_comments {
Subroutine _fetch_comments: not called CC=2 SCAR=17.9
133 0 my ( $self, $dbh, $plug_conf, $query ) = @_;
134 my $data = $dbh->selectall_arrayref(
135 "SELECT * FROM $plug_conf->{table} WHERE page = ?;",
136 undef,
137 $query->{dir} . $query->{page},
138 0 );
139  
140 0 my $comment_number = 0;
141 0 @$data = sort { $b->[5] <=> $a->[5] }
142 map {
143 0 push @$_, $comment_number++; $_
144 } @$data;
145  
146 0 ▶ if ( $plug_conf->{sort} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plug_conf->{"sort"}) 0 0 0
147 0 @$data = reverse @$data;
148 }
149  
150 my @comments_loop = map +{
151 name => $_->[0],
152 date => scalar(localtime($_->[5])),
153 0 comment => do { my $x = encode_entities($_->[2]); $x =~ s/\n/<br>/g; $x },
154 comment_number => $_->[-1],
155 }, @$data;
156  
157 0 my $html_template = HTML::Template->new_scalar_ref(
158 \ $self->_comments_template
159 );
160  
161 0 $html_template->param( comments => \@comments_loop );
162  
163 0 return $html_template->output;
164 }
165  
166 0 ▶sub _enter_comment {
Subroutine _enter_comment: not called CC=6 SCAR=37.4
167 0 my ( $self, $dbh, $plug_conf, $html_template, $query ) = @_;
168  
169 return
170 0 ▶ unless $self->_is_valid_form( $plug_conf, $html_template, $query );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_valid_form($plug_conf, $html_template, $query) 0 0 0
171  
172 #'CREATE TABLE comments (name VARCHAR(100), email VARCHAR(200), comment TEXT, page VARCHAR(100), remote_host TEXT, time VARCHAR(11));';
173  
174 0 ▶ if ( $plug_conf->{flood_num} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plug_conf->{"flood_num"}) 0 0 0
175 my $user_comments = $dbh->selectall_arrayref(
176 "SELECT * FROM $plug_conf->{table} WHERE remote_host = ? AND time > ?;",
177 undef,
178 $plug_conf->{remote_host},
179 time() - $plug_conf->{flood_time},
180 0 );
181 0 ▶ if ( @$user_comments >= $plug_conf->{flood_num} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$user_comments >= $plug_conf->{"flood_num"}) 0 0 0
182 0 $html_template->param(
183 success => 0,
184 error => 'Sorry, but due to abuse the number of posts'
185 . ' is limited. Please try again shortly'
186 );
187 0 return;
188 }
189 }
190  
191 my @dbi_insert_args = (
192 @$query{ qw/
193 zofcms_comments_name
194 zofcms_comments_email
195 zofcms_comments_comment
196 /
197 },
198 $plug_conf->{comments_page},
199 $plug_conf->{remote_host},
200 0 time(),
201 );
202  
203 0 ▶ if ( $plug_conf->{moderate} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plug_conf->{'moderate'}) { } 0 0 0
204 0 my $mod_id = rand() . time() . rand();
205 0 $dbh->do(
206 "INSERT INTO $plug_conf->{mod_table} VALUES(?, ?, ?, ?, ?, ?, ?);",
207 undef,
208 @dbi_insert_args,
209 $mod_id,
210 );
211  
212 0 $self->_send_mod_email( $plug_conf, @dbi_insert_args, $mod_id );
213 }
214 else {
215 0 my $r = $dbh->do(
216 "INSERT INTO $plug_conf->{table} VALUES(?, ?, ?, ?, ?, ?);",
217 undef,
218 @dbi_insert_args,
219 );
220 $self->_send_comment_entered_email( $plug_conf, @dbi_insert_args )
221 0 ▶ if $plug_conf->{send_entered};
Branch: 1 branch
BranchTrueFalseTotal
if $plug_conf->{"send_entered"} 0 0 0
222 }
223 }
224  
225 0 ▶sub _send_mod_email {
Subroutine _send_mod_email: not called CC=1 SCAR=6.9
226 0 my ( $self, $plug_conf, @data ) = @_;
227  
228 0 my %data;
229 0 @data{ qw/name email comment page host time id/ } = @data;
230  
231 0 my $approve_uri = URI->new( $plug_conf->{uri} );
232  
233 0 my @query = $approve_uri->query_form;
234 0 push @query, zofcms_comment_id => $data{id};
235  
236 0 my $deny_uri = $approve_uri->clone;
237 0 $approve_uri->query_form( @query, zofcms_comments_approve => 1 );
238 0 $deny_uri->query_form( @query, zofcms_comments_deny => 1 );
239  
240 0 my $body_template = HTML::Template->new_scalar_ref(
241 \ $self->_get_mail_template
242 );
243  
244 $body_template->param(
245 mod => 1,
246 approve => $approve_uri->as_string,
247 deny => $deny_uri->as_string,
248 time => scalar(localtime $data{time}),
249 0 map +( $_ => $data{ $_ } ),
250 qw/page host email name comment/,
251 );
252  
253 0 $self->_send_mail( $plug_conf, $body_template->output );
254 }
255  
256 0 ▶sub _send_comment_entered_email {
Subroutine _send_comment_entered_email: not called CC=1 SCAR=6.9
257 0 my ( $self, $plug_conf, @data ) = @_;
258  
259 0 my %data;
260 0 @data{ qw/name email comment page host time/ } = @data;
261  
262  
263 0 my $body_template = HTML::Template->new_scalar_ref(
264 \ $self->_get_mail_template
265 );
266  
267 0 $data{time} = localtime $data{time};
268 0 $body_template->param( %data );
269  
270 0 $self->_send_mail( $plug_conf, $body_template->output );
271  
272 0 return;
273 }
274  
275 0 ▶sub _send_mail {
Subroutine _send_mail: not called CC=3 SCAR=24.8
276 0 my ( $self, $plug_conf, $body ) = @_;
277 0 require Mail::Send;
278  
279 0 my $email = Mail::Send->new;
280 0 $email->subject( $plug_conf->{subject} );
281  
282 my $to = ref $plug_conf->{email_to}
283 ? $plug_conf->{email_to}
284 0 ▶ : [ $plug_conf->{email_to} ];
Branch: 1 branch
BranchTrueFalseTotal
ref $plug_conf->{'email_to'} ? : 0 0 0
285  
286 0 $email->to( @$to );
287  
288 0 my $fh;
289 0 ▶ if ( $plug_conf->{mailer} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plug_conf->{'mailer'}) { } 0 0 0
290 0 $Mail::Mailer::testfile::config{outfile} = 'mailer.testfile';
291 0 $fh = $email->open( $plug_conf->{mailer} );
292 }
293 else {
294 0 $fh = $email->open;
295 }
296  
297 0 print $fh $body;
298 0 $fh->close;
299  
300 0 return;
301 }
302  
303 0 ▶sub _is_valid_form {
Subroutine _is_valid_form: not called CC=14 SCAR=53.5
304 0 my ( $self, $plug_conf, $html_template, $query ) = @_;
305  
306 0 my @form_fields = qw/
307 zofcms_comments_name
308 zofcms_comments_email
309 zofcms_comments_comment
310 /;
311  
312 0 for ( @form_fields ) {
313 $query->{$_} = ''
314 0 ▶ unless defined $query->{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $query->{$_} 0 0 0
315 }
316  
317 0 my ( $name, $email, $comment ) = @$query{ @form_fields };
318  
319 0 ▶ if ( $plug_conf->{must_name} and not length $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plug_conf->{"must_name"} and not length $name) 0 0 0
Condition0%0/3
$plug_conf->{"must_name"} and not length $name
!ll&&!rl&&r
000
MC/DC0%0/2
$plug_conf->{"must_name"} and not length $name
$plug_conf->{"must_name"} not length $name
Truth table0%0/3
A and not(B)
A= $plug_conf->{"must_name"}B= not length $name
ABresult
0X0
100
111
320 0 $html_template->param( error => 'Missing <em>Name</em> field' );
321 0 return;
322 }
323  
324 0 ▶ if ( $plug_conf->{must_email} and not length $email ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plug_conf->{"must_email"} and not length $email) 0 0 0
Condition0%0/3
$plug_conf->{"must_email"} and not length $email
!ll&&!rl&&r
000
MC/DC0%0/2
$plug_conf->{"must_email"} and not length $email
$plug_conf->{"must_email"} not length $email
Truth table0%0/3
A and not(B)
A= $plug_conf->{"must_email"}B= not length $email
ABresult
0X0
100
111
325 0 $html_template->param( error => 'Missing <em>E-mail</em> field' );
326 0 return;
327 }
328  
329 0 ▶ if ( $plug_conf->{must_comment} and not length $comment ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plug_conf->{"must_comment"} and not length $comment) 0 0 0
Condition0%0/3
$plug_conf->{"must_comment"} and not length $comment
!ll&&!rl&&r
000
MC/DC0%0/2
$plug_conf->{"must_comment"} and not length $comment
$plug_conf->{"must_comment"} not length $comment
Truth table0%0/3
A and not(B)
A= $plug_conf->{"must_comment"}B= not length $comment
ABresult
0X0
100
111
330 0 $html_template->param( error => 'Missing <em>Comment</em> field' );
331 0 return;
332 }
333  
334 0 ▶ if ( length( $name ) > $plug_conf->{name_max} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $name > $plug_conf->{"name_max"}) 0 0 0
335 $html_template->param(
336 error => 'Parameter <em>Name</em> cannot exceed '
337 0 . $plug_conf->{name_max} . ' characters in length'
338 );
339 0 return;
340 }
341  
342 0 ▶ if ( length( $email ) > $plug_conf->{email_max} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $email > $plug_conf->{"email_max"}) 0 0 0
343 $html_template->param(
344 error => 'Parameter <em>E-mail</em> cannot exceed '
345 0 . $plug_conf->{email_max} . ' characters in length'
346 );
347 0 return;
348 }
349  
350 0 ▶ if ( length( $comment ) > $plug_conf->{comment_max} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $comment > $plug_conf->{"comment_max"}) 0 0 0
351 $html_template->param(
352 error => 'Parameter <em>Comment</em> cannot exceed '
353 0 . $plug_conf->{comment_max} . ' characters in length'
354 );
355 0 return;
356 }
357  
358 0 for ( $name, $email, $comment ) {
359 0 ▶ $_ = 'N/A'
Branch: 1 branch
BranchTrueFalseTotal
unless length $_ 0 0 0
360 unless length;
361 }
362  
363 0 $html_template->param( success => 1 );
364  
365 0 @$query{ @form_fields } = ( $name, $email, $comment );
366  
367 0 return 1;
368 }
369  
370 0 ▶sub _prepare_html_template {
Subroutine _prepare_html_template: not called CC=1 SCAR=6.9
371 0 my ( $self, $comments_page, $page, $query ) = @_;
372 0 my $html_template = HTML::Template->new_scalar_ref(
373 \ $self->_form_template
374 );
375  
376 $html_template->param(
377 name => $query->{zofcms_comments_name},
378 email => $query->{zofcms_comments_email},
379 comment => $query->{zofcms_comments_comment},
380 page => $page,
381 comments_page => $comments_page,
382 back_to_comments_page => $query->{zofcms_comments_page},
383 0 );
384  
385 0 return $html_template;
386 }
387  
388 0 ▶sub _fill_defaults {
Subroutine _fill_defaults: not called CC=1 SCAR=6.9
389 0 my ( $self, $plug_conf ) = @_;
390 0 $plug_conf = {
391 'sort' => 0,
392 table => 'comments',
393 mod_table => 'mod_comments',
394 page => '/comments',
395 must_name => 0,
396 must_email => 0,
397 must_comment => 1,
398 name_max => 100,
399 email_max => 200,
400 comment_max => 10000,
401 moderate => 1,
402 send_entered => 1,
403 subject => 'ZofCMS Comments',
404 flood_num => 2,
405 flood_time => 180,
406 mod_out_time => 1209600,
407 opts => { RaiseError => 1, AutoCommit => 1 },
408  
409 %$plug_conf,
410 };
411 }
412  
413 0 ▶sub _comments_template {
Subroutine _comments_template: not called CC=1 SCAR=6.9
414 0 return <<'END_TEMPLATE';
415 <ul class="zofcms_comments">
416 <tmpl_loop name="comments">
417 <li id="zofcms_comment_<tmpl_var name="comment_number">">
418 <p class="zofcms_comments_name"><a href="#zofcms_comment_<tmpl_var name="comment_number">"><tmpl_var escape="html" name="name"></a></p>
419 <p class="zofcms_comments_date"><tmpl_var escape="html" name="date"></p>
420 <p class="zofcms_comments_comment"><tmpl_var name="comment"></p>
421 </li>
422 </tmpl_loop>
423 </ul>
424 END_TEMPLATE
425 }
426  
427 0 ▶sub _form_template {
Subroutine _form_template: not called CC=1 SCAR=6.9
428 0 return <<'END_TEMPLATE';
429 <tmpl_if name="success"><p class="success">Your comment was successfuly added.</p>
430 <p>Feel free to go back to the <a href="/index.pl?page=<tmpl_var name="back_to_comments_page" escape="html">">original page</a>.</p>
431 <tmpl_else>
432 <tmpl_if name="error"><p class="error"><tmpl_var name="error"></p></tmpl_if>
433 <form class="zofcms_comments" action="" method="POST">
434 <fieldset>
435 <legend>Create new comment</legend>
436 <input type="hidden" name="zofcms_comments_page" value="<tmpl_var name="comments_page" escape="html">">
437 <input type="hidden" name="zofcms_comments_username" value="your user name">
438 <input type="hidden" name="page" value="<tmpl_var escape="html"name="page">">
439 <ul>
440 <li>
441 <label for="zofcms_comments_name">Name: </label
442 ><input type="text" name="zofcms_comments_name"
443 id="zofcms_comments_name" value="<tmpl_var escape="html" name="name">">
444 </li>
445 <li>
446 <label for="zofcms_comments_email">E-mail: </label
447 ><input type="text" name="zofcms_comments_email"
448 id="zofcms_comments_email" value="<tmpl_var escape="html" name="email">">
449 </li>
450 <li>
451 <label for="zofcms_comments_comment">Comment: </label
452 ><textarea name="zofcms_comments_comment"
453 id="zofcms_comments_comment" cols="40" rows="10"><tmpl_var name="comment" escape="html"></textarea>
454 </li>
455 </ul>
456 <input id="zofcms_comments_submit" type="submit" value="Post">
457 </fieldset>
458 </form>
459 </tmpl_if>
460 END_TEMPLATE
461 }
462  
463 0 ▶sub _get_mail_template {
Subroutine _get_mail_template: not called CC=1 SCAR=6.9
464 0 return <<'END_MAIL_TEMPLATE';
465 <tmpl_if name="mod">
466 Approve: <tmpl_var name="approve">
467  
468 Deny: <tmpl_var name="deny">
469  
470 </tmpl_if>
471 Comment on page: <tmpl_var name="page">
472 From: <tmpl_var name="name"> [ <tmpl_var name="host"> ]
473 Time: <tmpl_var name="time">
474 E-mail: <tmpl_var name="email">
475 Comment:
476 <tmpl_var name="comment">
477 END_MAIL_TEMPLATE
478 }
479  
480 1 1;
481 __END__
« ZofCMS/Plugin/Debug/Validator/HTML.pm ↑ Summary ZofCMS/Template.pm »