} /* Check user permissions */ verify_permission('zone_master_add') ? $zone_master_add = "1" : ($zone_master_add = "0"); verify_permission('user_view_others') ? $perm_view_others = "1" : ($perm_view_others = "0"); if (isset($_POST['submit']) && $zone_master_add == "1") { $error = false; foreach ($domains as $domain) { if (!is_valid_hostname_fqdn($domain, 0)) { error($domain . ' failed - ' . ERR_DNS_HOSTNAME); } elseif (domain_exists($domain)) { error($domain . ' failed - ' . ERR_DOMAIN_EXISTS); // TODO: repopulate domain name(s) to the form if there was an error occured $error = true; } elseif (add_domain($domain, $owner, $dom_type, '', $zone_template)) { success("<a href=\"edit.php?id=" . get_zone_id_from_name($domain) . "\">" . $domain . " - " . SUC_ZONE_ADD . '</a>'); } } if (false === $error) { unset($domains, $owner, $dom_type, $zone_template); } } if ($zone_master_add != "1") { error(ERR_PERM_ADD_ZONE_MASTER); } else { echo " <h2>" . _('Add master zone') . "</h2>\n"; $available_zone_types = array("MASTER", "NATIVE"); $users = show_users(); $zone_templates = get_list_zone_templ($_SESSION['userid']); echo " <form method=\"post\" action=\"add_zone_master.php\">\n";
/* Check permissions */ do_hook('verify_permission', 'zone_slave_add') ? $zone_slave_add = "1" : ($zone_slave_add = "0"); do_hook('verify_permission', 'user_view_others') ? $perm_view_others = "1" : ($perm_view_others = "0"); if (isset($_POST['submit']) && $zone_slave_add == "1") { if (!is_valid_hostname_fqdn($zone, 0)) { error(ERR_DNS_HOSTNAME); } elseif ($dns_third_level_check && get_domain_level($zone) > 2 && domain_exists(get_second_level_domain($zone))) { error(ERR_DOMAIN_EXISTS); } elseif (domain_exists($zone) || record_name_exists($zone)) { error(ERR_DOMAIN_EXISTS); } elseif (!is_valid_ipv4($master, false) && !is_valid_ipv6($master)) { error(ERR_DNS_IP); } else { if (add_domain($zone, $owner, $type, $master, 'none')) { success("<a href=\"edit.php?id=" . get_zone_id_from_name($zone) . "\">" . SUC_ZONE_ADD . '</a>'); log_info(sprintf('client_ip:%s user:%s operation:add_zone zone:%s zone_type:SLAVE zone_master:%s', $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $zone, $master, $zone_template)); unset($zone, $owner, $webip, $mailip, $empty, $type, $master); } } } if ($zone_slave_add != "1") { error(ERR_PERM_ADD_ZONE_SLAVE); } else { echo " <h2>" . _('Add slave zone') . "</h2>\n"; $users = do_hook('show_users'); echo " <form method=\"post\" action=\"add_zone_slave.php\">\n"; echo " <table>\n"; echo " <tr>\n"; echo " <td class=\"n\">" . _('Zone name') . "</td>\n";
include_once 'ressources/class.ldap.inc'; include_once 'ressources/class.users.menus.inc'; include_once 'ressources/class.artica.inc'; $user = new usersMenus(); if ($user->AllowEditOuSecurity == false) { header('location:users.index.php'); } if (isset($_GET["ImportArticaDomainsTable"])) { ImportArticaDomainsTable(); } if (isset($_GET["DeleteGlobalBlack"])) { DeleteGlobalBlack(); exit; } if (isset($_GET["add_domain"])) { add_domain(); exit; } INDEX(); function INDEX() { $page = CurrentPageName(); if (isset($_GET["find"])) { $table = SearchTable($_GET["find"]); } else { $table = DomainsTable($_GET["ou"]); } $html = "\n\t<input type='hidden' id='SearchString' value='{$_GET["find"]}'>\n\t<center>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td>\n\t\t\t<form name='FFMQ'>\n\t\t\t<input type='hidden' name='ImportArticaDomainsTable' value='{$_GET["ou"]}'>\n\t\t\t<input type='button' value='« {import_black_domain_table} »' OnClick=\"javascript:MyHref('{$page}?ou={$_GET["ou"]}&ImportArticaDomainsTable={$_GET["ou"]}');\">\n\t\t\t</form>\n\t\t</td>\n\t\t<td>\n\t\t\n\t\t<table>\n\t\t\t<tr>\n\t\t\t<td align='right' nowrap><strong>{add_b_dom}:</strong></td>\n\t\t\t<input type='hidden' value='{$_GET["ou"]}' id='ou' name='ou' >\n\t\t\t<td>" . Field_text('add_domain', null, null, null, null, null, null, "BTAddBlackDomain(event);") . "</td>\n\t\t\t<td><input type='button' value='{add} »' OnClick=\"javascript:AddBlackDomain();\"></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t\n\t\t</td>\n\t\t\n\t\t\n\t</tr>\n\t<div style='margin:5px'>\n\t<form name='FFMQ1'>\n\t<input type='hidden' name='ou' id='ou' value='{$_GET["ou"]}'>\n\t<table style='width:100%'>\n\t<tr>\n\t<td align='right'><strong>{search}</strong></td>\n\t<td>" . Field_text('find', $_GET["find"]) . "</td>\n\t<td><input type='submit' value='« {search} »'></td>\n\t</tr>\n\t</table>\n\t</form>\n\t{$table}\n\t\n\t\n\t"; $cfg["JS"][] = "js/quarantine.ou.js"; $tpl = new template_users('{global_blacklist}', $html, 0, 0, 0, 0, $cfg); echo $tpl->web_page;
// are you in the correct group? if ($_SESSION['role_id'] < 2) { errormsg('Your role does not have access to this resource'); } else { if (isset($_POST['domain_name']) && isset($_POST['client_id'])) { // Setup POST data as a new variable $domain_name = $_POST['domain_name']; $client_id = $_POST['client_id']; // find the client name if (get_client_name($client_id, $mysqli)) { // client_name found $client_name = get_client_name($client_id, $mysqli); // check if domain is already in use if (check_domain_name_isfree($domain_name, $mysqli)) { // domain is free, lets add it! if (add_domain($domain_name, $client_id, $mysqli)) { echo "\n\t\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t\t<legend>Create Domain</legend>\n\t\t\t\t\t\t\t" . quickalert("success", "New domain '" . $domain_name . "' has been added to the database for client '" . $client_name . "'.") . "\n\t\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"; } else { errormsg("Failed to insert new record into the database"); } } else { errormsg("This domain is already in the database!"); } } else { errormsg("This client_id does not exist"); } } elseif (!$_POST) { echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=create&object=domain' method='post' name='create_domain'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Create Domain</legend>\n\t\t\t\t" . quickalert("info", "Domain names must contain a valid fully qualified domain name.") . "\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Client</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='client_id' name='client_id' class='form-control'>\n\t\t\t\t"; $query = "SELECT client_id,client_name FROM clients ORDER BY client_name"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute();
// Only the superadmin should be here. if (!is_superadmin($uid)) { header("Location: index.php" . $sid); exit; } // Find out which button we pushed to get here if (isset($_POST["adddomain"])) { // Don't trust the admin to have remembered to // start the domain with '@'. $domain_name = strtolower(trim($_POST["newdomain"])); if (!preg_match("/^@.*\$/", $domain_name)) { $domain_name = "@" . $domain_name; } // Only add domains that are syntactically valid if (preg_match("/^(@.+\\..+)\$/", $domain_name)) { if (add_domain($domain_name) == 0) { $_SESSION['message'] = $lang['text_domain_add_failed']; } else { $_SESSION['message'] = $lang['text_domain_added']; } } } elseif (isset($_POST["delete"]) && isset($_POST['domains'])) { // Register the full set of POST variables. foreach ($_POST['domains'] as $value) { if (ctype_digit($value)) { $formVars[] = $value; } } // Don't allow the system default (@.) to be removed $select = "SELECT domain, id " . "FROM maia_domains " . "WHERE domain <> '@.' " . "AND id IN (" . implode(',', $formVars) . ")"; $sth = $dbh->prepare($select);
if (isset($_POST['owner']) && v_num($_POST['owner'])) { $owner = $_POST['owner']; } $zone = trim($_POST['domain']); $master = $_POST['slave_master']; $type = "SLAVE"; verify_permission('zone_slave_add') ? $zone_slave_add = "1" : ($zone_slave_add = "0"); if ($_POST['submit'] && $zone_slave_add == "1") { if (!is_valid_hostname_fqdn($zone, 0)) { error(ERR_DNS_HOSTNAME); } elseif (domain_exists($zone)) { error(ERR_DOMAIN_EXISTS); } elseif (!is_valid_ipv4($master) && !is_valid_ipv6($master)) { error(ERR_DNS_IP); } else { if (add_domain($zone, $owner, $webip, $mailip, $empty, $type, $master)) { success(SUC_ZONE_ADD); unset($zone, $owner, $webip, $mailip, $empty, $type, $master); } } } if ($zone_slave_add != "1") { error(ERR_PERM_ADD_ZONE_SLAVE); } else { echo " <h2>" . _('Add slave zone') . "</h2>\n"; $users = show_users(); echo " <form method=\"post\" action=\"add_zone_slave.php\">\n"; echo " <table>\n"; echo " <tr>\n"; echo " <td class=\"n\">" . _('Zone name') . "</td>\n"; echo " <td class=\"n\">\n";
if (!$empty) { $empty = 0; if (!eregi('in-addr.arpa', $domain) && (!is_valid_ipv4($webip) || !is_valid_ipv4($mailip))) { error(_('IP address of web- or mailserver is invalid.')); $error = "1"; } } if (!$error) { if (!is_valid_hostname_fqdn($domain, 0)) { error(ERR_DOMAIN_INVALID); $error = "1"; } elseif (domain_exists($domain)) { error(ERR_DOMAIN_EXISTS); $error = "1"; } else { if (add_domain($domain, $owner, $webip, $mailip, $empty, $dom_type, '')) { success(SUC_ZONE_ADD); unset($domain, $owner, $webip, $mailip, $empty, $dom_type); } else { $error = "1"; } } } } if ($zone_master_add != "1") { error(ERR_PERM_ADD_ZONE_MASTER); } else { echo " <h2>" . _('Add master zone') . "</h2>\n"; $available_zone_types = array("NATIVE", "MASTER"); $users = show_users(); echo " <form method=\"post\" action=\"add_zone_master.php\">\n";
function add_domain_list() { $list = array("adelia" => array("testtttttt.com", "hello.org"), "admin" => array("demo.lxcenter.net", "domaindomain.com", "example.com"), "kerry" => array("program.com", "review.org"), "wholesale" => array("demo.lxcenter.com"), "master" => array("master.com", "mmast.com"), "reseller" => array("demo.com", "testingg.com"), "shyla" => array("testing.org", "teeest.com", "aim.com"), "warwick" => array("test.com"), "sheree" => array("example.org", "domain.org", "domaint.com"), "customer" => array("test.org", "freedomain.com", "paradise.com"), "shevon" => array("test200.org"), "shelly" => array("freedomain1.com", "heven.com"), "sibill" => array("test100.org", "freedomain100.com"), "walta" => array("paradise1.com"), "sibyl" => array("test101.org", "freedomain102.com", "paradise11.com")); foreach ($list as $key => $val) { foreach ($val as $key1 => $val1) { add_domain($val1, $key); } } }