>
% if (defined $title) { % } % if ($r_email) { % }
<% $title %>
 Author: <%$r_author%>
 E-Mail: <%$r_email%>
 Date: <%$r_time%>
 Subject: <%$r_subj%>
Message
<%$r_body%>
<%INIT> my ($r_author, $r_email, $r_subj, $r_body, $r_time); return -1 if (!defined $id || $id !~ /^\d+$/); my $dbh=$m->comp('/includes/dbcon.msn'); return -1 unless $dbh; my $sth = $dbh->prepare("SELECT * FROM $tree WHERE id=$id"); if (! $sth) { $m->out("Error: " . $dbh->errstr . "
"); return; } if (! $sth->execute()) { $m->out("Error: " . $dbh->errstr . "
"); return; } if(my $ref = $sth->fetchrow_hashref ) { my $sth1 = $dbh->prepare("SELECT * FROM $resource_table WHERE id=".$ref->{resource}); if (! $sth1) { $m->out("Error: " . $dbh->errstr . "
"); return -1; } if (! $sth1->execute()) { $m->out("Error: " . $dbh->errstr . "
"); return -1; } if (my $ref1 = $sth1->fetchrow_hashref) { $r_author = $ref1->{author} if (defined $ref1->{author}); $r_email = $ref1->{email} if (defined $ref1->{email}); $r_subj = $ref1->{subj} if (defined $ref1->{subj}); $r_body = $ref1->{body} if (defined $ref1->{body}); $r_body =~ s/\r\n/
\n/g; $r_time = $ref1->{mtime} if (defined $ref1->{mtime}); my ($y,$m,$d,$h,$min)=($r_time =~ /^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)/); $r_time = "$y-$m-$d $h:$min"; } else { $sth1->finish; $m->out("Внутренняя ошибка #3 форума!"); return -1; } $sth1->finish; } else { $sth->finish; $m->out("Внутренняя ошибка #4 форума!"); return -1; } $sth->finish; <%ARGS> $tree $resource_table $id => undef $title => undef $width => undef <%DOC> $tree - tree to add message $resource_table - resource table to add message $id - id of message to show in tree $width - width of form