Gateway Widget - Table Size Change Fix

Fix gateway widget size change on first update.

Inner table size changes on the first update because the table in update data does not have the same attributes as the widget.  i.e. border, cellpadding, cellspacing,  style & summary.

Also remove an errant td end tag.


Populate gateway address field with tilde if there is no address or friendly interface.
This is to match the update data.
According to PHP documentation empty() will consider not only “” to be empty, as desired, but also 0 (as an integer), 0.0 (as a float), and “0” (as a string).  So if there was a friendly interface “0” it would be considered empty.  Even though it really is not.

What we really want is to echo the tilde when friendly interface for both IPv4 and IPv6 are both blank.

There is no necessity for the htmlspecialchars() call other than consistency, but doesn’t hurt anything.  Easy enough to remove.


From: Renato Botelho 
Sent: Thursday, June 12, 2014 9:16 AM
To: pfsense/pfsense 
Cc: N0YB 
Subject: Re: [pfsense] Gateway Widget - Table Size Change Fix (#1232)

In usr/local/www/widgets/widgets/gateways.widget.php:

> @@ -78,6 +78,8 @@
>  								echo htmlspecialchars(get_interface_gateway($gateway['friendlyiface']));
>  							if($gateway['ipprotocol'] == "inet6")
>  								echo htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface']));
> +							if( (htmlspecialchars(get_interface_gateway($gateway['friendlyiface'])) == '') && (htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface'])) == '') )
> +								echo htmlspecialchars("~");
Why call htmlspecialchars() for a fixed string? Also, it would be better to check if string is empty before echo above

—
Reply to this email directly or view it on GitHub.