more port in use stuff

pull/11/head
Squidly271 2022-01-02 09:33:35 -05:00
parent e7e6ff4e3a
commit e32df7b3f4
5 changed files with 29 additions and 22 deletions

View File

@ -1153,7 +1153,10 @@ function uninstallDocker(application,humanName) {
$(menuItem).addClass("selectedMenu");
$(menuItem).next().show("slow");
}
previousApps(true,false,data.previousAppsSection);
post({action:'getPortsInUse'},function(data) {
portsInUse = data.portsInUse;
previousApps(true,false,data.previousAppsSection);
});
});
} else {
enableSearch();

View File

@ -1,9 +1,9 @@
8c0556f3cbebc296709cd3ef7622fae3 ./Apps.page
4a058a16952b7d817d2f30f39ce0c18b ./Apps.page
4e55f7483b661af21a25b677179baffe ./CA_notices.page
c7c6da0a4a4a7ac33f387ea178319bae ./ca_settings.page
ed2883d6c44c19304c431079596a1731 ./default.cfg
afe60a2b41646f7904be1db8c836f851 ./include/exec.php
fb3835932cb817d530eb0fde0c788dc5 ./include/helpers.php
edbb4969472efb9084a8f2e5b8688783 ./include/exec.php
d1309ffcf426230cf8a1f43dd96cb2e0 ./include/helpers.php
d827ebdf8c29aa6a9818df043a37721e ./include/paths.php
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
b398273cf7daa62ab00d2de2336ca25f ./README.md

View File

@ -181,6 +181,9 @@ switch ($_POST['action']) {
case 'search_dockerhub':
search_dockerhub();
break;
case 'getPortsInUse':
postReturn(["portsInUse"=>getPortsInUse()]);
break;
###############################################
# Return an error if the action doesn't exist #
###############################################

View File

@ -690,10 +690,10 @@ function getPortsInUse() {
$bind = $var['BIND_MGT']=='yes';
$list = is_array($addr) ? array_merge(['*'],$addr) : ['*',$addr];
$addr = ipaddr("eth0");
$addr = ca_ipaddr("eth0");
foreach ($output as $line) {
[$ip, $port] = my_explode(':', $line);
[$ip, $port] = ca_explode(':', $line);
if (!in_array($port,$portsInUse) && (!$bind || in_array(plain($ip),$list)))
if ( is_numeric($port) )
$portsInUse[] = $port;
@ -704,24 +704,25 @@ function getPortsInUse() {
####################################################
# Define ipaddr if it doesn't already exist < 6.10 #
####################################################
if (!function_exists('ipaddr')) {
function ipaddr($ethX='eth0') {
global $caPaths;
$net = parse_ini_file($caPaths['network_ini'],true);
$eth = $net[$ethX];
switch ($eth['PROTOCOL:0']) {
case 'ipv4':
return $eth['IPADDR:0'];
case 'ipv6':
return $eth['IPADDR6:0'];
case 'ipv4+ipv6':
return [$eth['IPADDR:0'],$$ethX['IPADDR6:0']];
default:
return $eth['IPADDR:0'];
}
function ca_ipaddr($ethX='eth0') {
global $caPaths;
$net = parse_ini_file($caPaths['network_ini'],true);
$eth = $net[$ethX];
switch ($eth['PROTOCOL:0']) {
case 'ipv4':
return $eth['IPADDR:0'];
case 'ipv6':
return $eth['IPADDR6:0'];
case 'ipv4+ipv6':
return [$eth['IPADDR:0'],$$ethX['IPADDR6:0']];
default:
return $eth['IPADDR:0'];
}
}
function ca_explode($split,$text,$count=2) {
return array_pad(explode($split,$text,$count),$count,'');
}
/**
* @copyright Copyright 2006-2012, Miles Johnson - http://milesj.me
* @license http://opensource.org/licenses/mit-license.php - Licensed under the MIT License