From: <abe...@us...> - 2013-07-24 16:53:11
|
Revision: 6153 http://sourceforge.net/p/astlinux/code/6153 Author: abelbeck Date: 2013-07-24 16:53:09 +0000 (Wed, 24 Jul 2013) Log Message: ----------- web interface, Status tab, sort IPv4 addresses in a natural mannor Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/dnshosts.php branches/1.0/package/webinterface/altweb/common/functions.php branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/admin/dnshosts.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/dnshosts.php 2013-07-24 05:04:34 UTC (rev 6152) +++ branches/1.0/package/webinterface/altweb/admin/dnshosts.php 2013-07-24 16:53:09 UTC (rev 6153) @@ -65,23 +65,6 @@ return(11); } -// Function: pad_ipv4_str -// -function pad_ipv4_str($ip) { - $str = $ip; - - if (strpos($ip, ':') === FALSE && strpos($ip, '.') !== FALSE) { - $tokens = explode('.', $ip); - if (count($tokens) == 4) { - $str = str_pad($tokens[0], 3, '0', STR_PAD_LEFT).'.'. - str_pad($tokens[1], 3, '0', STR_PAD_LEFT).'.'. - str_pad($tokens[2], 3, '0', STR_PAD_LEFT).'.'. - str_pad($tokens[3], 3, '0', STR_PAD_LEFT); - } - } - return($str); -} - // Function: parseDNSHOSTSconf // function parseDNSHOSTSconf($vars) { Modified: branches/1.0/package/webinterface/altweb/common/functions.php =================================================================== --- branches/1.0/package/webinterface/altweb/common/functions.php 2013-07-24 05:04:34 UTC (rev 6152) +++ branches/1.0/package/webinterface/altweb/common/functions.php 2013-07-24 16:53:09 UTC (rev 6153) @@ -715,6 +715,23 @@ return($menuitems); } +// Function: pad_ipv4_str +// +function pad_ipv4_str($ip) { + $str = $ip; + + if (strpos($ip, ':') === FALSE && strpos($ip, '.') !== FALSE) { + $tokens = explode('.', $ip); + if (count($tokens) == 4) { + $str = str_pad($tokens[0], 3, '0', STR_PAD_LEFT).'.'. + str_pad($tokens[1], 3, '0', STR_PAD_LEFT).'.'. + str_pad($tokens[2], 3, '0', STR_PAD_LEFT).'.'. + str_pad($tokens[3], 3, '0', STR_PAD_LEFT); + } + } + return($str); +} + // Function: compressIPV6addr // function compressIPV6addr($addr) { Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2013-07-24 05:04:34 UTC (rev 6152) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2013-07-24 16:53:09 UTC (rev 6153) @@ -382,7 +382,7 @@ // Sort by IP Address if ($cid > 1) { foreach ($status['clients'] as $key => $row) { - $ip[$key] = $row['ip']; + $ip[$key] = pad_ipv4_str($row['ip']); } array_multisort($ip, SORT_ASC, SORT_STRING, $status['clients']); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |