Revision 0246e125
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/USTVA.pm | ||
---|---|---|
941 | 941 |
|
942 | 942 |
} |
943 | 943 |
|
944 |
sub get_config { |
|
945 |
$main::lxdebug->enter_sub(); |
|
946 |
|
|
947 |
my ($self, $userpath, $filename) = @_; |
|
948 |
|
|
949 |
my $form = $main::form; |
|
950 |
|
|
951 |
if (!open(FACONF, "$userpath/$form->{login}_$filename")) { |
|
952 |
open(FANEW, ">$userpath/$form->{login}_$filename") || |
|
953 |
$form->error("$userpath/$filename : $!"); |
|
954 |
close(FANEW); |
|
955 |
open(FACONF, "$userpath/$form->{login}_$filename") || |
|
956 |
$form->error("$userpath/$form->{username}_$filename : $!"); |
|
957 |
} |
|
958 |
|
|
959 |
while (<FACONF>) { |
|
960 |
last if (/^\[/); |
|
961 |
next if (/^(\#|\s)/); |
|
962 |
|
|
963 |
# remove comments |
|
964 |
s/\s#.*//g; |
|
965 |
|
|
966 |
# remove any trailing whitespace |
|
967 |
s/^\s*(.*?)\s*$/$1/; |
|
968 |
my ($key, $value) = split(/=/, $_, 2); |
|
969 |
|
|
970 |
$form->{$key} = "$value"; |
|
971 |
|
|
972 |
} |
|
973 |
|
|
974 |
close(FACONF); |
|
975 |
|
|
976 |
$main::lxdebug->leave_sub(); |
|
977 |
} |
|
944 | 978 |
|
945 | 979 |
|
946 | 980 |
1; |
Auch abrufbar als: Unified diff
Funktion get_config aus ustva.pl nach USTVA.pm verschoben, damit sie auch aus rp.pl aufgerufen werden kann.