summaryrefslogtreecommitdiffstats
path: root/usr/local/www/status_upnp.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-05-14 12:18:39 +0545
committerPhil Davis <phil.davis@inf.org>2015-05-14 12:18:39 +0545
commit037d118f176e7ae125b17924003141c185474984 (patch)
treeaa2a3027515c33b0af9a10159cbeee0bc6217a79 /usr/local/www/status_upnp.php
parent01cced787ca98e9017e339526912865570cf8e17 (diff)
downloadpfsense-037d118f176e7ae125b17924003141c185474984.zip
pfsense-037d118f176e7ae125b17924003141c185474984.tar.gz
Cleanup code logic status_upnp
1) Variable $i is was set, incremented and not used. 2) "if preg_match" at line 94 had no curlies after it, so it was only applying to the first line after it ($rdr_proto = ...) It really looks like "if preg_match"should apply to the whole code chunk - settings the various "rdr*" vars and then spitting out the "tr" with the various matches values in the row. Somebody with some various UPnP enabled and running should test this to see if the status page still works with this change. I think it only makes a difference if $rdr_entries has some lines in it that do not match the regex - in that case the old code might have displayed some rubbish or (almost?) duplicated rows.
Diffstat (limited to 'usr/local/www/status_upnp.php')
-rw-r--r--usr/local/www/status_upnp.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr/local/www/status_upnp.php b/usr/local/www/status_upnp.php
index a04850f..0d74690 100644
--- a/usr/local/www/status_upnp.php
+++ b/usr/local/www/status_upnp.php
@@ -90,14 +90,15 @@ if(!$config['installedpackages'] || !$config['installedpackages']['miniupnpd']['
<td width="10%" class="listhdrr"><?=gettext("Int. Port");?></td>
<td width="50%" class="listhdr"><?=gettext("Description");?></td>
</tr>
- <?php $i = 0; foreach ($rdr_entries as $rdr_entry) {
- if (preg_match("/on (.*) inet proto (.*) from any to any port = (.*) keep state label \"(.*)\" rtable [0-9] -> (.*) port (.*)/", $rdr_entry, $matches))
+<?php
+ foreach ($rdr_entries as $rdr_entry) {
+ if (preg_match("/on (.*) inet proto (.*) from any to any port = (.*) keep state label \"(.*)\" rtable [0-9] -> (.*) port (.*)/", $rdr_entry, $matches)) {
$rdr_proto = $matches[2];
$rdr_port = $matches[3];
$rdr_label =$matches[4];
$rdr_ip = $matches[5];
$rdr_iport = $matches[6];
- ?>
+?>
<tr>
<td class="listlr">
<?php print $rdr_port;?>
@@ -115,7 +116,10 @@ if(!$config['installedpackages'] || !$config['installedpackages']['miniupnpd']['
<?php print $rdr_label;?>
</td>
</tr>
- <?php $i++; }?>
+<?php
+ }
+ }
+?>
</table>
</td>
</tr>
OpenPOWER on IntegriCloud