Exemplo n.º 1
0
    $cond = $_SESSION['_actions']['cond'];
    $on_risk = $_SESSION['_actions']['on_risk'];
    $email_from = $_SESSION['_actions']['email_from'];
    $email_to = $_SESSION['_actions']['email_to'];
    $email_subject = $_SESSION['_actions']['email_subject'];
    $email_message = $_SESSION['_actions']['email_message'];
    $exec_command = $_SESSION['_actions']['exec_command'];
    unset($_SESSION['_actions']);
} else {
    $action_id = REQUEST('id');
    ossim_valid($action_id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Action ID'));
    if (ossim_error()) {
        die(ossim_error());
    }
    list($db, $conn) = Ossim_db::get_conn_db();
    $action_list = Action::get_list($conn, " AND id = UNHEX('{$action_id}')");
    if (is_array($action_list)) {
        $action = $action_list[0];
    }
    if (!is_null($action)) {
        $action_type = $action->get_action_type();
        $ctx = $action->get_ctx();
        $cond = Util::htmlentities($action->get_cond());
        $on_risk = $action->is_on_risk();
        $name = $action->get_name();
        if (REQUEST('descr')) {
            $description = $descr;
        } else {
            $description = $action->get_descr();
        }
    } else {
Exemplo n.º 2
0
    $on_risk = $_SESSION['_actions']['on_risk'];
    $email_from = $_SESSION['_actions']['email_from'];
    $email_to = $_SESSION['_actions']['email_to'];
    $email_subject = $_SESSION['_actions']['email_subject'];
    $email_message = $_SESSION['_actions']['email_message'];
    $exec_command = $_SESSION['_actions']['exec_command'];
    unset($_SESSION['_actions']);
} else {
    $action_id = REQUEST('id');
    ossim_valid($action_id, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Action id"));
    if (ossim_error()) {
        die(ossim_error());
    }
    $db = new ossim_db();
    $conn = $db->connect();
    if (is_array($action_list = Action::get_list($conn, "WHERE id = '{$action_id}'"))) {
        $action = $action_list[0];
    }
    if (!is_null($action)) {
        $action_type = $action->get_action_type();
        $cond = htmlspecialchars($action->get_cond());
        $on_risk = $action->is_on_risk();
        if (REQUEST('descr')) {
            $description = $descr;
        } else {
            $description = $action->get_descr();
        }
    } else {
        $action_type = "";
        $cond = "True";
        $on_risk = 0;
Exemplo n.º 3
0
require_once 'classes/Port_group.inc';
$port_list = Port_group::get_list($conn);
$ports[] = array("value" => ANY, "name" => "ANY");
foreach ($port_list as $p) {
    $ports[] = array("value" => $p->get_name(), "name" => $p->get_name() . " (" . $p->get_descr() . ")");
}
/* plugins */
require_once 'classes/Plugin.inc';
$plugin_list = Plugin::get_list($conn);
$plugins[] = array("value" => ANY, "name" => "ANY");
foreach ($plugin_list as $p) {
    $plugins[] = array("value" => $p->get_id(), "name" => $p->get_name() . " (" . $p->get_id() . ")");
}
/* actions */
require_once 'classes/Action.inc';
$action_list = Action::get_list($conn);
if (is_array($action_list)) {
    foreach ($action_list as $a) {
        $actions[] = array("value" => $a->get_id(), "name" => $a->get_descr());
    }
}
function select_response_object($title, $objects, $id)
{
    ?>
  <!-- <?php 
    echo $title;
    ?>
 -->
  <tr>
    <th valign="top"><?php 
    echo $title . ":";
Exemplo n.º 4
0
if (ossim_error()) {
    echo "<rows>\n<page>1</page>\n<total>0</total>\n</rows>\n";
    exit;
}
if (!empty($order)) {
    $order .= POST('sortorder') == "asc" ? "" : " desc";
} else {
    $order = "descr";
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
list($db, $conn) = Ossim_db::get_conn_db();
$xml = "";
$q_where = Session::am_i_admin() == FALSE ? ' AND action_type <> 2' : '';
$q_where .= " ORDER BY {$order} {$limit}";
$action_list = Action::get_list($conn, $q_where);
if (is_array($action_list)) {
    if ($action_list[0]) {
        $total = $action_list[0]->get_foundrows();
        if ($total == 0) {
            $total = count($action_list);
        }
    } else {
        $total = 0;
    }
    $xml .= "<rows>\n";
    $xml .= "<page>{$page}</page>\n";
    $xml .= "<total>{$total}</total>\n";
    foreach ($action_list as $action) {
        $id = Util::htmlentities($action->get_id());
        $name = Util::htmlentities($action->get_name());
Exemplo n.º 5
0
}
ossim_valid($order, OSS_ALPHA, OSS_SPACE, OSS_SCORE, OSS_NULLABLE, 'illegal:' . _("order"));
ossim_valid($page, OSS_DIGIT, 'illegal:' . _("page"));
ossim_valid($rp, OSS_DIGIT, 'illegal:' . _("rp"));
if (ossim_error()) {
    die(ossim_error());
}
if (empty($order)) {
    $order = "descr";
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$db = new ossim_db();
$conn = $db->connect();
$xml = "";
if (is_array($action_list = Action::get_list($conn, "ORDER BY {$order} {$limit}"))) {
    if ($action_list[0]) {
        $total = $action_list[0]->get_foundrows();
        if ($total == 0) {
            $total = count($action_list);
        }
    } else {
        $total = 0;
    }
    $xml .= "<rows>\n";
    $xml .= "<page>{$page}</page>\n";
    $xml .= "<total>{$total}</total>\n";
    foreach ($action_list as $action) {
        $xml .= "<row id='" . $action->get_id() . "'>";
        $desc = $action->get_descr();
        if ($desc == "") {
Exemplo n.º 6
0
ossim_valid($page, OSS_DIGIT, 'illegal:' . _("page"));
ossim_valid($rp, OSS_DIGIT, 'illegal:' . _("rp"));
if (ossim_error()) {
    echo "<rows>\n<page>1</page>\n<total>0</total>\n</rows>\n";
    exit;
}
if (!empty($order)) {
    $order .= POST('sortorder') == "asc" ? "" : " desc";
} else {
    $order = "descr";
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
list($db, $conn) = Ossim_db::get_conn_db();
$xml = "";
$action_list = Action::get_list($conn, "ORDER BY {$order} {$limit}");
if (is_array($action_list)) {
    if ($action_list[0]) {
        $total = $action_list[0]->get_foundrows();
        if ($total == 0) {
            $total = count($action_list);
        }
    } else {
        $total = 0;
    }
    $xml .= "<rows>\n";
    $xml .= "<page>{$page}</page>\n";
    $xml .= "<total>{$total}</total>\n";
    foreach ($action_list as $action) {
        $id = $action->get_id();
        $name = $action->get_name();
Exemplo n.º 7
0
function get_policy_actions($conn, $data)
{
    $ctx = empty($data['ctx']) ? Session::get_default_ctx() : $data['ctx'];
    $id = $data['id'];
    ossim_valid($ctx, OSS_HEX, 'illegal:' . _("CTX"));
    ossim_valid($id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _("CTX"));
    if (ossim_error()) {
        $info_error = "Error: " . ossim_get_error();
        ossim_clean_error();
        $return['error'] = TRUE;
        $return['msg'] = $info_error;
        return $return;
    }
    $actions_saved = array();
    $result = '';
    if ($action_list = Policy_action::get_list($conn, $id)) {
        foreach ($action_list as $action) {
            $actions_saved[] = $action->get_action_id();
        }
    }
    $where = Session::Am_i_admin() ? '' : "AND ctx=UNHEX('{$ctx}')";
    if ($action_list2 = Action::get_list($conn, $where)) {
        foreach ($action_list2 as $act) {
            $sel = in_array($act->get_id(), $actions_saved) ? " selected='selected'" : "";
            $desc1 = strlen($act->get_name()) > 48 ? substr($act->get_name(), 0, 48) . "..." : $act->get_name();
            $result .= "<option value='" . $act->get_id() . "' {$sel}>{$desc1}</option>";
        }
    }
    $return['error'] = FALSE;
    $return['data'] = $result;
    return $return;
}
Exemplo n.º 8
0
							<span class="size"><a href="../action/actionform.php?withoutmenu=1" class="greybox"><?php 
echo _("Insert new action?");
?>
</a></span><br/>
						</th>
					</tr>
					
					<tr>
						<td class="left nobborder" valign="top">
							<span id="loading_actions"><img src="../pixmaps/loading.gif" width="16px" align="absmiddle"><?php 
echo _("Loading actions, please wait a second...");
?>
</span>
							<select id="actions" name="actions[]" class="multiselect" multiple="multiple" style="width:640px;height:348px;display:none">
								<?php 
if ($action_list2 = Action::get_list($conn)) {
    $action_sel = array();
    foreach ($actions_saved as $act) {
        $action_sel[] = $act->get_action_id();
    }
    foreach ($action_list2 as $act) {
        $sel = in_array($act->get_id(), $action_sel) ? '" selected="selected' : '';
        $desc1 = strlen($act->get_descr()) > 48 ? substr($act->get_descr(), 0, 48) . "..." : $act->get_descr();
        ?>
											<option value="<?php 
        echo $act->get_id() . $sel;
        ?>
"><?php 
        echo $desc1;
        ?>
</option>