function getPort4XHSEnabled() { $rootObjName = "Device.X_CISCO_COM_MultiLAN."; $paramNameArray = array("Device.X_CISCO_COM_MultiLAN."); $mapping_array = array("PrimaryLANBridge", "PrimaryLANBridgeHSPorts", "HomeSecurityBridge", "HomeSecurityBridgePorts"); $multiLan = getParaValues($rootObjName, $paramNameArray, $mapping_array); if (!empty($multiLan)) { $pLanBridgeHSPortEnable = getStr($multiLan[0]["PrimaryLANBridge"] . ".Port." . $multiLan[0]["PrimaryLANBridgeHSPorts"] . ".Enable"); $HSBridgePortEnable = getStr($multiLan[0]["HomeSecurityBridge"] . ".Port." . $multiLan[0]["HomeSecurityBridgePorts"] . ".Enable"); return $pLanBridgeHSPortEnable === 'false' && $HSBridgePortEnable === 'true'; } return false; }
$Hotspot_1_clientsNum = count($Hotspot_1_idAr) - 1; } //$Hotspot_1_clientsNum = getStr("Device.X_COMCAST_COM_GRE.SSID.1.AssociatedDeviceNumberOfEntries"); if (!empty($Hotspot_1_clientsNum)) { $Hostspot_1_clients = getParaValues($rootObjName, $paramNameArray, $mapping_array); } $rootObjName = "Device.X_COMCAST_COM_GRE.SSID.2.AssociatedDevice."; $paramNameArray = array($rootObjName); $Hotspot_2_idAr = DmExtGetInstanceIds($rootObjName); if (0 == $Hotspot_2_idAr[0]) { // status code 0 = success $Hotspot_2_clientsNum = count($Hotspot_2_idAr) - 1; } //$Hotspot_2_clientsNum = getStr("Device.X_COMCAST_COM_GRE.SSID.2.AssociatedDeviceNumberOfEntries"); if (!empty($Hotspot_2_clientsNum)) { $Hostspot_2_clients = getParaValues($rootObjName, $paramNameArray, $mapping_array); } $Hotspot_clients = array_merge($Hostspot_1_clients, $Hostspot_2_clients); $clients_num = count($Hotspot_clients); //dump($Hotspot_clients); ?> <div class="module forms data div-pub-network" style="position:relative; top:10px; "> <h2>Online Devices-xfinitywifi SSID</h2> <table class="data" summary="this table displays online devices connected to xfinitywifi SSID"> <tr> <th id="xfinitywifi-host-name" width="30%">Host Name</th> <th id="xfinitywifi-ipv4-address" width="30%">IPV4 Address</th> <th id="xfinitywifi-rssi-level" width="20%">RSSI Level</th> <th id="xfinitywifi-mac-address" width="20%">MAC Address</th> <th id="xfinitywifi-disconnect-button" width="20%"></th>
</div> <!-- end .module --> <div id="internet-usage" class="module block"> <h2>Connected Devices</h2> <?php if ("Disabled" == $_SESSION["psmMode"]) { $rootObjName = "Device.Hosts.Host."; $paramNameArray = array("Device.Hosts.Host."); $mapping_array = array("PhysAddress", "HostName", "Active"); $HostIndexArr = DmExtGetInstanceIds("Device.Hosts.Host."); if (0 == $HostIndexArr[0]) { // status code 0 = success $HostNum = count($HostIndexArr) - 1; } if (!empty($HostNum)) { $Host = getParaValues($rootObjName, $paramNameArray, $mapping_array); //this is to construct host info array $j = 1; if (!empty($Host)) { foreach ($Host as $key => $value) { if (!strcasecmp("true", $value['Active'])) { $HostInfo[$j]['HostName'] = $value['HostName']; $HostInfo[$j]['Active'] = $value['Active']; $HostInfo[$j]['PhysAddress'] = $value['PhysAddress']; $j += 1; } } // end of foreach for ($i = 1; $i < $j; $i++) { if ($i % 2) { $divClass = "form-row ";
<?php require_once "../includes/utility.php"; session_start(); $opType = $_POST['op']; $r_enable = $_POST['enable']; try { if (!in_array($opType, array('savePort4XHS'), true) || $opType === 'savePort4XHS' && !isset($r_enable)) { throw new Exception('Parameters are incompleted'); } $response = array(); /* get the flag path first */ $rootObjName = "Device.X_CISCO_COM_MultiLAN."; $paramNameArray = array("Device.X_CISCO_COM_MultiLAN."); $mapping_array = array("PrimaryLANBridge", "PrimaryLANBridgeHSPorts", "HomeSecurityBridge", "HomeSecurityBridgePorts"); $multiLan = getParaValues($rootObjName, $paramNameArray, $mapping_array); if (empty($multiLan)) { throw new Exception('failed to fetch parameters from backend'); } $pLanBridgeHSPortEnablePath = $multiLan[0]["PrimaryLANBridge"] . ".Port." . $multiLan[0]["PrimaryLANBridgeHSPorts"] . ".Enable"; $HSBridgePortEnablePath = $multiLan[0]["HomeSecurityBridge"] . ".Port." . $multiLan[0]["HomeSecurityBridgePorts"] . ".Enable"; if (empty($pLanBridgeHSPortEnablePath) || empty($HSBridgePortEnablePath)) { throw new Exception('failed to fetch parameters from backend'); } if ($r_enable === 'true') { if (setStr($pLanBridgeHSPortEnablePath, "false", true) !== true || setStr($HSBridgePortEnablePath, "true", true) !== true) { throw new Exception('failed to set parameters to backend'); } } else { if (setStr($pLanBridgeHSPortEnablePath, "true", true) !== true || setStr($HSBridgePortEnablePath, "false", true) !== true) { throw new Exception('failed to set parameters to backend');
<h2>HS Port Forwarding</h2> <p class="button"><a tabindex='0' href="hs_port_forwarding_add.php" class="btn" id="add-port-forward">+ Add Port Forward</a></p> <table class="data" summary="This table lists home security port forwarding entries"> <tr> <th id="service-name">Service Name</th> <th id="service-type">Type</th> <th id="public-port">Public Port</th> <th id="private-port">Private Port</th> <th id="server-ip">Server IP</th> <th id="active">Active</th> </tr> <?php $rootObjName = "Device.NAT.PortMapping."; $paramNameArray = array("Device.NAT.PortMapping."); $mapping_array = array("LeaseDuration", "InternalPort", "Protocol", "Description", "ExternalPort", "ExternalPortEndRange", "InternalClient", "Enable"); $resArray = getParaValues($rootObjName, $paramNameArray, $mapping_array, true); if ($_DEBUG) { $resArray = array(array('Protocol' => 'TCP', 'Enable' => 'true', 'Description' => 'services 1', 'ExternalPort' => 666, 'InternalPort' => 22, 'InternalClient' => '172.16.12.2', 'LeaseDuration' => 0), array('Protocol' => 'BOTH', 'Enable' => 'true', 'Description' => 'services 2', 'ExternalPort' => 366, 'InternalPort' => 25, 'InternalClient' => '172.16.12.22', 'LeaseDuration' => 0)); } //dump($resArray); if (!empty($resArray)) { $iclass = ""; foreach ($resArray as $hspf_entry) { if ($hspf_entry['LeaseDuration'] === '0' && $hspf_entry['InternalPort'] !== '0') { $id = $hspf_entry['__id']; $iclass = $iclass === "" ? "odd" : ""; $hspf_entry['Protocol'] === "BOTH" && ($hspf_entry['Protocol'] = "TCP/UDP"); $checked = $hspf_entry['Enable'] === "true" ? "checked" : ""; echo "<tr class={$iclass}>"; echo "<td headers='service-name'>" . $hspf_entry['Description'] . "</td>"; echo "<td headers='service-type'>" . $hspf_entry['Protocol'] . "</td>";