]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/user/fo_delete.pl
3 ################################################################################
5 # File: user/admin/fo_delete.pl #
7 # Authors: Christian Kruse <ckruse@wwwtech.de> #
9 # Description: display the forum main file to delete msgs #
11 ################################################################################
22 my $null = $0; $null =~ s/\\/\//g
if uc $^O
eq 'WIN32'; # for win :-(
23 $Bin = ($null =~ /^(.*)\/.*$/)?
$1 : '.';
24 $Shared = "$Bin/../shared";
25 $Config = "$Bin/../../cgi-config";
26 $Script = ($null =~ /^.*\/(.*)$/)?
$1 : $null;
29 # setting umask, remove or comment it, if you don't need
34 use CGI
::Carp
qw(fatalsToBrowser);
39 use Template
::Posting
;
42 use Encode
::Plain
; $Encode::Plain
::utf8
= 1;
55 ################################################################################
63 sub VERSION
{(q
$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
70 my $conf = read_script_conf
($Config, $Shared, $Script);
72 my $show = $conf->{show
};
73 my $show_forum = $show->{Forum
};
75 my $forum_file = $conf->{files
}->{forum
};
77 # check on closed forum
79 my $main = new Lock
($forum_file);
80 if ($main->masterlocked) {
82 my $template = new Template
$show_forum->{templateFile
};
84 $template->printscrap (
85 $show_forum->{assign
}->{errorDoc
},
86 { $show_forum->{assign
}->{errorText
} => $template->insert($show_forum->{assign
}->{'notAvailable'}) }
91 my $cgi = $show->{assign
}->{cgi
};
92 my $tree = $show->{assign
}->{thread
};
94 my $adminDefault = read_admin_conf
($conf->{files
}->{adminDefault
});
96 my ($tid, $mid, $cmd) = (param
($cgi->{thread
}), param
($cgi->{posting
}), param
('c'));
98 if(defined $cmd and defined $mid and defined $tid) {
100 unless(hide_posting
($forum_file,$conf->{files
}->{messagePath
},{'thread' => $tid, 'posting' => $mid})) {
101 my $template = new Template
$show_forum->{templateFile
};
102 $template->printscrap(
103 $show_forum->{assign
}->{errorDoc
},
104 { $show_forum->{assign
}->{errorText
} => $template->insert($show_forum->{assign
}->{deleteFailed
}) }
108 my $template = new Template
$show_forum->{templateFile
};
109 my $xmlfile = parse_xml_file
($conf->{files
}->{messagePath
}.'/t'.$tid.'.xml');
110 my $mnode = get_message_node
($xmlfile,'t'.$tid,'m'.$mid);
111 my $infos = get_message_header
($mnode);
112 my $ip = $mnode->getAttribute('ip');
114 $template->printscrap(
115 $show_forum->{assign
}->{deletedDoc
},{
116 $show_forum->{assign
}->{tid
} => $tid,
117 $show_forum->{assign
}->{mid
} => $mid,
118 $show->{assign
}->{thread
}->{cat
} => plain
($infos->{category
}),
119 $show->{assign
}->{thread
}->{subject
} => plain
($infos->{subject
}),
120 $show->{assign
}->{thread
}->{time} => plain
(long_hr_time
($infos->{time})),
121 $show->{assign
}->{thread
}->{name
} => plain
($infos->{name
}),
122 $show->{Posting
}->{assign
}->{email
} => plain
($infos->{email
}),
123 $show_forum->{assign
}->{ip
} => plain
($ip)
129 } elsif($cmd eq 'w') {
130 unless(recover_posting
($forum_file,$conf->{files
}->{messagePath
},{'thread' => $tid, 'posting' => $mid})) {
131 my $template = new Template
$show_forum->{templateFile
};
132 $template->printscrap(
133 $show_forum->{assign
}->{errorDoc
},
134 { $show_forum->{assign
}->{errorText
} => $template->insert($show_forum->{assign
}->{recoverFailed
}) }
137 print_forum_as_HTML
(
139 $show_forum->{templateFile
}, {
141 assign
=> $show_forum->{assign
},
142 adminDefault
=> $adminDefault,
150 elsif (defined ($tid) and defined ($mid)) {
151 my $show_posting = $show->{Posting
};
153 print_posting_as_HTML
(
154 $conf->{files
}->{messagePath
},
155 $show_posting->{templateFile
}, {
156 assign
=> $show_posting->{assign
},
159 adminDefault
=> $adminDefault,
160 messages
=> $conf->{template
}->{messages
},
161 form
=> $show_posting->{form
},
165 cachepath
=> $conf->{files
}->{cachePath
},
172 print_forum_as_HTML
(
174 $show_forum->{templateFile
}, {
176 assign
=> $show_forum->{assign
},
177 adminDefault
=> $adminDefault,
188 ### end of fo_view.pl ##########################################################
patrick-canterino.de