$log_dst = $order_dst . " (" . $policy_dst->get_id() . ")"; } if ($group_src == $group_dst) { // same group => swap Policy::swap_simple_orders($conn, $policy_src, $policy_dst); } else { // different group => especial swap if ($order_src < $order_dst) { // Only change group (do not change order value) if ($order_src == $order_dst - 1) { Policy::change_group($conn, $policy_src->get_id(), $group_dst); } else { for ($i = $order_src; $i < $order_dst - 1; $i++) { Policy::swap_orders($conn, $i, $i + 1, $group_dst, $ctx, "src"); } } } else { if ($order_src == $order_dst) { Policy::change_group($conn, $policy_src->get_id(), $group_dst); } for ($i = $order_src; $i > $order_dst; $i--) { Policy::swap_orders($conn, $i - 1, $i, $group_dst, $ctx, "dst"); } } } $infolog = array($order_src . " (" . $policy_src->get_id() . ")", $log_dst); Log_action::log(98, $infolog); Web_indicator::set_on("Reload_policies"); // ReloadPolicy key deprecated, now using Reload_policies always //Web_indicator::set_on("ReloadPolicy"); $db->close();
ossim_valid($ctx, OSS_HEX, 'illegal:' . _("order")); if (ossim_error()) { die(ossim_error()); } //db connection $db = new ossim_db(); $conn = $db->connect(); $group1 = Policy_group::get_list($conn, $ctx, " AND id=UNHEX('{$group}')"); if ($group1[0]) { $ctx = $group1[0]->get_ctx(); if ($order == "up") { $pg_ord = Policy::get_pg_order($conn, $ctx, $group1[0]->get_order(), 'up'); $group2 = Policy_group::get_list($conn, $ctx, " AND policy_group.order={$pg_ord}"); $pg_src = $group2[0]; $pg_dst = $group1[0]; } elseif ($order == "down") { $pg_ord = Policy::get_pg_order($conn, $ctx, $group1[0]->get_order(), 'down'); $group2 = Policy_group::get_list($conn, $ctx, " AND policy_group.order={$pg_ord}"); $pg_src = $group1[0]; $pg_dst = $group2[0]; } if (is_object($pg_src) && is_object($pg_dst)) { echo "Swapping: id1=" . $pg_dst->get_group_id() . ",order1=" . $pg_src->get_order() . ",id2=" . $pg_dst->get_group_id() . ",order2=" . $pg_dst->get_order() . "<br>\n"; Policy_group::swap_orders($conn, $pg_src->get_ctx(), $pg_src->get_group_id(), $pg_src->get_order(), $pg_dst->get_group_id(), $pg_dst->get_order()); $infolog = array($pg_dst->get_name() . "(" . $pg_dst->get_group_id() . ")", $pg_dst->get_name() . "(" . $pg_dst->get_group_id() . ")"); Log_action::log(99, $infolog); Web_indicator::set_on("Reload_policies"); Web_indicator::set_on("ReloadPolicy"); } } $db->close();
Util::make_form("POST", "index.php"); exit; } else { if (POST('mode') == 'insert') { $id = Inventory::insert($conn, $sensor_id, $name, $s_type_ids[$s_type], $period, $params, $enable, $nets); Web_indicator::set_on('Reload_tasks'); ?> <script type="text/javascript">document.location.href = "index.php?s_type=<?php echo $s_type; ?> &msg=saved"</script> <?php exit; } elseif (POST('mode') == 'update') { Inventory::modify($conn, $id, $sensor_id, $name, $s_type_ids[$s_type], $period, $params, $enable, $nets); Web_indicator::set_on('Reload_tasks'); ?> <script type="text/javascript">document.location.href = "index.php?s_type=<?php echo $s_type; ?> &msg=saved"</script> <?php exit; } } } } //Get Data $id = intval(GET('id')); $s_type = GET('s_type'); ossim_valid($id, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _('Task ID'));
function delete_engine($conn, $data) { $id = $data['engine']; ossim_valid($id, OSS_HEX, 'illegal:' . _('Engine ID')); if (ossim_error()) { $info_error = _('Error') . ': ' . ossim_get_error(); ossim_clean_error(); $return['error'] = TRUE; $return['msg'] = $info_error; return $return; } if ($id == Session::get_default_engine($conn)) { $return['error'] = TRUE; $return['msg'] = _('It is not allowed to delete the default engine'); return $return; } $contexts = Acl::get_contexts_by_engine($conn, $id); if (count($contexts) > 0) { $return['error'] = TRUE; $return['msg'] = _('There are contexts asociated to this engine. You are not allowed to delete this engine'); return $return; } Acl::delete_entities($conn, $id); Alarm::delete_from_taxonomy($conn, $id); $id = Util::uuid_format($id); if (is_dir(_MAIN_PATH . "/{$id}")) { Directive_editor::remove_engine($id); } Web_indicator::set_on('Reload_servers'); $return['error'] = FALSE; $return['data'] = ''; return $return; }