Esempio n. 1
0
} else {
    //from edit page scenario: Reserved IP => DHCP
    //this is going to remove the corresponding reserved ip in static address table
    $macAddr = $deviceInfo['macAddress'];
    $idArr = explode(",", getInstanceIds("Device.DHCPv4.Server.Pool.1.StaticAddress."));
    foreach ($idArr as $key => $value) {
        $macArr["{$value}"] = getStr("Device.DHCPv4.Server.Pool.1.StaticAddress.{$value}.Chaddr");
    }
    foreach ($macArr as $key => $value) {
        if (!strcasecmp($value, $macAddr)) {
            $index = $key;
            break;
        }
    }
    if (isset($index)) {
        delTblObj("Device.DHCPv4.Server.Pool.1.StaticAddress.{$index}.");
    }
    $idArr = explode(",", getInstanceIds("Device.Hosts.Host."));
    unset($macArr);
    // this is very important
    foreach ($idArr as $key => $value) {
        $macArr["{$value}"] = getStr("Device.Hosts.Host.{$value}.PhysAddress");
    }
    foreach ($macArr as $key => $value) {
        if (!strcasecmp($value, $macAddr)) {
            $i = $key;
            break;
        }
    }
    if (isset($i)) {
        setStr("Device.Hosts.Host.{$i}.Comments", $deviceInfo['Comments'], true);
Esempio n. 2
0
<?php

$jsConfig = $_REQUEST['configInfo'];
//$jsConfig = '	{"dest":"Edit", "idex":"1", "name":"tom", "pass":"******"}';
$arConfig = json_decode($jsConfig, true);
//print_r($arConfig);
$id = $arConfig['idex'];
if ("Edit" == $arConfig['dest']) {
    setStr("Device.X_CISCO_COM_FileSharing.User.{$id}.UserName", $arConfig['name'], false);
    setStr("Device.X_CISCO_COM_FileSharing.User.{$id}.Password", $arConfig['pass'], true);
} else {
    if ("Add" == $arConfig['dest']) {
        addTblObj("Device.X_CISCO_COM_FileSharing.User.");
        $ids = array_filter(explode(",", getInstanceIds("Device.X_CISCO_COM_FileSharing.User.")));
        $id = $ids[count($ids) - 1];
        setStr("Device.X_CISCO_COM_FileSharing.User.{$id}.UserName", $arConfig['name'], false);
        setStr("Device.X_CISCO_COM_FileSharing.User.{$id}.Password", $arConfig['pass'], true);
    } else {
        if ("Delete" == $arConfig['dest']) {
            delTblObj("Device.X_CISCO_COM_FileSharing.User.{$id}.");
        }
    }
}
sleep(6);
echo $jsConfig;
<?php

$removeInfo = json_decode($_REQUEST['removeBlockInfo'], true);
delTblObj("Device.X_Comcast_com_ParentalControl.ManagedSites.BlockedSite." . $removeInfo['InstanceID'] . ".");
Esempio n. 4
0
        $retStatus = DmExtSetStrsWithRootObj($rootObjName, TRUE, $paramArray);
        if (!$retStatus) {
            $result = "Success!";
        }
    }
}
if (isset($_POST['active'])) {
    $isChecked = $_POST['isChecked'];
    $i = $_POST['id'];
    if (setStr("Device.NAT.PortMapping.{$i}.Enable", $isChecked, true) === true) {
        $result = "Success!";
    }
}
if (isset($_REQUEST['del'])) {
    delTblObj("Device.NAT.PortMapping." . $_REQUEST['del'] . ".");
    Header("Location:../port_forwarding.php");
    exit;
}
if ($result == "") {
    //the set operation failure due to conflict with port trigger rules or ...
    //so need to remove the '0.0.0.0' entry
    $ids = explode(",", getInstanceIDs("Device.NAT.PortMapping."));
    foreach ($ids as $key => $j) {
        if (getStr("Device.NAT.PortMapping.{$j}.InternalClient") == "0.0.0.0") {
            delTblObj("Device.NAT.PortMapping.{$j}.");
        }
    }
    //end of foreach
}
//end of if
echo json_encode($result);
Esempio n. 5
0
    foreach ($ids as $key => $j) {
        if ($i == $j) {
            continue;
        }
        $deviceName = getStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device.{$j}.Description");
        $accessType = getStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device.{$j}.Type");
        $MACAddress = getStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device.{$j}.MACAddress");
        if ($type == $accessType && !strcasecmp($mac, $MACAddress)) {
            $result .= "This device is already in {$type} list.";
            break;
        }
    }
    if ($result == "") {
        setStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device." . $i . ".Description", $name, false);
        setStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device." . $i . ".MACAddress", $mac, false);
        if ($block == "false") {
            setStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device." . $i . ".StartTime", $_POST['startTime'], false);
            setStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device." . $i . ".EndTime", $_POST['endTime'], false);
            setStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device." . $i . ".BlockDays", $_POST['days'], false);
        }
        setStr("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device." . $i . ".AlwaysBlock", $block, true);
        $result = "Success!";
    }
    header("Content-Type: application/json");
    echo json_encode($result);
}
if (isset($_GET['del'])) {
    delTblObj("Device.X_Comcast_com_ParentalControl.ManagedDevices.Device." . $_GET['del'] . ".");
    Header("Location:../managed_devices.php");
    exit;
}
 $ft = $arConfig['ft'];
 //get all old table instance
 $old_id = array_filter(explode(",", getInstanceIds("Device.WiFi.AccessPoint.{$i}.X_CISCO_COM_MacFilterTable.")));
 //for old table, delete which is not in new table, keep in place which is in it
 foreach ($old_id as $j) {
     $del_mac = true;
     $old_mac = getStr("Device.WiFi.AccessPoint.{$i}.X_CISCO_COM_MacFilterTable.{$j}.MACAddress");
     for ($k = 0; $k < count($ft); $k++) {
         if ($old_mac == $ft[$k][1]) {
             $del_mac = false;
             break;
         }
     }
     if ($del_mac) {
         //if an old mac is not in new table, then delete it from old table
         delTblObj("Device.WiFi.AccessPoint.{$i}.X_CISCO_COM_MacFilterTable.{$j}.");
     } else {
         //or delete the mac from new table, and resort new table(key as 0, 1, 2...)
         array_splice($ft, $k, 1);
     }
 }
 //add enough new instance, but we can't tell which ID is added!!!
 for ($j = 0; $j < count($ft); $j++) {
     addTblObj("Device.WiFi.AccessPoint.{$i}.X_CISCO_COM_MacFilterTable.");
 }
 //get all instance IDs, perhaps contains old IDs
 $new_id = array_filter(explode(",", getInstanceIds("Device.WiFi.AccessPoint.{$i}.X_CISCO_COM_MacFilterTable.")));
 //find the IDs in new table, but not in old table
 $id = array_diff($new_id, $old_id);
 //key the diff array as 0, 1, 2...
 sort($id);
