Beispiel #1
0
                $port = "";
            }
            $source = $_POST['source'];
            $destination = $_POST['destination'];
            if ($src_ip) {
                $source = $source . ':' . $src_ip;
            }
            if ($dest_port) {
                $destination = $destination . ":" . $dest_ip . ":" . $dest_port;
            } else {
                $destination = $destination . ":" . $dest_ip;
            }
            addRule($action, $source, $destination, $proto, $port);
            if (!isXMLRPCError()) {
                $n = new NotifyWidgetSuccess(_T("Rule added."));
                handleServicesModule($n, array("shorewall" => _T("Firewall")));
                header("Location: " . urlStrRedirect("shorewall/shorewall/" . $page));
                exit;
            } else {
                new NotifyWidgetFailure(_T("Failed to add the rule."));
            }
        }
    } else {
        new NotifyWidgetFailure(_T("Service must be specified."));
    }
}
if (isset($_POST['brestart'])) {
    redirectTo(urlStrRedirect("shorewall/shorewall/restart_service", array("page" => $page)));
}
// Display policy form
$p = new PageGenerator(_T("Policy", "shorewall"));
Beispiel #2
0
        setSubnetStatement($subnet, $name, $value);
    }
    setSubnetAuthoritative($subnet, isset($_POST["authoritative"]));
    /* Create or update the DHCP pools */
    $poolsRanges = isset($_POST["hassubnetpools"]) ? $poolsRanges : array();
    setPoolsRanges($subnet, $poolsRanges);
    if (!isXMLRPCError()) {
        if (isset($_POST["badd"])) {
            $n = new NotifyWidgetSuccess(_T("Subnet successfully added. You must restart the DHCP service."));
        } else {
            if (isset($_POST["bedit"])) {
                $n = new NotifyWidgetSuccess(_T("Subnet successfully modified. You must restart the DHCP service."));
            }
        }
        $services = getServicesNames();
        handleServicesModule($n, array($services[1] => "DHCP"));
        redirectTo(urlStrRedirect("network/network/subnetindex"));
    }
}
if (isset($error)) {
    new NotifyWidgetFailure($error);
    $subnet = $_POST["subnet"];
    $netmask = $_POST["netmask"];
    $hasSubnetPools = count($poolsRanges) ? "checked" : "";
}
if ($_GET["action"] == "subnetedit" && !isset($error)) {
    $subnetInfos = getSubnet($_GET["subnet"]);
    $subnet = $subnetInfos[0][1]["cn"][0];
    $netmask = $subnetInfos[0][1]["dhcpNetMask"][0];
    $description = $subnetInfos[0][1]["dhcpComments"][0];
    $options = getSubnetOptions($subnetInfos);
Beispiel #3
0
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require "modules/squid/includes/squid.inc.php";
if (isset($_POST["btdell"])) {
    delElementInList($list, $_POST["eltdata"]);
    $serviceName = getServiceName();
    $n = new NotifyWidgetSuccess(_T("Item deleted.", "squid"));
    handleServicesModule($n, array($serviceName => _T("Proxy", "squid")), "reload");
    redirectTo(urlStrRedirect($page));
}
if (isset($_GET["eltdata"])) {
    $data = urldecode($_GET["eltdata"]);
    ?>
	<form action="<?php 
    echo urlStr($page_delete);
    ?>
" method="post">
		<p><?php 
    printf(_T("You will remove  <b>%s</b>"), $data);
    ?>
</p><br />
	    <p><?php 
    echo _T("Are you sure ?");
                updateFailoverConfig($FH);
            }
        }
    }
    // prepare the result popup
    $resultPopup = new NotifyWidget();
    // add error messages
    if ($error) {
        $resultPopup->add('<div class="alert alert-error">' . $error . '</div>');
        $resultPopup->setLevel(5);
    }
    // add info messages
    if ($result) {
        $services = getServicesNames();
        $resultPopup->add('<div class="alert alert-success">' . $result . '</div>');
        handleServicesModule($resultPopup, array($services[1] => "DHCP"));
    }
    if (!$error) {
        header("Location: " . urlStrRedirect("network/network/services"));
        exit;
    }
}
$f = new ValidatingForm();
$f->addValidateButton("bdhcpfailover");
$f->addCancelButton("breset");
$f->push(new Table());
$f->add(new TrFormElement(_T("Enable DHCP failover"), new CheckboxTpl("dhcp_failover")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'dhcpfailoverdiv\');"'));
$f->pop();
$dhcpfailoverdiv = new Div(array("id" => "dhcpfailoverdiv"));
$dhcpfailoverdiv->setVisibility($show);
$f->push($dhcpfailoverdiv);
Beispiel #5
0
        $result = "";
        $servicesNames = getServicesNames();
        if ($dhcpsubnet) {
            addZoneWithSubnet($zonename, $netaddress, $netmask, $reverse, $description, $nameserver, $nameserverip);
            $result .= _T("DHCP subnet and DNS zone successfully added.");
            $result .= "<br />" . _T("The DHCP and DNS services must be restarted.");
            $services = array($servicesNames[0] => "DNS", $servicesNames[1] => "DHCP");
        } else {
            addZone($zonename, $netaddress, $netmask, $reverse, $description, $nameserver, $nameserverip);
            $result .= _T("DNS zone successfully added.");
            $result .= "<br />" . _T("The DNS service must be restarted.");
            $services = array($servicesNames[0] => "DNS");
        }
        if (!isXMLRPCError()) {
            $n = new NotifyWidgetSuccess($result);
            handleServicesModule($n, $services);
            header("Location: " . urlStrRedirect("network/network/index"));
            exit;
        }
    } else {
        new NotifyWidgetFailure($error);
    }
} else {
    if (isset($_POST["bedit"])) {
        $zonename = $_POST["zonename"];
        $nameserver = $_POST["nameserver"];
        $description = $_POST["description"];
        $nameserverstmp = array_unique($_POST["nameservers"]);
        $mxserverstmp = array_unique($_POST["mxservers"]);
        $zoneaddress = $_POST["zoneaddress"];
        $nameserver = hasARecord($zonename, $nameserver);
Beispiel #6
0
    # apply samba options
    return xmlCall("samba4.saveOptions", array($options));
}
function getCheckedState($smb, $option)
{
    $ret = "";
    if (strtolower($smb[$option]) == "yes") {
        $ret = "checked";
    }
    return $ret;
}
if (isset($_POST["bsave"])) {
    $ret = save_smbconf();
    if (!isXMLRPCError()) {
        $n = new NotifyWidgetSuccess(sprintf(_T("SAMBA configuration saved. You may need to reload or restart the SAMBA service.", "samba4")));
        handleServicesModule($n, array("samba" => "SAMBA"));
    }
}
require "modules/samba4/mainSidebar.php";
require "graph/navbar.inc.php";
$p = new PageGenerator(_T("General options", "samba4"));
$p->setSideMenu($sidemenu);
$p->display();
$smb = get_smbconf();
// foreach($smb as $key => $i){
//      print("$key=$i<br>");
//  }
$f = new ValidatingForm();
$f->push(new Table());
#if ($smb["pdc"])
#    $workgroupTpl = new HiddenTpl("workgroup");