]>
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 my $admin = new Lock
($filename);
97 if ($admin -> lock(LH_SHARED
)) {
98 my $xml = new XML
::DOM
::Parser
-> parsefile
($admin -> filename
);
101 # write data into the hash
103 my $forum = $xml -> getElementsByTagName
('Forum',0) -> item
(0);
106 my $forum_view = $forum -> getElementsByTagName
('ForumView', 0) -> item
(0);
107 my $thread_view = $forum_view -> getElementsByTagName
('ThreadView', 0) -> item
(0);
108 my $show_thread = $thread_view -> getElementsByTagName
('ShowThread', 0) -> item
(0);
109 my $show_how = $show_thread -> getElementsByTagName
('*', 0) -> item
(0);
110 my $how_name = $show_how -> getTagName
;
111 my $message_view = $forum_view -> getElementsByTagName
('MessageView', 0) -> item
(0);
112 my $flags = $forum_view -> getElementsByTagName
('Flags', 0) -> item
(0);
113 my $quoting = $forum_view -> getElementsByTagName
('Quoting', 0) -> item
(0);
114 my $char = $quoting -> getElementsByTagName
('Chars', 0) -> item
(0);
117 threadOpen
=> $thread_view -> getAttribute
('threadOpen'),
118 countMessages
=> $thread_view -> getAttribute
('countMessages'),
119 sortThreads
=> $thread_view -> getAttribute
('sortThreads'),
120 sortMessages
=> $thread_view -> getAttribute
('sortMessages'),
121 showThread
=> (($how_name eq 'ShowAll')
123 : (($how_name eq 'ShowNone')
125 : ($show_how -> getFirstChild
-> getData
))),
126 showPreview
=> $message_view -> getAttribute
('previewON'),
127 showNA
=> $flags -> getAttribute
('showNA'),
128 showHQ
=> $flags -> getAttribute
('showHQ'),
129 quoting
=> $quoting -> getAttribute
('quotingON'),
130 quoteChars
=> $char?
$char -> getFirstChild
-> getData
:undef
133 my $voting = $forum -> getElementsByTagName
('Voting', 0) -> item
(0);
135 voteLock
=> $voting -> getAttribute
('voteLock'),
136 Limit
=> $voting -> getAttribute
('Limit')
140 $conf {Severance
} = get_severance
($forum -> getElementsByTagName
('Severance', 0) -> item
(0));
143 my $messaging = $forum -> getElementsByTagName
('Messaging', 0) -> item
(0);
144 my $call_by_user = $messaging -> getElementsByTagName
('CallByUser', 0) -> item
(0);
146 $conf {Messaging
} = {
147 userAnswer
=> $messaging -> getAttribute
('callUserAnswer'),
148 thread
=> $messaging -> getAttribute
('callAdminThread'),
149 na
=> $messaging -> getAttribute
('callAdminNA'),
150 hq
=> $messaging -> getAttribute
('callAdminHQ'),
151 voting
=> $messaging -> getAttribute
('callAdminVoting'),
152 archiving
=> $messaging -> getAttribute
('callAdminArchiving'),
153 byUser
=> $messaging -> getAttribute
('callUserAnswer'),
156 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('Name', 0)
161 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('Email', 0)
166 ?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('IpAddress', 0)
172 my $instant = $forum -> getElementsByTagName
('InstantJob', 0) -> item
(0);
173 my $job = $instant -> getElementsByTagName
('*',0) -> item
(0);
174 my $job_name = $job -> getTagName
;
175 $job_name = $job -> getAttribute
('reason') if ($job_name ne 'Severance');
178 execute
=> $instant -> getAttribute
('executeJob'),
179 description
=> $job_name,
181 ($job_name ne 'Severance')
182 ?
$job -> getElementsByTagName
('FileUrl', 0) -> item
(0) -> getFirstChild
-> getData
186 ($job_name eq 'Severance')
187 ? get_severance
($job)
193 my $user = $forum -> getElementsByTagName
('UserManagement', 0) -> item
(0);
196 deleteAfterDays
=> $user
197 -> getElementsByTagName
('DeleteUser', 0) -> item
(0)
198 -> getElementsByTagName
('AfterDays', 0) -> item
(0)
199 -> getFirstChild
-> getData
208 # keep 'require' happy
213 ### end of Conf::Admin #########################################################
patrick-canterino.de