- my $pars = {};
-
- $pars -> {$formdata -> {$_} -> {assign} -> {name}} = plain($formdata -> {$_} -> {name})
- for (qw(
- posterBody
- uniqueID
- followUp
- quoteChar
- userID
- posterName
- posterEmail
- posterURL
- posterImage
- ));
-
- my $cgi = $param -> {cgi};
-
- my $tpar = {
- thread => $param -> {thread},
- template => $param -> {tree},
- start => $param -> {posting},
- cgi => $cgi
- };
-
- my $parent_pars;
-
- $parent_pars = {
- $assign->{parentTitle} => plain($pheader->{subject}),
- $assign->{parentCat} => plain($pheader->{category}),
- $assign->{parentName} => plain($pheader->{name}),
- $assign->{parentTime} => plain(hr_time($pheader->{time})),
- $assign->{parentLink} => query_string (
- { $cgi -> {thread} => $param -> {thread},
- $cgi -> {posting} => ($pnode -> getAttribute ('id') =~ /(\d+)/)[0]
- })
- } if (%$pheader);
-
- print ${$template -> scrap (
- $assign->{mainDoc},
- { $assign->{name} => plain($header->{name}),
- $assign->{email} => plain($header->{email}),
- $assign->{home} => plain($header->{home}),
- $assign->{image} => plain($header->{image}),
- $assign->{time} => plain(hr_time($header->{time})),
- $assign->{message} => $text,
- $assign->{messageTitle} => plain($header->{subject}),
- $assign->{messageCat} => plain($header->{category}),
- $param->{tree}->{main} => html_thread ($msg, $template, $tpar),
- $formact->{post}->{assign} => $formact->{post}->{url},
- $formact->{vote}->{assign} => $formact->{vote}->{url},
- $formdata->{posterBody}->{assign}->{value} => $area,
- $formdata->{uniqueID} ->{assign}->{value} => plain(unique_id),
- $formdata->{followUp} ->{assign}->{value} => plain($param -> {thread}.';'.$param -> {posting}),
- $formdata->{quoteChar} ->{assign}->{value} => "ÿ".plain($view -> {quoteChars}),
- $formdata->{userID} ->{assign}->{value} => ''
- },
- $pars,
- $parent_pars
- )};
+ my $tpar = {
+ thread => $param -> {thread},
+ template => $param -> {tree},
+ start => $param -> {posting},
+ cgi => $cgi
+ };
+
+ my $parent_pars;
+
+ $parent_pars = {
+ $assign->{parentTitle} => plain(defined $pheader->{subject} ? $pheader->{subject} : ''),
+ $assign->{parentCat} => plain(defined $pheader->{category} ? $pheader->{category} : ''),
+ $assign->{parentName} => plain(defined $pheader->{name} ? $pheader->{name} : ''),
+ $assign->{parentTime} => plain(hr_time($pheader->{time})),
+ $assign->{parentLink} => query_string (
+ { $cgi -> {thread} => $param -> {thread},
+ $cgi -> {posting} => ($pnode -> getAttribute ('id') =~ /(\d+)/)[0]
+ })
+ } if (%$pheader);
+
+ print ${$template -> scrap (
+ $assign->{mainDoc},
+ { $assign->{name} => plain(defined $header->{name} ? $header->{name} : ''),
+ $assign->{email} => plain(defined $header->{email} ? $header->{email} : ''),
+ $assign->{home} => plain(defined $header->{home} ? $header->{home} : ''),
+ $assign->{image} => plain(defined $header->{image} ? $header->{image} : ''),
+ $assign->{time} => plain(hr_time($header->{time})),
+ $assign->{message} => $text,
+ $assign->{messageTitle} => plain(defined $header->{subject} ? $header->{subject} : ''),
+ $assign->{messageCat} => plain(defined $header->{category} ? $header->{category} : ''),
+ $param->{tree}->{main} => html_thread ($msg, $template, $tpar),
+ $formact->{post}->{assign} => $formact->{post}->{url},
+ $formact->{vote}->{assign} => $formact->{vote}->{url},
+ $formdata->{posterBody}->{assign}->{value} => $area,
+ $formdata->{uniqueID} ->{assign}->{value} => plain(unique_id),
+ $formdata->{followUp} ->{assign}->{value} => plain($param -> {thread}.';'.$param -> {posting}),
+ $formdata->{quoteChar} ->{assign}->{value} => "ÿ".plain(defined $view -> {quoteChars} ? $view -> {quoteChars} : ''),
+ $formdata->{userID} ->{assign}->{value} => '',
+ $assign->{firsttime} => $param->{firsttime} ? $param->{firsttime} : '',
+ $assign->{voted} => $param->{voted} ? $param->{voted} : ''
+ },
+ $pars,
+ $parent_pars
+ )};
+
+ # all output done
+ #
+ close STDOUT;
+
+ if ($param->{firsttime}) {
+ my $cache = new Posting::Cache ($param->{cachepath});
+ $cache -> add_view (
+ { thread => $param -> {thread},
+ posting => $param -> {posting}
+ }
+ );
+ }
+ }
+ }
+ }
+ }