3
require '/var/ipfire/general-functions.pl';
4
require "${General::swroot}/lang.pl";
5
require "${General::swroot}/header.pl";
7
&Header::showhttpheaders();
11
&Header::getcgihash(\%cgiparams);
13
&Header::openpage('asterisk', 1, '');
15
&Header::openbigbox('100%', 'LEFT');
17
if ($cgiparams{'ACTION'} eq $Lang::tr{'save'})
19
$conf_file = $cgiparams{'save_path'};
20
open (FILE, ">$conf_file") or die "Kann die Datei nicht speichern: $!";
22
print FILE "$cgiparams{'textarea'}";
24
&Header::openbox('100%', 'LEFT', 'info');
25
print "$conf_file wurde gespeichert";
29
if ($cgiparams{'ACTION'} eq Bearbeiten)
31
$conf_file = $cgiparams{'conf_file'};
34
if ($conf_file eq '') {
35
$conf_file='/var/ipfire/asterisk/extensions.conf';
38
if ($cgiparams{'ACTION'} eq extensions)
40
$conf_file='/var/ipfire/asterisk/extensions.conf';
43
if ($cgiparams{'ACTION'} eq sip)
45
$conf_file='/var/ipfire/asterisk/sip.conf';
48
if ($cgiparams{'ACTION'} eq iax)
50
$conf_file='/var/ipfire/asterisk/iax.conf';
57
&Header::openbox('100%', 'LEFT', $tr{'error messages'});
58
print "<FONT CLASS='base'>$errormessage </FONT>\n";
62
$cgiparams{'ACTION'} = '';
64
print "<FORM METHOD='POST'>\n";
66
if ($conf_file ne '') {
68
&Header::openbox('100%', 'LEFT', $conf_file);
70
<center><table border=0>
71
<tr><td><textarea name="textarea" cols="80" rows="20" wrap="VIRTUAL">
74
system("cat $conf_file");
79
<p><input type=text name=save_path value=$conf_file size=25>
80
<p><input type=submit name=ACTION value=$Lang::tr{'save'}>
89
&Header::openbox('100%', 'LEFT', 'Dateiauswahl');
91
my $dir = '/var/ipfire/asterisk/';
97
<table width=100% border=0>
98
<tr><td width=33% align=right>
100
<input type=submit name=ACTION value=extensions><input type=submit name=ACTION value=sip><input type=submit name=ACTION value=iax>
101
<td width=33% align=right>
102
<center><select name=conf_file>
105
foreach $line (sort (@dateien)) {
107
$op_name =~ s/$dir//g;
108
print "<option value='$line'>$op_name</option>\n";
111
my $dir2 = '/home/httpd/cgi-bin/asterisk/conf/';
116
foreach $line2 (sort (@dateien2)) {
118
$op_name2 =~ s/$dir2//g;
119
print "<option value='$line2'>$op_name2</option>\n";
122
print "</select><input type=submit name=ACTION value=Bearbeiten></center><td width=33% align=right> </table>";
129
opendir (DH, $dir) or return;
130
while ($item = readdir (DH)) {
131
next if ( $item =~ /^\./ );
132
$pfad = ( ($dir =~ /\/$/) ? ($dir . $item) : ($dir . '/'.$item) );
133
push (@dateien, $pfad) if (-f $pfad);
134
listFiles ($pfad) if (-d $pfad);
144
opendir (DH2, $dir2) or return;
145
while ($item2 = readdir (DH2)) {
146
next if ( $item2 =~ /^\./ );
147
$pfad2 = ( ($dir2 =~ /\/$/) ? ($dir2 . $item2) : ($dir2 . '/'.$item2) );
148
push (@dateien2, $pfad2) if (-f $pfad2);
149
listFiles2 ($pfad2) if (-d $pfad2);
159
&Header::closebigbox();
161
&Header::closepage();