]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Conf/Admin.pm
3 ################################################################################
5 # File: shared/CheckRFC.pm #
7 # Authors: André Malo <nd@o3media.de> #
9 # Description: read and parse admin default config #
11 ################################################################################
22 ################################################################################
30 sub VERSION
{(q
$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
32 ################################################################################
36 use base
qw(Exporter);
37 @EXPORT = qw(read_admin_conf);
39 ### get_severance () ###########################################################
41 # read out severance config (used twice)
43 # Params: $severance - element node
47 sub get_severance
($) {
48 my $severance = shift;
50 my $after_byte = $severance -> getElementsByTagName
('AfterByte', 0) -> item
(0);
51 my $after_message = $severance -> getElementsByTagName
('AfterMessage', 0) -> item
(0);
52 my $after_thread = $severance -> getElementsByTagName
('AfterThread', 0) -> item
(0);
53 my $last_posting = $severance -> getElementsByTagName
('AfterLastPosting', 0) -> item
(0);
56 exArchiving
=> $severance -> getAttribute
('executeArchiving'),
57 archiving
=> $severance
58 -> getElementsByTagName
('Archiving', 0) -> item
(0)
59 -> getElementsByTagName
('*', 0) -> item
(0) -> getTagName
,
60 severance
=> $severance -> getAttribute
('executeSeverance'),
63 ?
$after_byte -> getFirstChild
-> getData
68 ?
$after_thread -> getFirstChild
-> getData
73 ?
$after_message -> getFirstChild
-> getData
78 ?
$last_posting -> getFirstChild
-> getData
86 ### read_admin_conf () #########################################################
88 # read and parse admin config
90 # Params: $filename - filename
94 sub read_admin_conf
($) {
99 my $admin = new Lock
($filename);
100 if ($admin -> lock(LH_SHARED
)) {
101 my $xml = new XML
::DOM
::Parser
-> parsefile
($admin -> filename
);
104 # write data into the hash
106 my $forum = $xml -> getElementsByTagName
('Forum',0) -> item
(0);
109 my $forum_view = $forum -> getElementsByTagName
('ForumView', 0) -> item
(0);
110 my $thread_view = $forum_view -> getElementsByTagName
('ThreadView', 0) -> item
(0);
111 my $show_thread = $thread_view -> getElementsByTagName
('ShowThread', 0) -> item
(0);
112 my $show_how = $show_thread -> getElementsByTagName
('*', 0) -> item
(0);
113 my $how_name = $show_how -> getTagName
;
114 my $message_view = $forum_view -> getElementsByTagName
('MessageView', 0) -> item
(0);
115 my $flags = $forum_view -> getElementsByTagName
('Flags', 0) -> item
(0);
116 my $quoting = $forum_view -> getElementsByTagName
('Quoting', 0) -> item
(0);
117 my $char = $quoting -> getElementsByTagName
('Chars', 0) -> item
(0);
120 threadOpen
=> $thread_view -> getAttribute
('threadOpen'),
121 countMessages
=> $thread_view -> getAttribute
('countMessages'),
122 sortThreads
=> $thread_view -> getAttribute
('sortThreads'),
123 sortMessages
=> $thread_view -> getAttribute
('sortMessages'),
124 showThread
=> (($how_name eq 'ShowAll')
126 : (($how_name eq 'ShowNone')
128 : ($show_how -> getFirstChild
-> getData
))),
129 showPreview
=> $message_view -> getAttribute
('previewON'),
130 showNA
=> $flags -> getAttribute
('showNA'),
131 showHQ
=> $flags -> getAttribute
('showHQ'),
132 quoting
=> $quoting -> getAttribute
('quotingON'),
133 quoteChars
=> $char?
$char -> getFirstChild
-> getData
:undef
136 my $voting = $forum -> getElementsByTagName
('Voting', 0) -> item
(0);
138 voteLock
=> $voting -> getAttribute
('voteLock'),
139 Limit
=> $voting -> getAttribute
('Limit')
143 $conf {Severance
} = get_severance
($forum -> getElementsByTagName
('Severance', 0) -> item
(0));
146 my $messaging = $forum -> getElementsByTagName
('Messaging', 0) -> item
(0);
147 my $call_by_user = $messaging -> getElementsByTagName
('CallByUser', 0) -> item
(0);
149 $conf {Messaging
} = {
150 userAnswer
=> $messaging -> getAttribute
('callUserAnswer'),
151 thread
=> $messaging -> getAttribute
('callAdminThread'),
152 na
=> $messaging -> getAttribute
('callAdminNA'),
153 hq
=> $messaging -> getAttribute
('callAdminHQ'),
154 voting
=> $messaging -> getAttribute
('callAdminVoting'),
155 archiving
=> $messaging -> getAttribute
('callAdminArchiving'),
156 byUser
=> $messaging -> getAttribute
('callUserAnswer'),
159 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('Name', 0)
164 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('Email', 0)
169 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('IpAddress', 0)
175 my $instant = $forum -> getElementsByTagName
('InstantJob', 0) -> item
(0);
176 my $job = $instant -> getElementsByTagName
('*',0) -> item
(0);
177 my $job_name = $job -> getTagName
;
178 $job_name = $job -> getAttribute
('reason') if ($job_name ne 'Severance');
181 execute
=> $instant -> getAttribute
('executeJob'),
182 description
=> $job_name,
184 ($job_name ne 'Severance')
185 ?
$job -> getElementsByTagName
('FileUrl', 0) -> item
(0) -> getFirstChild
-> getData
189 ($job_name eq 'Severance')
190 ? get_severance
($job)
196 my $user = $forum -> getElementsByTagName
('UserManagement', 0) -> item
(0);
199 deleteAfterDays
=> $user
200 -> getElementsByTagName
('DeleteUser', 0) -> item
(0)
201 -> getElementsByTagName
('AfterDays', 0) -> item
(0)
202 -> getFirstChild
-> getData
211 # keep 'require' happy
216 ### end of Conf::Admin #########################################################
patrick-canterino.de