]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Conf/Admin.pm
3 ################################################################################
5 # File: shared/CheckRFC.pm #
7 # Authors: Andre Malo <nd@o3media.de>, 2001-06-16 #
9 # Description: read and parse admin default config #
11 ################################################################################
23 ################################################################################
27 $VERSION = do { my @r =(q
$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x
$#r, @r };
29 ################################################################################
33 use base
qw(Exporter);
34 @EXPORT = qw(read_admin_conf);
36 ### get_severance () ###########################################################
38 # read out severance config (used twice)
40 # Params: $severance - element node
44 sub get_severance
($) {
45 my $severance = shift;
47 my $after_byte = $severance -> getElementsByTagName
('AfterByte', 0) -> item
(0);
48 my $after_message = $severance -> getElementsByTagName
('AfterMessage', 0) -> item
(0);
49 my $after_thread = $severance -> getElementsByTagName
('AfterThread', 0) -> item
(0);
50 my $last_posting = $severance -> getElementsByTagName
('AfterLastPosting', 0) -> item
(0);
53 exArchiving
=> $severance -> getAttribute
('executeArchiving'),
54 archiving
=> $severance
55 -> getElementsByTagName
('Archiving', 0) -> item
(0)
56 -> getElementsByTagName
('*', 0) -> item
(0) -> getTagName
,
57 severance
=> $severance -> getAttribute
('executeSeverance'),
60 ?
$after_byte -> getFirstChild
-> getData
65 ?
$after_thread -> getFirstChild
-> getData
70 ?
$after_message -> getFirstChild
-> getData
75 ?
$last_posting -> getFirstChild
-> getData
83 ### read_admin_conf () #########################################################
85 # read and parse admin config
87 # Params: $filename - filename
91 sub read_admin_conf
($) {
96 if (lock_file
($filename)) {
97 my $xml = new XML
::DOM
::Parser
-> parsefile
($filename);
98 violent_unlock_file
($filename) unless (unlock_file
($filename));
100 # write data into the hash
102 my $forum = $xml -> getElementsByTagName
('Forum',0) -> item
(0);
105 my $forum_view = $forum -> getElementsByTagName
('ForumView', 0) -> item
(0);
106 my $thread_view = $forum_view -> getElementsByTagName
('ThreadView', 0) -> item
(0);
107 my $show_thread = $thread_view -> getElementsByTagName
('ShowThread', 0) -> item
(0);
108 my $show_how = $show_thread -> getElementsByTagName
('*', 0) -> item
(0);
109 my $how_name = $show_how -> getTagName
;
110 my $message_view = $forum_view -> getElementsByTagName
('MessageView', 0) -> item
(0);
111 my $flags = $forum_view -> getElementsByTagName
('Flags', 0) -> item
(0);
112 my $quoting = $forum_view -> getElementsByTagName
('Quoting', 0) -> item
(0);
113 my $char = $quoting -> getElementsByTagName
('Chars', 0) -> item
(0);
116 threadOpen
=> $thread_view -> getAttribute
('threadOpen'),
117 countMessages
=> $thread_view -> getAttribute
('countMessages'),
118 sortThreads
=> $thread_view -> getAttribute
('sortThreads'),
119 sortMessages
=> $thread_view -> getAttribute
('sortMessages'),
120 showThread
=> (($how_name eq 'ShowAll')
122 : (($how_name eq 'ShowNone')
124 : ($show_how -> getFirstChild
-> getData
))),
125 showPreview
=> $message_view -> getAttribute
('previewON'),
126 showNA
=> $flags -> getAttribute
('showNA'),
127 showHQ
=> $flags -> getAttribute
('showHQ'),
128 quoting
=> $quoting -> getAttribute
('quotingON'),
129 quoteChars
=> $char?
$char -> getFirstChild
-> getData
:undef
132 my $voting = $forum -> getElementsByTagName
('Voting', 0) -> item
(0);
134 voteLock
=> $voting -> getAttribute
('voteLock'),
135 Limit
=> $voting -> getAttribute
('Limit')
139 $conf {Severance
} = get_severance
($forum -> getElementsByTagName
('Severance', 0) -> item
(0));
142 my $messaging = $forum -> getElementsByTagName
('Messaging', 0) -> item
(0);
143 my $call_by_user = $messaging -> getElementsByTagName
('CallByUser', 0) -> item
(0);
145 $conf {Messaging
} = {
146 userAnswer
=> $messaging -> getAttribute
('callUserAnswer'),
147 thread
=> $messaging -> getAttribute
('callAdminThread'),
148 na
=> $messaging -> getAttribute
('callAdminNA'),
149 hq
=> $messaging -> getAttribute
('callAdminHQ'),
150 voting
=> $messaging -> getAttribute
('callAdminVoting'),
151 archiving
=> $messaging -> getAttribute
('callAdminArchiving'),
152 byUser
=> $messaging -> getAttribute
('callUserAnswer'),
155 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('Name', 0)
160 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('Email', 0)
165 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('IpAddress', 0)
171 my $instant = $forum -> getElementsByTagName
('InstantJob', 0) -> item
(0);
172 my $job = $instant -> getElementsByTagName
('*',0) -> item
(0);
173 my $job_name = $job -> getTagName
;
174 $job_name = $job -> getAttribute
('reason') if ($job_name ne 'Severance');
177 execute
=> $instant -> getAttribute
('executeJob'),
178 description
=> $job_name,
180 ($job_name ne 'Severance')
181 ?
$job -> getElementsByTagName
('FileUrl', 0) -> item
(0) -> getFirstChild
-> getData
185 ($job_name eq 'Severance')
186 ? get_severance
($job)
192 my $user = $forum -> getElementsByTagName
('UserManagement', 0) -> item
(0);
195 deleteAfterDays
=> $user
196 -> getElementsByTagName
('DeleteUser', 0) -> item
(0)
197 -> getElementsByTagName
('AfterDays', 0) -> item
(0)
198 -> getFirstChild
-> getData
203 violent_unlock_file
($filename);
211 # keep 'require' happy
216 ### end of Conf::Admin #########################################################
patrick-canterino.de