mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-04 19:11:27 +02:00
ddns.cgi: Hide listing if no entries exist.
Also remove call of unknown function.
This commit is contained in:
@@ -480,9 +480,20 @@ END
|
|||||||
|
|
||||||
##
|
##
|
||||||
# Third section, display all created ddns hosts.
|
# Third section, display all created ddns hosts.
|
||||||
|
# Re-open file to get changes.
|
||||||
|
open(FILE, $datafile) or die "Unable to open $datafile.";
|
||||||
|
@current = <FILE>;
|
||||||
|
close(FILE);
|
||||||
|
|
||||||
&Header::openbox('100%', 'left', $Lang::tr{'current hosts'});
|
# Get IP address of the red interface.
|
||||||
print <<END
|
my $ip = &General::GetDyndnsRedIP();
|
||||||
|
my $id = 0;
|
||||||
|
my $toggle_enabled;
|
||||||
|
|
||||||
|
if (@current) {
|
||||||
|
&Header::openbox('100%', 'left', $Lang::tr{'current hosts'});
|
||||||
|
|
||||||
|
print <<END;
|
||||||
<table width='100%' class='tbl'>
|
<table width='100%' class='tbl'>
|
||||||
<tr>
|
<tr>
|
||||||
<th width='30%' align='center' class='boldbase'><b>$Lang::tr{'service'}</b></th>
|
<th width='30%' align='center' class='boldbase'><b>$Lang::tr{'service'}</b></th>
|
||||||
@@ -490,55 +501,43 @@ print <<END
|
|||||||
<th width='20%' colspan='3' class='boldbase' align='center'><b>$Lang::tr{'action'}</b></th>
|
<th width='20%' colspan='3' class='boldbase' align='center'><b>$Lang::tr{'action'}</b></th>
|
||||||
</tr>
|
</tr>
|
||||||
END
|
END
|
||||||
;
|
|
||||||
|
|
||||||
# Re-open file to get changes.
|
foreach my $line (@current) {
|
||||||
open(FILE, $datafile) or die "Unable to open $datafile.";
|
# Remove newlines.
|
||||||
@current = <FILE>;
|
chomp(@current);
|
||||||
close(FILE);
|
my @temp = split(/\,/,$line);
|
||||||
|
|
||||||
# Get IP address of the red interface.
|
# Generate value for enable/disable checkbox.
|
||||||
my $ip = &General::GetDyndnsRedIP;
|
my $sync = "<font color='blue'>";
|
||||||
my $id = 0;
|
my $gif = '';
|
||||||
my $toggle_enabled;
|
my $gdesc = '';
|
||||||
|
|
||||||
foreach my $line (@current) {
|
if ($temp[7] eq "on") {
|
||||||
|
$gif = 'on.gif';
|
||||||
|
$gdesc = $Lang::tr{'click to disable'};
|
||||||
|
$sync = (&General::DyndnsServiceSync ($ip,$temp[1], $temp[2]) ? "<font color='green'>": "<font color='red'>") ;
|
||||||
|
$toggle_enabled = 'off';
|
||||||
|
} else {
|
||||||
|
$gif = 'off.gif';
|
||||||
|
$gdesc = $Lang::tr{'click to enable'};
|
||||||
|
$toggle_enabled = 'on';
|
||||||
|
}
|
||||||
|
|
||||||
# Remove newlines.
|
# Background color.
|
||||||
chomp(@current);
|
my $col="";
|
||||||
my @temp = split(/\,/,$line);
|
|
||||||
|
|
||||||
# Generate value for enable/disable checkbox.
|
if ($settings{'ID'} eq $id) {
|
||||||
my $sync = "<font color='blue'>";
|
$col="bgcolor='${Header::colouryellow}'";
|
||||||
my $gif = '';
|
} elsif (!($temp[0] ~~ @providers)) {
|
||||||
my $gdesc = '';
|
$col="bgcolor='#FF4D4D'";
|
||||||
|
} elsif ($id % 2) {
|
||||||
|
$col="bgcolor='$color{'color20'}'";
|
||||||
|
} else {
|
||||||
|
$col="bgcolor='$color{'color22'}'";
|
||||||
|
}
|
||||||
|
|
||||||
if ($temp[7] eq "on") {
|
# The following HTML Code still is part of the loop.
|
||||||
$gif = 'on.gif';
|
print <<END;
|
||||||
$gdesc = $Lang::tr{'click to disable'};
|
|
||||||
$sync = (&General::DyndnsServiceSync ($ip,$temp[1], $temp[2]) ? "<font color='green'>": "<font color='red'>") ;
|
|
||||||
$toggle_enabled = 'off';
|
|
||||||
} else {
|
|
||||||
$gif = 'off.gif';
|
|
||||||
$gdesc = $Lang::tr{'click to enable'};
|
|
||||||
$toggle_enabled = 'on';
|
|
||||||
}
|
|
||||||
|
|
||||||
# Background color.
|
|
||||||
my $col="";
|
|
||||||
|
|
||||||
if ($settings{'ID'} eq $id) {
|
|
||||||
$col="bgcolor='${Header::colouryellow}'";
|
|
||||||
} elsif (!&General::is_part_of("$temp[0]", @providers)) {
|
|
||||||
$col="bgcolor='#FF4D4D'";
|
|
||||||
} elsif ($id % 2) {
|
|
||||||
$col="bgcolor='$color{'color20'}'";
|
|
||||||
} else {
|
|
||||||
$col="bgcolor='$color{'color22'}'";
|
|
||||||
}
|
|
||||||
|
|
||||||
# The following HTML Code still is part of the loop.
|
|
||||||
print <<END
|
|
||||||
<tr>
|
<tr>
|
||||||
<td align='center' $col><a href='http://$temp[0]'>$temp[0]</a></td>
|
<td align='center' $col><a href='http://$temp[0]'>$temp[0]</a></td>
|
||||||
<td align='center' $col>$sync$temp[1].$sync$temp[2]</td>
|
<td align='center' $col>$sync$temp[1].$sync$temp[2]</td>
|
||||||
@@ -563,14 +562,11 @@ print <<END
|
|||||||
</form></td>
|
</form></td>
|
||||||
</tr>
|
</tr>
|
||||||
END
|
END
|
||||||
;
|
$id++;
|
||||||
$id++;
|
}
|
||||||
}
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
# If table contains entries, print 'Key to action icons'
|
print <<END;
|
||||||
if ($id) {
|
</table>
|
||||||
print <<END
|
|
||||||
<table width='100%'>
|
<table width='100%'>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='boldbase'> <b>$Lang::tr{'legend'}: </b></td>
|
<td class='boldbase'> <b>$Lang::tr{'legend'}: </b></td>
|
||||||
@@ -591,10 +587,10 @@ print <<END
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
END
|
END
|
||||||
;
|
|
||||||
|
&Header::closebox();
|
||||||
}
|
}
|
||||||
|
|
||||||
&Header::closebox();
|
|
||||||
&Header::closebigbox();
|
&Header::closebigbox();
|
||||||
&Header::closepage();
|
&Header::closepage();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user