function WAN_network_status($uid) { $infp = XNODE_getpathbytarget("runtime", "inf", "uid", $uid, "0"); $inetp = $infp . "/inet"; $addrtype = query($inetp . "/addrtype"); $addrtype_path = $inetp . "/" . $addrtype; $valid = query($addrtype_path . "/valid"); $linkstatus = WAN_cable_status($uid); if ($valid == 1 && $linkstatus != "") { return 1; } else { return 0; } }
if ($static == 1) { $get_value = "0"; } else { $get_value = "2"; } } else { $over = query($inetp . "/ppp4/over"); if ($over == "eth") { $get_value = "1"; } else { $get_value = "0"; } } } else { if ($ENDCODE == "2") { $cable_status = WAN_cable_status($uid); if ($cable_status == "") { $get_value = 0; } else { if ($cable_status == "100F") { $get_value = 1; } else { if ($cable_status == "100H") { $get_value = 2; } else { if ($cable_status == "10F") { $get_value = 3; } else { if ($cable_status == "10H") { $get_value = 4; }