* * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ require_once 'av_init.php'; require_once 'deploy_common.php'; //Checking perms check_deploy_perms(); /* connect to db */ $db = new ossim_db(TRUE); $conn = $db->connect(); $options = array(); $locations = Locations::get_list($conn); //Global Visibility $location_percent = get_global_visibility($conn); //Asset Visibility $options = array("type" => 'asset_network'); $network_percent = get_asset_visibility($conn, $options); $options = array("type" => 'asset_server'); $server_percent = get_asset_visibility($conn, $options); //Network Visibility $types = array('ids', 'vulns', 'passive', 'active', 'netflow'); foreach ($types as $t) { $var = $t . "_percent"; $options = array("type" => $t, "percent" => true); ${$var} = get_network_visibility($conn, $options); } ?>
function location_list($conn, $page, $search) { $limit = 'Limit ' . get_query_limits($page); if ($search == '') { $where = ''; } else { $search = utf8_decode($search); $search = escape_sql($search, $conn); $where = " AND name LIKE '%{$search}%'"; } $loc_list = Locations::get_list($conn, " {$where} ORDER BY name ASC {$limit}"); //If we have at least one element... if ($loc_list[0]) { //Getting the total of elements $total = $loc_list[0]->get_foundrows(); if ($total == 0) { $total = count($loc_list); } //Getting the locations already selected in the filter. $selected = get_selected_values(13); } else { $total = 0; } $list = array(); //Going through the list to format the elements properly: foreach ($loc_list as $loc) { $_chk = $selected[$loc->get_id()] != '' ? TRUE : FALSE; $_loc = array('id' => $loc->get_id(), 'name' => Util::utf8_encode2($loc->get_name()), 'checked' => $_chk); $list[$loc->get_id()] = $_loc; } $data['total'] = intval($total); $data['list'] = $list; $return['error'] = FALSE; $return['data'] = $data; return $return; }
if (ossim_error()) { echo "<rows>\n<page>1</page>\n<total>0</total>\n</rows>\n"; exit; } if (!empty($order)) { $order = "`" . $order . "`"; $order .= POST('sortorder') == 'asc' ? '' : ' DESC'; } else { $order = 'name'; } $start = ($page - 1) * $rp; $limit = "LIMIT {$start}, {$rp}"; $db = new ossim_db(); $conn = $db->connect(); $xml = ''; $locations = Locations::get_list($conn, "ORDER BY {$order} {$limit}"); if ($locations[0]) { $total = $locations[0]->get_foundrows(); if ($total == 0) { $total = count($locations); } } else { $total = 0; } $xml .= "<rows>\n"; $xml .= "<page>{$page}</page>\n"; $xml .= "<total>{$total}</total>\n"; foreach ($locations as $location) { $id = $location->get_id(); $name = $location->get_name(); $ctx = $location->get_ctx();
$locations_id = GET('id') != '' ? GET('id') : POST('locations_id'); $action = $locations_id != '' ? 'modifylocations.php' : 'newlocations.php'; $sensor_id = POST('sensor'); $delete_id = POST('delete'); $ip = ''; $name = ''; $status = 1; $zoom = 1; if ($locations_id != '') { ossim_valid($locations_id, OSS_HEX, 'illegal:' . _('Location ID')); ossim_valid($sensor_id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Sensor')); ossim_valid($delete_id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Delete')); if (ossim_error()) { die(ossim_error()); } if ($locations_list = Locations::get_list($conn, " AND id = UNHEX('{$locations_id}')")) { $location = $locations_list[0]; $ctx = $location->get_ctx(); $name = $location->get_name(); $desc = $location->get_desc(); $latitude = str_replace(',', '.', floatval($location->get_lat())); $longitude = str_replace(',', '.', floatval($location->get_lon())); $zoom = 4; $cou = strtolower($location->get_country()); $location = $location->get_location(); } // Insert related sensor if ($sensor_id != '') { Locations::insert_related_sensor($conn, $locations_id, $sensor_id); Util::memcacheFlush(); }