Example #1
0
<?php

/* extern parameters: $ACTION, $ENDCODE, $VALUE */
include "/htdocs/neap/NEAP_LIB.php";
include "/htdocs/webinc/config.php";
$set_value = $VALUE;
$get_value = "";
$uid = $LAN1;
$inet = INET_getpathbyinf($uid);
$ipv4 = $inet . "/ipv4";
if ($ENDCODE == "1") {
    $path = $ipv4 . "/ipaddr";
    $get_value = query($path);
} else {
    if ($ENDCODE == "2") {
        $path = $ipv4 . "/mask";
        $mask = query($path);
        $get_value = ipv4int2mask($mask);
        $set_value = ipv4mask2int($set_value);
    }
}
NEAP_action($ACTION, $path, $get_value, $set_value);
Example #2
0
function pptp_l2tp_func($waninf, $wan2inf, $over, $ACTION, $ENDCODE, $VALUE)
{
    $path = "";
    $get_value = "";
    $set_value = $VALUE;
    $uid = $wan2inf;
    $inetp = INET_getpathbyinf($uid);
    $addrtype_path = $inetp . "/ipv4";
    $infp = XNODE_getpathbytarget("", "inf", "uid", $waninf, "0");
    set($infp . "/lowerlayer", "WAN-2");
    $infp = XNODE_getpathbytarget("", "inf", "uid", $wan2inf, "0");
    set($infp . "/active", 1);
    set($infp . "/upperlayer", "WAN-1");
    set($infp . "/defaultroute", "");
    if ($over == "pptp") {
        set($infp . "/nat", "");
    }
    if ($ENDCODE == "1") {
        $node = "/static";
        $path = $addrtype_path . $node;
        $static = query($path);
        $get_value = pptp_static_get($static);
        $set_value = pptp_static_set($set_values);
    } else {
        if ($ENDCODE == "2") {
            $node = "/ipaddr";
            $path = $addrtype_path . $node;
            $get_value = query($path);
        } else {
            if ($ENDCODE == "3") {
                $node = "/mask";
                $path = $addrtype_path . $node;
                $mask = query($path);
                if ($mask != "") {
                    $get_value = ipv4int2mask($mask);
                }
                $set_value = ipv4mask2int($set_value);
            } else {
                if ($ENDCODE == "4") {
                    $node = "/gateway";
                    $path = $addrtype_path . $node;
                    $get_value = query($path);
                } else {
                    if ($ENDCODE == "5") {
                        $uid = $waninf;
                        $inetp = INET_getpathbyinf($uid);
                        $path = $inetp . "/ppp4/" . $over . "/server";
                        $get_value = query($path);
                    }
                }
            }
        }
    }
    NEAP_action($ACTION, $path, $get_value, $set_value);
}