Esempio n. 7
0
        if (!$retStatus) {
            $result = "Success!";
        }
    }
    // echo json_encode($result);
}
if (isset($_POST['active'])) {
    $isChecked = $_POST['isChecked'];
    $i = $_POST['id'];
    setStr("Device.NAT.X_CISCO_COM_PortTriggers.Trigger." . $i . ".Enable", $isChecked, true);
}
if (isset($_GET['del'])) {
    delTblObj("Device.NAT.X_CISCO_COM_PortTriggers.Trigger." . $_GET['del'] . ".");
    Header("Location:../port_triggering.php");
    exit;
}
if ($result == "") {
    //the set operation failure due to conflict with port forwarding rules or ...
    //so need to remove the '0~0,0~0' entry
    $ids = explode(",", getInstanceIDs("Device.NAT.X_CISCO_COM_PortTriggers.Trigger."));
    foreach ($ids as $key => $j) {
        $tport_start = getStr("Device.NAT.X_CISCO_COM_PortTriggers.Trigger.{$j}.TriggerPortStart");
        $fport_start = getStr("Device.NAT.X_CISCO_COM_PortTriggers.Trigger.{$j}.ForwardPortStart");
        if ($tport_start == 0 && $tport_start == $fport_start) {
            delTblObj("Device.NAT.X_CISCO_COM_PortTriggers.Trigger.{$j}.");
        }
    }
    //end of foreach
}
//end of if
echo json_encode($result);
Esempio n. 8
0
function DmDelObj($objName)
{
    return delTblObj($objName);
}