2 #package Posting::Handle;
4 ################################################################################
6 # File: shared/Posting/Handle.pm #
8 # Authors: Frank Schoenmann <fs@tower.de>, 2001-02-27 #
10 # Description: Allow modifications of postings #
12 ################################################################################
17 use base qw(Exporter);
19 @EXPORT = qw(hide_posting);
25 ### hide_posting () ############################################################
27 # Hide a posting: set 'invisible' flag
29 # Params: $forum Path and filename of forum
30 # $tpath Path to thread files
31 # \%hashref Reference: 'thread', 'posting', 'indexFile'
36 my ($forum, $tpath, $info) = @_;
37 my ($tid, $mid, $indexFile) = ('t' . $info->{'thread'},
38 'm' . $info->{'posting'},
39 $info->{'indexFile'});
41 my $tfile = $tpath . '/' . $tid . '.xml';
42 change_posting_visibility
($tfile, $tid, $mid, 1);
43 change_posting_visibility
($forum, $tid, $mid, 1);
46 ### change_posting_visibility () ###############################################
50 # Params: $fname Filename
53 # $invisible 1 - invisible, 0 - visible
56 sub change_posting_visibility
($$$)
58 my ($fname, $tid, $mid, $invisible) = @_;
60 my $parser = new XML
::DOM
::Parser
;
61 my $xml = $parser->parsefile($fname);
63 my $mnode = get_message_node
($xml, $tid, $mid);
64 $mnode->setAttribute('invisible', $invisible);
66 $xml->printToFile($fname.'.temp');
67 rename $fname.'.temp', $fname;