function item_remove() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("tree_id")); /* ==================================================== */ if ((read_config_option("remove_verification") == "on") && (!isset($_GET["confirm"]))) { $graph_tree_item = db_fetch_row("select title,local_graph_id,host_id from graph_tree_items where id=" . $_GET["id"]); if (!empty($graph_tree_item["local_graph_id"])) { $text = "Are you sure you want to delete the graph item <strong>'" . db_fetch_cell("select title_cache from graph_templates_graph where local_graph_id=" . $graph_tree_item["local_graph_id"]) . "'</strong>?"; }elseif ($graph_tree_item["title"] != "") { $text = "Are you sure you want to delete the header item <strong>'" . $graph_tree_item["title"] . "'</strong>?"; }elseif (!empty($graph_tree_item["host_id"])) { $text = "Are you sure you want to delete the host item <strong>'" . db_fetch_cell("select ".sql_function_concat("description","' ('","hostname","')'")." as hostname from host where id=" . $graph_tree_item["host_id"]) . "'</strong>?"; } include("./include/top_header.php"); form_confirm("Are You Sure?", $text, "tree.php?action=edit&id=" . $_GET["tree_id"], "tree.php?action=item_remove&id=" . $_GET["id"] . "&tree_id=" . $_GET["tree_id"]); include("./include/bottom_footer.php"); exit; } if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) { delete_branch($_GET["id"]); } header("Location: tree.php?action=edit&id=" . $_GET["tree_id"]); exit; }
function item_remove() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("tree_id")); /* ==================================================== */ if (read_config_option("deletion_verification") == "on" && !isset($_GET["confirm"])) { $graph_tree_item = db_fetch_row("select title,local_graph_id,host_id from graph_tree_items where id=" . $_GET["id"]); if (!empty($graph_tree_item["local_graph_id"])) { $text = "Are you sure you want to delete the graph item <strong>'" . db_fetch_cell("select title_cache from graph_templates_graph where local_graph_id=" . $graph_tree_item["local_graph_id"]) . "'</strong>?"; } elseif ($graph_tree_item["title"] != "") { $text = "Are you sure you want to delete the header item <strong>'" . $graph_tree_item["title"] . "'</strong>?"; } elseif (!empty($graph_tree_item["host_id"])) { $text = "Are you sure you want to delete the host item <strong>'" . db_fetch_cell("select CONCAT_WS('',description,' (',hostname,')') as hostname from host where id=" . $graph_tree_item["host_id"]) . "'</strong>?"; } include "./include/top_header.php"; form_confirm("Are You Sure?", $text, "tree.php?action=edit&id=" . $_GET["tree_id"], "tree.php?action=item_remove&id=" . $_GET["id"] . "&tree_id=" . $_GET["tree_id"]); include "./include/bottom_footer.php"; exit; } if (read_config_option("deletion_verification") == "" || isset($_GET["confirm"])) { delete_branch($_GET["id"]); } /* clear graph tree cache on save - affects current user only, other users should see changes in <5 minutes */ if (isset($_SESSION['dhtml_tree'])) { unset($_SESSION['dhtml_tree']); } header("Location: tree.php?action=edit&id=" . $_GET["tree_id"]); exit; }
function item_remove() { if (read_config_option("remove_verification") == "on" && !isset($_GET["confirm"])) { $graph_tree_item = db_fetch_row("select title,local_graph_id,host_id from graph_tree_items where id=" . $_GET["id"]); if (!empty($graph_tree_item["local_graph_id"])) { $text = "Are you sure you want to delete the graph item <strong>'" . db_fetch_cell("select title_cache from graph where id=" . $graph_tree_item["local_graph_id"]) . "'</strong>?"; } elseif ($graph_tree_item["title"] != "") { $text = "Are you sure you want to delete the header item <strong>'" . $graph_tree_item["title"] . "'</strong>?"; } elseif (!empty($graph_tree_item["host_id"])) { $text = "Are you sure you want to delete the host item <strong>'" . db_fetch_cell("select CONCAT_WS('',description,' (',hostname,')') as hostname from host where id=" . $graph_tree_item["host_id"]) . "'</strong>?"; } require_once CACTI_BASE_PATH . "/include/top_header.php"; form_confirm("Are You Sure?", $text, "graph_trees.php?action=edit&id=" . $_GET["tree_id"], "graph_trees.php?action=item_remove&id=" . $_GET["id"] . "&tree_id=" . $_GET["tree_id"]); require_once CACTI_BASE_PATH . "/include/bottom_footer.php"; exit; } if (read_config_option("remove_verification") == "" || isset($_GET["confirm"])) { delete_branch($_GET["id"]); } header("Location: graph_trees.php?action=edit&id=" . $_GET["tree_id"]); exit; }
?> <script>window.opener.location.replace("bank-master.php"); window.close();</script> <?php } } else { echo "<script>window.opener.document.getElementById('msg').innerHTML='Bank details already used'; window.close();</script>"; } unset($cnt, $ret); } //=================== Branch ====================== $branch_cd = isset($_GET['branch_cd']) ? decode($_GET['branch_cd']) : ""; if ($branch_cd != '' && $act == 'del') { $bank = decode($_GET['bank']); echo "<img src='images/loading.gif' alt='' />"; $cnt = check_branch_delete($branch_cd, $bank); if ($cnt == 0) { $ret = delete_branch($branch_cd, $bank); if ($ret == 1) { //echo "<script>location.replace('subdivision-master.php');</script>"; ?> <script>window.opener.location.replace("branch-master.php"); window.close();</script> <?php } } else { echo "<script>window.opener.document.getElementById('msg').innerHTML='Branch details already used'; window.close();</script>"; } unset($cnt, $ret); } //===================================PC========================================== $pc_cd = isset($_GET['pc_cd']) ? decode($_GET['pc_cd']) : ""; if ($pc_cd != '' && $act == 'del') { $subdiv = decode($_GET['subdiv']); echo "<img src='images/loading.gif' alt='' />";
function item_remove() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("tree_id")); /* ==================================================== */ if ((read_config_option("deletion_verification") == "on") && (!isset($_GET["confirm"]))) { $graph_tree_item = db_fetch_row("select title,local_graph_id,device_id from graph_tree_items where id=" . $_GET["id"]); if (!empty($graph_tree_item["local_graph_id"])) { $text = __("Are you sure you want to delete the graph item") . " <strong>'" . db_fetch_cell("select title_cache from graph_templates_graph where local_graph_id=" . $graph_tree_item["local_graph_id"]) . "'</strong>?"; }elseif ($graph_tree_item["title"] != "") { $text = __("Are you sure you want to delete the header item") . " <strong>'" . $graph_tree_item["title"] . "'</strong>?"; }elseif (!empty($graph_tree_item["device_id"])) { $text = __("Are you sure you want to delete the device item") . " <strong>'" . db_fetch_cell("select CONCAT_WS('',description,' (',hostname,')') as hostname from device where id=" . $graph_tree_item["device_id"]) . "'</strong>?"; } include(CACTI_BASE_PATH . "/include/top_header.php"); form_confirm(__("Are You Sure?"), $text, "tree.php?action=edit&id=" . $_GET["tree_id"], "tree.php?action=item_remove&id=" . $_GET["id"] . "&tree_id=" . $_GET["tree_id"]); include(CACTI_BASE_PATH . "/include/bottom_footer.php"); exit; } if ((read_config_option("deletion_verification") == "") || (isset($_GET["confirm"]))) { delete_branch(get_request_var("id")); } header("Location: tree.php?action=edit&id=" . $_GET["tree_id"]); exit; }
db_execute("delete from graph_tree where id=" . $tree["id"]); db_execute("delete from graph_tree_items where graph_tree_id=" . $tree["id"]); } echo __("Success - Tree and all items deleted (%s)", $tree["id"]) . "\n"; break; case (strtolower($tree_types[TREE_TYPE_NODE])): if (!sizeof($tree_item)) { print __("ERROR: No tree matching criteria found") . "\n\n"; exit(1); } if (!$debug) { # delete this tree item and all lower levels delete_branch($tree_item["id"]); } echo __("Success - Tree item and lower tree item levels deleted (%s)", $tree_item["id"]) . "\n"; break; default: echo __("ERROR: Unknown type: (%s)", $type) . "\n"; display_help($me); exit(1); } } else { echo __("ERROR: Missing type: (%s)", $type) . "\n"; display_help($me); exit(1); } } else {
function item_remove() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("tree_id")); /* ==================================================== */ /* modify for multi user start */ if (!check_tree_item($_GET["id"])) { access_denied(); } /* modify for multi user end */ if (read_config_option("deletion_verification") == "on" && !isset($_GET["confirm"])) { $graph_tree_item = db_fetch_row("select title,local_graph_id,host_id from graph_tree_items where id=" . $_GET["id"]); if (!empty($graph_tree_item["local_graph_id"])) { $text = "Are you sure you want to delete the graph item <strong>'" . db_fetch_cell("select title_cache from graph_templates_graph where local_graph_id=" . $graph_tree_item["local_graph_id"]) . "'</strong>?"; } elseif ($graph_tree_item["title"] != "") { $text = "Are you sure you want to delete the header item <strong>'" . $graph_tree_item["title"] . "'</strong>?"; } elseif (!empty($graph_tree_item["host_id"])) { $text = "Are you sure you want to delete the host item <strong>'" . db_fetch_cell("select CONCAT_WS('',description,' (',hostname,')') as hostname from host where id=" . $graph_tree_item["host_id"]) . "'</strong>?"; } include "./include/top_header.php"; form_confirm("Are You Sure?", $text, htmlspecialchars("tree.php?action=edit&id=" . $_GET["tree_id"]), htmlspecialchars("tree.php?action=item_remove&id=" . $_GET["id"] . "&tree_id=" . $_GET["tree_id"])); include "./include/bottom_footer.php"; exit; } if (read_config_option("deletion_verification") == "" || isset($_GET["confirm"])) { /* modify for multi user start */ if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) { $tree_item = db_fetch_row("SELECT graph_tree_id,local_graph_id,title,host_id,order_key FROM graph_tree_items WHERE id = '" . $_GET["id"] . "'"); // public graph if ($tree_item["graph_tree_id"] == $_SESSION["public_tree_id"] && $tree_item["local_graph_id"] > 0) { db_execute("DELETE FROM user_auth_perms WHERE user_id = '" . $_SESSION["sess_user_id"] . "' AND item_id = '" . $tree_item["local_graph_id"] . "' AND type = '1'"); // remove all reference favorites graph $rows = db_fetch_assoc("SELECT graph_tree_items.id FROM graph_tree_items WHERE graph_tree_id != '" . $_SESSION["private_tree_id"] . "' AND local_graph_id = '" . $tree_item["local_graph_id"] . "'"); foreach ($rows as $row) { delete_branch($row["id"]); } // private device (re-entry host tree_item) } elseif ($tree_item["graph_tree_id"] == $_SESSION["private_tree_id"] && $tree_item["host_id"] > 0) { exec("php ./cli/add_tree.php --type=node --node-type=host --tree-id=" . $_SESSION["private_tree_id"] . " --host-id=" . $tree_item["host_id"] . " --host-group-style=1"); // private header (re-entry host tree_item) } elseif ($tree_item["graph_tree_id"] == $_SESSION["private_tree_id"] && $tree_item["title"] != "") { $tier = tree_tier($tree_item["order_key"]); $order_key = substr($tree_item["order_key"], 0, $tier * CHARS_PER_TIER); $rows = db_fetch_assoc("SELECT host_id FROM graph_tree_items WHERE graph_tree_id = '" . $_SESSION["private_tree_id"] . "' AND host_id > 0 AND order_key LIKE '" . $order_key . "%'"); foreach ($rows as $row) { exec("php ./cli/add_tree.php --type=node --node-type=host --tree-id=" . $_SESSION["private_tree_id"] . " --host-id=" . $row["host_id"] . " --host-group-style=1"); } } } /* modify for multi user end */ delete_branch($_GET["id"]); } /* clear graph tree cache on save - affects current user only, other users should see changes in <5 minutes */ if (isset($_SESSION['dhtml_tree'])) { unset($_SESSION['dhtml_tree']); } header("Location: tree.php?action=edit&id=" . $_GET["tree_id"]); exit; }
display_notification($note); // $Mode = 'RESET'; if (@$_REQUEST['popup']) { set_focus("Select" . ($_POST['branch_code'] == -1 ? $selected_id : $_POST['branch_code'])); } } } elseif ($Mode == 'Delete') { //the link to delete a selected record was clicked instead of the submit button // PREVENT DELETES IF DEPENDENT RECORDS IN 'debtor_trans' if (branch_in_foreign_table($_POST['customer_id'], $_POST['branch_code'], 'debtor_trans')) { display_error(_("Cannot delete this branch because customer transactions have been created to this branch.")); } else { if (branch_in_foreign_table($_POST['customer_id'], $_POST['branch_code'], 'sales_orders')) { display_error(_("Cannot delete this branch because sales orders exist for it. Purge old sales orders first.")); } else { delete_branch($_POST['customer_id'], $_POST['branch_code']); display_notification(_('Selected customer branch has been deleted')); } } //end ifs to test if the branch can be deleted $Mode = 'RESET'; } if ($Mode == 'RESET' || get_post('_customer_id_update')) { $selected_id = -1; $cust_id = $_POST['customer_id']; $inact = get_post('show_inactive'); unset($_POST); $_POST['show_inactive'] = $inact; $_POST['customer_id'] = $cust_id; $Ajax->activate('_page_body'); }