]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Posting/Handle.pm
67d5c0beecb81d40c2d007b55e14e5150902156d
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) = shift;
37 my ($tid, $pid, $indexFile) = ('t' . $info->{'thread'},
38 'm' . $info->{'posting'},
39 $info->{'indexFile'});
42 # Change flag in thread xml file
43 my $tfile = $tpath . '/' . $tid;
45 my $parser = new XML
::DOM
::Parser
;
46 my $xml = $parser->parsefile($tfile);
48 my $msgs = $xml->getElementsByTagName('Message');
50 for (my $i = 0; $i < $msgs->getLength; $i++)
52 my $msg = $msgs->item($i);
54 if ($msg->getAttribute('id')->getValue == $pid)
56 $msg->setAttribute('invisible', '1');
61 # Save thread xml file
62 $xml->printToFile($tfile . '.temp');
63 rename $tfile . '.temp', $tfile;
67 # Change flag in forum xml file
68 my $parser = new XML
::DOM
::Parser
;
69 my $xml = $parser->parseFile($forum);
71 my $msgs = $xml->getElementsByTagName('Message');
73 for (my $i = 0; $i < $msgs->getLength; $i++)
75 my $msg = $msgs->item($i);
77 if ($msg->getAttribute('id')->getValue == $pid)
79 $msg->setAttribute('invisible', '1');
85 $xml->printToFile($forum . '.temp');
86 rename $forum . '.temp', $forum;
patrick-canterino.de