} print "</ul>"; print "<hr><div style='text-align:right'>"; print _("Are you sure you want to delete above items?") . " "; print "<div class='btn-group'>"; print "\t<a class='btn btn-sm btn-danger editSubnetSubmitDelete' id='editSubnetSubmitDelete'>" . _("Confirm") . "</a>"; print "</div>"; print "</div>"; print "</div>"; } else { # remove scanagent if not needed if (!isset($_POST['pingSubnet']) && !isset($_POST['discoverSubnet'])) { $_POST['scanAgent'] = 0; } # create array of default update values $values = array("id" => @$_POST['subnetId'], "isFolder" => 0, "masterSubnetId" => $_POST['masterSubnetId'], "subnet" => $Subnets->transform_to_decimal($_POST['subnet']), "mask" => $_POST['mask'], "description" => @$_POST['description'], "vlanId" => $_POST['vlanId'], "allowRequests" => $Admin->verify_checkbox(@$_POST['allowRequests']), "showName" => $Admin->verify_checkbox(@$_POST['showName']), "discoverSubnet" => $Admin->verify_checkbox(@$_POST['discoverSubnet']), "pingSubnet" => $Admin->verify_checkbox(@$_POST['pingSubnet']), "scanAgent" => @$_POST['scanAgent'], "DNSrecursive" => $Admin->verify_checkbox(@$_POST['DNSrecursive']), "DNSrecords" => $Admin->verify_checkbox(@$_POST['DNSrecords']), "nameserverId" => $_POST['nameserverId'], "device" => $_POST['device'], "isFull" => $Admin->verify_checkbox($_POST['isFull'])); # for new subnets we add permissions if ($_POST['action'] == "add") { $values['permissions'] = $_POST['permissions']; $values['sectionId'] = $_POST['sectionId']; // add vrf $values['vrfId'] = $_POST['vrfId']; } else { # if section change if (@$_POST['sectionId'] != @$_POST['sectionIdNew']) { $values['sectionId'] = $_POST['sectionIdNew']; } # if vrf change if (@$_POST['vrfId'] != @$_POST['vrfIdOld']) { $values['vrfId'] = $_POST['vrfId']; }
if (strpos($_POST['siteURL'], 'http://') !== false || strpos($_POST['siteURL'], 'https://') !== false) { } else { $_POST['siteURL'] = "http://" . $_POST['siteURL']; } //verify ping status fields $_POST['pingStatus'] = str_replace(" ", "", $_POST['pingStatus']); //remove possible spaces $_POST['pingStatus'] = str_replace(",", ";", $_POST['pingStatus']); //change possible , for ; $statuses = explode(";", $_POST['pingStatus']); if (sizeof($statuses) != 2) { $Result->show("danger", _("Invalid ping status intervals"), true); } if (!is_numeric($statuses[0]) || !is_numeric($statuses[1])) { $Result->show("danger", _("Invalid ping status intervals"), true); } //verify email if (filter_var($_POST['siteAdminMail'], FILTER_VALIDATE_EMAIL) === false) { $Result->show("danger", _("Invalid email"), true); } //verify numbers if (!is_numeric($_POST['vlanMax'])) { $Result->show("danger", _("Invalid value for Max VLAN number"), true); } # set update values $values = array("id" => 1, "siteTitle" => @$_POST['siteTitle'], "siteDomain" => @$_POST['siteDomain'], "siteURL" => @$_POST['siteURL'], "siteLoginText" => @$_POST['siteLoginText'], "prettyLinks" => @$_POST['prettyLinks'], "defaultLang" => @$_POST['defaultLang'], "inactivityTimeout" => @$_POST['inactivityTimeout'], "siteAdminName" => @$_POST['siteAdminName'], "siteAdminMail" => @$_POST['siteAdminMail'], "api" => $Admin->verify_checkbox(@$_POST['api']), "enableIPrequests" => $Admin->verify_checkbox(@$_POST['enableIPrequests']), "enableVRF" => $Admin->verify_checkbox(@$_POST['enableVRF']), "enableDNSresolving" => $Admin->verify_checkbox(@$_POST['enableDNSresolving']), "vlanDuplicate" => $Admin->verify_checkbox(@$_POST['vlanDuplicate']), "vlanMax" => @$_POST['vlanMax'], "enableChangelog" => $Admin->verify_checkbox(@$_POST['enableChangelog']), "tempShare" => $Admin->verify_checkbox(@$_POST['tempShare']), "enablePowerDNS" => $Admin->verify_checkbox(@$_POST['enablePowerDNS']), "enableFirewallZones" => $Admin->verify_checkbox(@$_POST['enableFirewallZones']), "log" => @$_POST['log'], "donate" => $Admin->verify_checkbox(@$_POST['donate']), "visualLimit" => @$_POST['visualLimit'], "subnetOrdering" => @$_POST['subnetOrdering'], "subnetView" => @$_POST['subnetView'], "scanPingType" => @$_POST['scanPingType'], "pingStatus" => @$_POST['pingStatus'], "scanPingPath" => @$_POST['scanPingPath'], "scanFPingPath" => @$_POST['scanFPingPath'], "scanMaxThreads" => @$_POST['scanMaxThreads']); if (!$Admin->object_modify("settings", "edit", "id", $values)) { $Result->show("danger", _("Cannot update settings"), true); } else { $Result->show("success", _("Settings updated successfully"), true); }
# formulate update values $values = array("id" => @$_POST['userId'], "real_name" => $_POST['real_name'], "username" => $_POST['username'], "email" => $_POST['email'], "role" => $_POST['role'], "authMethod" => $_POST['authMethod'], "lang" => $_POST['lang'], "mailNotify" => $_POST['mailNotify'], "mailChangelog" => $_POST['mailChangelog']); # update pass ? if (strlen(@$_POST['password1']) > 0 || @$_POST['action'] == "add" && $auth_method->type == "local") { $values['password'] = $_POST['password1']; } # pass change if (isset($_POST['passChange']) && $auth_method->type == "local") { $values['passChange'] = "Yes"; } # set groups user belongs to if ($_POST['role'] == "Administrator") { $values['groups'] = null; } else { foreach ($_POST as $key => $post) { if (substr($key, 0, 5) == "group") { $group[substr($key, 5)] = substr($key, 5); } } $values['groups'] = json_encode(@$group); } # execute if (!$Admin->object_modify("users", $_POST['action'], "id", $values)) { $Result->show("danger", _("User {$_POST['action']} failed") . '!', true); } else { $Result->show("success", _("User {$_POST['action']} successfull") . '!', false); } /* mail user */ if ($Admin->verify_checkbox(@$_POST['notifyUser']) == 1) { include "edit-notify.php"; }
} } # update pass ? if (strlen(@$_POST['password1']) > 0 || @$_POST['action'] == "add" && $auth_method->type == "local") { $values['password'] = $_POST['password1']; } # pass change if (isset($_POST['passChange']) && $auth_method->type == "local") { $values['passChange'] = "Yes"; } # set groups user belongs to if ($_POST['role'] == "Administrator") { $values['groups'] = null; } else { foreach ($_POST as $key => $post) { if (substr($key, 0, 5) == "group") { $group[substr($key, 5)] = substr($key, 5); } } $values['groups'] = json_encode(@$group); } # execute if (!$Admin->object_modify("users", $_POST['action'], "id", $values)) { $Result->show("danger", _("User {$_POST['action']} failed") . '!', true); } else { $Result->show("success", _("User {$_POST['action']} successfull") . '!', false); } # mail user if ($Admin->verify_checkbox(@$_POST['notifyUser']) != "0") { include "edit-notify.php"; }
print "<strong>" . _("Warning") . "</strong>: " . _("I will delete") . ":<ul>"; print "\t<li>{$subcnt} " . _("subnets") . "</li>"; if ($ipcnt > 0) { print "\t<li>{$ipcnt} " . _("IP addresses") . "</li>"; } print "</ul>"; print "<hr><div style='text-align:right'>"; print _("Are you sure you want to delete above items?") . " "; print "<div class='btn-group'>"; print "\t<a class='btn btn-sm btn-danger editSubnetSubmitDelete' id='editSubnetSubmitDelete'>" . _("Confirm") . "</a>"; print "</div>"; print "</div>"; print "</div>"; } else { # create array of default update values $values = array("id" => @$_POST['subnetId'], "isFolder" => 0, "masterSubnetId" => $_POST['masterSubnetId'], "subnet" => $Subnets->transform_to_decimal($_POST['subnet']), "mask" => $_POST['mask'], "description" => @$_POST['description'], "vlanId" => $_POST['vlanId'], "allowRequests" => $Admin->verify_checkbox(@$_POST['allowRequests']), "showName" => $Admin->verify_checkbox(@$_POST['showName']), "discoverSubnet" => $Admin->verify_checkbox(@$_POST['discoverSubnet']), "pingSubnet" => $Admin->verify_checkbox(@$_POST['pingSubnet'])); # for new subnets we add permissions if ($_POST['action'] == "add") { $values['permissions'] = $_POST['permissions']; $values['sectionId'] = $_POST['sectionId']; } else { # if section change if (@$_POST['sectionId'] != @$_POST['sectionIdNew']) { $values['sectionId'] = $_POST['sectionIdNew']; } # if vrf change if (@$_POST['vrfId'] != @$_POST['vrfIdOld']) { $values['vrfId'] = $_POST['vrfId']; } } # append custom fields