} ossim_valid($id, OSS_HEX, 'illegal:' . _("Policy ID")); if (ossim_error()) { die(ossim_error()); } Policy::update($conn, $id, $ctx, $priority, $active, $group, $order, $tzone, $b_month, $b_month_day, $b_week_day, $b_hour, $b_minute, $e_month, $e_month_day, $e_week_day, $e_hour, $e_minute, $descr, $source_ips, $source_host_groups, $dest_ips, $dest_host_groups, $source_nets, $source_net_groups, $dest_nets, $dest_net_groups, $portsrc, $portdst, $plug_groups, $sensors, $target, $taxonomy, $reputation, $event_conds, $idm, $correlate, $cross_correlate, $store, $rep, $qualify, $resend_alarms, $resend_events, $frw_conds, $sign, $sem, $sim); // Actions if (count($policy_action) > 0) { Policy_action::delete($conn, $id); foreach ($policy_action as $action_id) { Policy_action::insert($conn, $action_id, $id); } } break; case 'clone': $order = Policy::get_next_order($conn, $ctx, $group); $newid = Policy::insert($conn, $ctx, $priority, $active, $group, $order, $tzone, $b_month, $b_month_day, $b_week_day, $b_hour, $b_minute, $e_month, $e_month_day, $e_week_day, $e_hour, $e_minute, $descr, $source_ips, $source_host_groups, $dest_ips, $dest_host_groups, $source_nets, $source_net_groups, $dest_nets, $dest_net_groups, $portsrc, $portdst, $plug_groups, $sensors, $target, $taxonomy, $reputation, $event_conds, $idm, $correlate, $cross_correlate, $store, $rep, $qualify, $resend_alarms, $resend_events, $frw_conds, $sign, $sem, $sim); // Actions if (!empty($newid) && count($policy_action) > 0) { foreach ($policy_action as $action_id) { Policy_action::insert($conn, $action_id, $newid); } } break; default: die(_('Wrong option chosen')); } $db->close(); ?> <p> <?php echo _("Policy successfully inserted");
//Context if ($pro) { $ctx = $policy_src->get_ctx(); } else { $ctx = Session::get_default_ctx(); } //Checking if the destiny is a policy group or a policy if (preg_match("/\\:/", $policy_dst)) { $group_dst = preg_replace("/\\:.*/", "", $policy_dst); $log_dst = preg_replace("/.*\\:/", "", $policy_dst); ossim_valid($group_dst, OSS_HEX, 'illegal:' . _("Dst")); if (ossim_error()) { die(ossim_error()); } if ($group_dst != $group_src) { $order_dst = Policy::get_next_order($conn, $ctx, $group_dst); } else { $where = " AND ctx=UNHEX('{$ctx}') AND policy.group=UNHEX('{$group_dst}') ORDER BY policy.order DESC LIMIT 1"; $policy_dst = Policy::get_list($conn, $where); if (is_array($policy_dst) && !empty($policy_dst)) { $policy_dst = array_shift($policy_dst); } } } else { ossim_valid($policy_dst, OSS_HEX, 'illegal:' . _("Dst")); if (ossim_error()) { die(ossim_error()); } $group_dst = Policy::get_group_from_id($conn, $policy_dst); $policy_dst = Policy::get_list($conn, " AND id=UNHEX('{$policy_dst}')"); if (is_array($policy_dst) && !empty($policy_dst)) {