]>
git.p6c8.net - selfforum.git/blob - selfforum-cgi/shared/Conf/Admin.pm
3 # ====================================================
4 # Autor: n.d.p. / 2001-01-05
5 # lm : n.d.p. / 2001-02-25
6 # ====================================================
8 # Einlesen der Admindefaultkonfiguration
9 # ====================================================
21 # ====================================================
23 # ====================================================
25 use base
qw(Exporter);
26 @EXPORT = qw(read_admin_conf);
28 ################################
31 # Default-Admin-Konf. lesen
32 ################################
34 sub read_admin_conf
($) {
38 if (-f
$filename) { # gibts die Datei ueberhaupt?
39 if (lock_file
($filename)) { # sperren...
40 my $xml = new XML
::DOM
::Parser
-> parsefile
($filename); # ...einlesen und parsen...
41 violent_unlock_file
($filename) unless (unlock_file
($filename)); # ...freigeben
43 # =================================
44 # jetzt Daten in den Hash schreiben
46 my $forum = $xml -> getElementsByTagName
('Forum',0) -> item
(0);
49 my $forum_view = $forum -> getElementsByTagName
('ForumView', 0) -> item
(0);
50 my $thread_view = $forum_view -> getElementsByTagName
('ThreadView', 0) -> item
(0);
51 my $show_thread = $thread_view -> getElementsByTagName
('ShowThread', 0) -> item
(0);
52 my $show_how = $show_thread -> getElementsByTagName
('*', 0) -> item
(0);
53 my $how_name = $show_how -> getTagName
;
54 my $message_view = $forum_view -> getElementsByTagName
('MessageView', 0) -> item
(0);
55 my $flags = $forum_view -> getElementsByTagName
('Flags', 0) -> item
(0);
56 my $quoting = $forum_view -> getElementsByTagName
('Quoting', 0) -> item
(0);
57 my $char = $quoting -> getElementsByTagName
('Chars', 0) -> item
(0);
59 $conf {View
} = {threadOpen
=> $thread_view -> getAttribute
('threadOpen'),
60 countMessages
=> $thread_view -> getAttribute
('countMessages'),
61 sortThreads
=> $thread_view -> getAttribute
('sortThreads'),
62 sortMessages
=> $thread_view -> getAttribute
('sortMessages'),
63 showThread
=> (($how_name eq 'ShowAll')?
undef:
64 (($how_name eq 'ShowNone')?
1:
65 ($show_how -> getFirstChild
-> getData
))),
66 showPreview
=> $message_view -> getAttribute
('previewON'),
67 showNA
=> $flags -> getAttribute
('showNA'),
68 showHQ
=> $flags -> getAttribute
('showHQ'),
69 quoting
=> $quoting -> getAttribute
('quotingON'),
70 quoteChars
=> $char?
$char -> getFirstChild
-> getData
:undef};
72 my $voting = $forum -> getElementsByTagName
('Voting', 0) -> item
(0);
74 voteLock
=> $voting -> getAttribute
('voteLock'),
75 Limit
=> $voting -> getAttribute
('Limit')
79 $conf {Severance
} = &get_severance
($forum -> getElementsByTagName
('Severance', 0) -> item
(0));
82 my $messaging = $forum -> getElementsByTagName
('Messaging', 0) -> item
(0);
83 my $call_by_user = $messaging -> getElementsByTagName
('CallByUser', 0) -> item
(0);
85 $conf {Messaging
} = {userAnswer
=> $messaging -> getAttribute
('callUserAnswer'),
86 thread
=> $messaging -> getAttribute
('callAdminThread'),
87 na
=> $messaging -> getAttribute
('callAdminNA'),
88 hq
=> $messaging -> getAttribute
('callAdminHQ'),
89 voting
=> $messaging -> getAttribute
('callAdminVoting'),
90 archiving
=> $messaging -> getAttribute
('callAdminArchiving'),
91 byUser
=> $messaging -> getAttribute
('callUserAnswer'),
92 callByName
=> [$call_by_user?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('Name', 0):()],
93 callByMail
=> [$call_by_user?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('Email', 0):()],
94 callByIP
=> [$call_by_user?
map {$_ -> getFirstChild
-> getData
} $call_by_user -> getElementsByTagName
('IpAddress', 0):()]};
97 my $instant = $forum -> getElementsByTagName
('InstantJob', 0) -> item
(0);
98 my $job = $instant -> getElementsByTagName
('*',0) -> item
(0);
99 my $job_name = $job -> getTagName
;
100 $job_name = $job -> getAttribute
('reason') if ($job_name ne 'Severance');
102 $conf {Instant
} = {execute
=> $instant -> getAttribute
('executeJob'),
103 description
=> $job_name,
104 url
=> (($job_name ne 'Severance')?
$job -> getElementsByTagName
('FileUrl', 0) -> item
(0) -> getFirstChild
-> getData
:undef),
105 Severance
=> (($job_name eq 'Severance')?
&get_severance
($job):undef)};
108 my $user = $forum -> getElementsByTagName
('UserManagement', 0) -> item
(0);
110 $conf {User
} = {deleteAfterDays
=> $user -> getElementsByTagName
('DeleteUser', 0) -> item
(0)
111 -> getElementsByTagName
('AfterDays', 0) -> item
(0)
112 -> getFirstChild
-> getData
};
116 violent_unlock_file
($filename);}}
122 # ====================================================
124 # ====================================================
126 sub get_severance
($) {
127 my $severance = shift;
129 my $after_byte = $severance -> getElementsByTagName
('AfterByte', 0) -> item
(0);
130 my $after_message = $severance -> getElementsByTagName
('AfterMessage', 0) -> item
(0);
131 my $after_thread = $severance -> getElementsByTagName
('AfterThread', 0) -> item
(0);
132 my $last_posting = $severance -> getElementsByTagName
('AfterLastPosting', 0) -> item
(0);
134 my %conf =( exArchiving
=> $severance -> getAttribute
('executeArchiving'),
135 archiving
=> $severance -> getElementsByTagName
('Archiving', 0) -> item
(0)
136 -> getElementsByTagName
('*', 0) -> item
(0) -> getTagName
,
137 severance
=> $severance -> getAttribute
('executeSeverance'),
138 afterByte
=> ($after_byte?
$after_byte -> getFirstChild
-> getData
:undef),
139 afterThread
=> ($after_thread?
$after_thread -> getFirstChild
-> getData
:undef),
140 afterMessage
=> ($after_message?
$after_message -> getFirstChild
-> getData
:undef),
141 lastPosting
=> ($last_posting?
$last_posting -> getFirstChild
-> getData
:undef));
146 # ====================================================
147 # Modulinitialisierung
148 # ====================================================
150 # making require happy
153 # ====================================================
155 # ====================================================
patrick-canterino.de