function DnsMasqMxMove() { $cf = new dnsmasq(); $newarrar = array_move_element($cf->array_mxhost, $cf->array_mxhost[$_GET["DnsMasqMxMove"]], $_GET["move"]); $cf->array_mxhost = $newarrar; $cf->SaveConf(); }
function ApplyConfigDns() { $prod = "dns_main_settings"; include_once "ressources/class.dnsmasq.inc"; include_once "ressources/class.system.network.inc"; $users = new usersMenus(); $dnsfile = "/etc/resolv.conf"; if ($users->dnsmasq_installed == true) { $dnsmasq = new dnsmasq(); writelogs("DNSMASQ:: no resolv= " . $dnsmasq->main_array["no-resolv"], __FUNCTION__, __FILE__); //verify if dnsmasq is enabled if ($dnsmasq->main_array["no-resolv"] == 'justkey') { $dnsfile = "/etc/resolv.conf"; } else { $dnsfile = $dnsmasq->main_array["resolv-file"]; } if ($dnsfile == null) { $dnsfile = "/etc/resolv.conf"; } } writelogs("RESOLV:: = {$dnsfile}", __FUNCTION__, __FILE__); $net = new networking(); $net->SaveResolvconf($dnsfile); if ($users->dnsmasq_installed == true) { $dnsmasq->SaveConfToServer(); } //inadyn $sock = new sockets(); $sock->getfile("perform_inadyn"); $tpl = new templates(); echo $tpl->_ENGINE_parse_body(Success($prod)); }
function page_localdomains_search() { $conf = new dnsmasq(); $tpl = new templates(); $page = CurrentPageName(); $Params = $conf->ARTICA_ARRAY["LOCALNET"]; if (count($Params) == 0) { $ldap = new clladp(); $hash = $ldap->AllDomains(); $hash["localdomain"] = "localdomain"; $hash["localhost.localdomain"] = "localhost.localdomain"; while (list($key, $line) = each($hash)) { $conf->ARTICA_ARRAY["LOCALNET"][$key] = 0; } $conf->SaveConf(); } $data = array(); $data['page'] = 0; $data['total'] = count($conf->ARTICA_ARRAY["LOCALNET"]); $data['rows'] = array(); $search = null; ksort($conf->ARTICA_ARRAY["LOCALNET"]); $search = string_to_flexregex(); while (list($domain, $enabled) = each($conf->ARTICA_ARRAY["LOCALNET"])) { if ($search != null) { if (!preg_match("#{$search}#", $domain)) { continue; } } $domain_plus = null; $md5 = md5($domain); $enable = Field_checkbox($md5, 1, $enabled, "DnsMasqLocalDomainEnable('{$domain}','{$md5}')"); $delete = imgtootltip("delete-32.png", "{delete} {$domain}", "DnsMasqLocalDomainDelete('{$domain}')"); $color = "black"; if ($enabled == 0) { $color = "#D0D0D0"; } if (isset($conf->ARTICA_ARRAY["RRDNS"][$domain])) { $domain_plus = " »»<i>{$conf->ARTICA_ARRAY["RRDNS"][$domain]}</i>"; } $data['rows'][] = array('id' => $md5, 'cell' => array("<span style='font-size:22px;color:{$color}'>{$domain}{$domain_plus}</span>", $enable, $delete)); } echo json_encode($data); }
function DnsmasqDeleteListenAddress() { $index = $_GET["DnsmasqDeleteListenAddress"]; $conf = new dnsmasq(); unset($conf->array_listenaddress[$index]); $conf->SaveConf(); }
function Loadaddresses() { $conf = new dnsmasq(true); $conf->ldap_addesses(); $conf->ParseAddress(); $page = 1; if (!is_array($conf->array_address)) { json_error_show("no row"); } if (count($conf->array_address) == 0) { json_error_show("no row"); } if ($_POST["query"] != null) { $_POST["query"] = str_replace(".", "\\.", $_POST["query"]); $_POST["query"] = str_replace("*", ".*", $_POST["query"]); } if ($_POST["qtype"] == "hosts") { $regexHost = $_POST["query"]; } else { $regexIP = $_POST["query"]; } $c = 0; while (list($index, $line) = each($conf->array_address)) { if ($regexHost != null) { if (!preg_match("#{$regexHost}#", $index)) { continue; } } if ($regexIP != null) { if (!preg_match("#{$regexIP}#", $line)) { continue; } } $md5 = md5("{$index}{$line}"); $c++; $delete = imgtootltip('delete-32.png', '{delete}', "DnsmasqDeleteAddress('{$md5}','{$index}');"); $data['rows'][] = array('id' => $md5, 'cell' => array("<span style='font-size:16px;font-weight:bold'>{$index}</a></span>", "<span style='font-size:16px'>{$line}</a></span>", $delete)); } if ($c == 0) { json_error_show("no row"); } $data['page'] = $page; $data['total'] = $c; echo json_encode($data); }
function DnsmasqDeleteAddress() { $conf = new dnsmasq(); unset($conf->array_address[$_GET["DnsmasqDeleteAddress"]]); $conf->SaveConf(); }
function interfaces_add() { $conf = new dnsmasq(); $conf->array_interface[] = $_POST["interfaces"]; $conf->SaveConf(); }
<?php if (posix_getuid() != 0) { die("Cannot be used in web server mode\n\n"); } include_once dirname(__FILE__) . '/ressources/class.ldap.inc'; include_once dirname(__FILE__) . '/ressources/class.dnsmasq.inc'; include_once dirname(__FILE__) . '/framework/class.unix.inc'; include_once dirname(__FILE__) . "/framework/frame.class.inc"; $GLOBALS["AS_ROOT"] = true; if (preg_match("#--verbose#", implode(" ", $argv))) { $GLOBALS["VERBOSE"] = true; } if (preg_match("#--force#", implode(" ", $argv))) { $GLOBALS["FORCE"] = true; } $dnsmasq = new dnsmasq(); $dnsmasq->SaveConfToServer();
function restart_dnsmasq() { $user = new usersMenus(); $sock = new sockets(); if (!$user->dnsmasq_installed) { return; } $EnableDNSMASQLDAPDB = $sock->GET_INFO("EnableDNSMASQLDAPDB"); if (!is_numeric($EnableDNSMASQLDAPDB)) { $EnableDNSMASQLDAPDB = 0; } if ($EnableDNSMASQLDAPDB == 0) { return null; } include_once dirname(__FILE__) . "/ressources/class.dnsmasq.inc"; $dnsmasq = new dnsmasq(); $dnsmasq->SaveConfToServer(); }
function page_localdomains_search() { $conf = new dnsmasq(); $tpl = new templates(); $page = CurrentPageName(); $Params = $conf->ARTICA_ARRAY["LOCALNET"]; if (count($Params) == 0) { $ldap = new clladp(); $hash = $ldap->AllDomains(); $hash["localdomain"] = "localdomain"; $hash["localhost.localdomain"] = "localhost.localdomain"; while (list($key, $line) = each($hash)) { $conf->ARTICA_ARRAY["LOCALNET"][$key] = 0; } $conf->SaveConf(); } $data = array(); $data['page'] = 0; $data['total'] = count($conf->ARTICA_ARRAY["LOCALNET"]); $data['rows'] = array(); $search = null; ksort($conf->ARTICA_ARRAY["LOCALNET"]); if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", ".*?", $_POST["query"]); $search = $_POST["query"]; } while (list($domain, $enabled) = each($conf->ARTICA_ARRAY["LOCALNET"])) { if ($search != null) { if (!preg_match("#{$search}#", $domain)) { continue; } } $md5 = md5($domain); $enable = Field_checkbox($md5, 1, $enabled, "DnsMasqLocalDomainEnable('{$domain}','{$md5}')"); $delete = imgtootltip("delete-24.png", "{delete} {$domain}", "DnsMasqLocalDomainDelete('{$domain}')"); $color = "black"; if ($enabled == 0) { $color = "#D0D0D0"; } writelogs("{$ligne["ID"]} => {$ligne["rulename"]}", __FUNCTION__, __FILE__, __LINE__); $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:18px;color:{$color}'>{$domain}</span>", $enable, $delete)); } echo json_encode($data); }