X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/d820e389d9d284d2eb85e19955cbe413ae4ee65d..d8a1fb31ed6883aef6a7ba78a117269218966a10:/selfforum-cgi/shared/Posting/Handle.pm diff --git a/selfforum-cgi/shared/Posting/Handle.pm b/selfforum-cgi/shared/Posting/Handle.pm index 41bb500..9d2a94a 100644 --- a/selfforum-cgi/shared/Posting/Handle.pm +++ b/selfforum-cgi/shared/Posting/Handle.pm @@ -17,7 +17,8 @@ use base qw(Exporter); @EXPORT = qw(hide_posting recover_posting modify_posting); -use Posting::_lib qw(get_message_node save_file); +use Posting::_lib qw(get_message_node save_file get_all_threads + create_forum_xml_string); use XML::DOM; @@ -33,13 +34,33 @@ use XML::DOM; sub hide_posting($$$) { my ($forum, $tpath, $info) = @_; - my ($tid, $mid, $indexFile) = ('t' . $info->{'thread'}, - 'm' . $info->{'posting'}, + my ($tid, $mid, $indexFile) = ($info->{'thread'}, + $info->{'posting'}, $info->{'indexFile'}); - my $tfile = $tpath . '/' . $tid . '.xml'; - change_posting_visibility($tfile, $tid, $mid, 1); - change_posting_visibility($forum, $tid, $mid, 1); + # Thread + my $tfile = $tpath . '/t' . $tid . '.xml'; + change_posting_visibility($tfile, 't'.$tid, 'm'.$mid, 1); + + # Forum + #change_posting_visibility($forum, 't'.$tid, 'm'.$mid, 1); # OBSOLETE + + my ($f, $lthread, $lmsg, $dtd, $zlev) = get_all_threads($forum, 1, 0); + + for (@{$f->{$tid}}) + { + if ($_->{'mid'} == $mid) + { + $_->{'deleted'} = 1; + } + } + + my %cfxs = ( + 'dtd' => $dtd, + 'lastMessage' => $lmsg, + 'lastThread' => $lthread + ); + create_forum_xml_string($f, \%cfxs); } ### recover_posting() ########################################################## @@ -54,13 +75,33 @@ sub hide_posting($$$) sub recover_posting($$$) { my ($forum, $tpath, $info) = @_; - my ($tid, $mid, $indexFile) = ('t' . $info->{'thread'}, - 'm' . $info->{'posting'}, + my ($tid, $mid, $indexFile) = ($info->{'thread'}, + $info->{'posting'}, $info->{'indexFile'}); - my $tfile = $tpath . '/' . $tid . '.xml'; - change_posting_visibility($tfile, $tid, $mid, 0); - change_posting_visibility($forum, $tid, $mid, 0); + # Thread + my $tfile = $tpath . '/t' . $tid . '.xml'; + change_posting_visibility($tfile, 't'.$tid, 'm'.$mid, 0); + + # Forum + #change_posting_visibility($forum, 't'.$tid, 'm'.$mid, 0); # OBSOLETE + + my ($f, $lthread, $lmsg, $dtd, $zlev) = get_all_threads($forum, 1, 0); + + for (@{$f->{$tid}}) + { + if ($_->{'mid'} == $mid) + { + $_->{'deleted'} = 0; + } + } + + my %cfxs = ( + 'dtd' => $dtd, + 'lastMessage' => $lmsg, + 'lastThread' => $lthread + ); + create_forum_xml_string($f, \%cfxs); } ### change_posting_visibility () ############################################### @@ -155,4 +196,5 @@ sub change_posting_value($$$$) } +# Let it be true 1;