function save() { $sock = new sockets(); $sock->SET_INFO("EnableDHCPServer", $_GET["EnableDHCPServer"]); $dhcp = new dhcpd(); $pxe_enable = $_GET["pxe_enable"]; if ($dhcp->listen_nic == null) { $eth = GetMyNicDefault(); $dhcp->listen_nic = $eth; } else { $eth = $dhcp->listen_nic; } if ($pxe_enable == 1) { if ($dhcp->pxe_server == null) { $dhcp->pxe_server = GetMyIpDefault($eth); $dhcp->pxe_file = "/pxe/pxelinux.0"; } } $dhcp->pxe_enable = $pxe_enable; $sock->SET_INFO("EnableDHCPFixPxeThinClient", $pxe_enable); if ($dhcp->gateway == null) { $dhcp->gateway = GetMyDefaultGateway($eth); } if ($dhcp->range1 == null) { $dhcp->range1 = GetMyRange($eth) . ".10"; } if ($dhcp->range2 == null) { $dhcp->range1 = GetMyRange($eth) . ".250"; } $dnss = unserialize(base64_decode($sock->getFrameWork("cmd.php?ip-get-default-dns=yes"))); if ($dhcp->DNS_1 == null) { $dhcp->DNS_1 = $dnss[0]; } if ($dhcp->DNS_2 == null) { $dhcp->DNS_2 = $dnss[1]; } $dhcp->Save(); }
function BuildDHCP() { $dhcpd = new dhcpd(); $dhcpd->BuildConf(); $dhcpd->Save(); }
function gateway_save() { $sock = new sockets(); $tpl = new templates(); $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement"); if ($DisableNetworksManagement == null) { $DisableNetworksManagement = 0; } if ($DisableNetworksManagement == 1) { echo $ERROR_NO_PRIVS; return; } $sock = new sockets(); $sock->SET_INFO("EnableArticaAsGateway", $_GET["EnableArticaAsGateway"]); if ($_GET["EnableArticaAsGateway"] == 1) { $sock->getFrameWork("cmd.php?sysctl-setvalue=1&key=" . base64_encode("net.ipv4.ip_forward")); } $dhcp = new dhcpd(); $dhcp->Save(); }
function wizard() { build_progress("{enable_service}", 5); $sock = new sockets(); $sock->SET_INFO("EnableDHCPServer", 1); $DHCPWizard = unserialize($sock->GET_INFO("DHCPWizard")); $dhcp = new dhcpd(0, 1); echo "Listen nic: {$DHCPWizard["NIC"]}\n"; echo "Network: {$DHCPWizard["SUBNET"]}/{$DHCPWizard["NETMASK"]} {$DHCPWizard["RANGE1"]}-{$DHCPWizard["RANGE2"]}\n"; if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.#", $DHCPWizard["SUBNET"], $re)) { $DHCPWizard["SUBNET"] = "{$re[1]}.{$re[2]}.{$re[3]}.0"; } $dhcp->listen_nic = $DHCPWizard["NIC"]; $dhcp->ddns_domainname = $DHCPWizard["DOMAINNAME"]; $dhcp->netmask = $DHCPWizard["NETMASK"]; $dhcp->range1 = $DHCPWizard["RANGE1"]; $dhcp->range2 = $DHCPWizard["RANGE2"]; $dhcp->subnet = $DHCPWizard["SUBNET"]; $dhcp->gateway = $DHCPWizard["GATEWAY"]; $dhcp->DNS_1 = $DHCPWizard["DNS1"]; $dhcp->DNS_2 = $DHCPWizard["DNS2"]; build_progress("{save_configuration}", 10); $dhcp->Save(true); build_progress("{stopping_service}", 15); stop(true); build_progress("{starting_service}", 60); if (!start(true)) { build_progress("{starting_service} {failed}", 110); $sock->SET_INFO("EnableDHCPServer", 0); return; } build_progress("{starting_service} {success}", 100); }
function gateway_save(){ $sock=new sockets(); $tpl=new templates(); $ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement"); if($DisableNetworksManagement==null){$DisableNetworksManagement=0;} if($DisableNetworksManagement==1){echo $ERROR_NO_PRIVS;return;} $artica=new artica_general(); $artica->EnableArticaAsGateway=$_GET["EnableArticaAsGateway"]; $artica->Save(); $dhcp=new dhcpd(); $dhcp->Save(); }
function dhcp_save() { $sock = new sockets(); $tpl = new templates(); $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement"); if ($DisableNetworksManagement == null) { $DisableNetworksManagement = 0; } if ($DisableNetworksManagement == 1) { echo $ERROR_NO_PRIVS; return; } $dhcp = new dhcpd(0, 1); $sock = new sockets(); $sock->SET_INFO('EnableDHCPServer', $_GET["EnableDHCPServer"]); $sock->SET_INFO('EnableDHCPUseHostnameOnFixed', $_GET["EnableDHCPUseHostnameOnFixed"]); $sock->SET_INFO("IncludeDHCPLdapDatabase", $_GET["IncludeDHCPLdapDatabase"]); $dhcp->deny_unkown_clients = $_GET["deny_unkown_clients"]; $dhcp->ddns_domainname = $_GET["ddns_domainname"]; $dhcp->max_lease_time = $_GET["max_lease_time"]; $dhcp->get_lease_hostnames = $_GET["get_lease_hostnames"]; $dhcp->netmask = $_GET["netmask"]; $dhcp->range1 = $_GET["range1"]; $dhcp->range2 = $_GET["range2"]; $dhcp->subnet = $_GET["subnet"]; $dhcp->broadcast = $_GET["broadcast"]; $dhcp->WINS = $_GET["WINS"]; $dhcp->ping_check = $_GET["DHCPPing_check"]; $dhcp->authoritative = $_GET["DHCPauthoritative"]; $dhcp->local_pac_server = $_GET["local-pac-server"]; $dhcp->browser_portal_page = $_GET["browser-portal-page"]; $tpl = new templates(); $dhcp->gateway = $_GET["gateway"]; $dhcp->DNS_1 = $_GET["DNS_1"]; $dhcp->DNS_2 = $_GET["DNS_2"]; $dhcp->ntp_server = $_GET["ntp_server"]; $dhcp->EnableArticaAsDNSFirst = $_GET["EnableArticaAsDNSFirst"]; $dhcp->do_no_verify_range = $_GET["do_no_verify_range"]; $dhcp->Save(); }
function gateway_save() { $artica = new artica_general(); $artica->EnableArticaAsGateway = $_GET["EnableArticaAsGateway"]; $artica->Save(); $dhcp = new dhcpd(); $dhcp->Save(); }