function get_notifications($conn) { $notifications = array(); if (Session::menu_perms('configuration-menu', 'PolicySensors')) { $new_sensors = Av_sensor::get_unregistered($conn); if (count($new_sensors) > 0) { $notif['msg'] = count($new_sensors) > 1 ? _('New Sensors Detected') : _('New Sensor Detected'); $notif['class'] = 'nl_sensors'; $notifications[$notif['class']] = $notif; } } if (Session::am_i_admin()) { $trial_days = calc_days_to_expire(); if ($trial_days !== FALSE) { $notif['msg'] = $trial_days == 0 ? _('Trial Version expired') : $trial_days . ' ' . _('Days Left of Free Trial'); $notif['class'] = 'nl_trial'; $notifications[$notif['class']] = $notif; } $new_updates = get_only_updates(); if ($new_updates == TRUE) { $notif['msg'] = _('New Updates Available'); $notif['class'] = 'nl_updates'; $notifications[$notif['class']] = $notif; } $unread = get_status_messages(); if ($unread) { $notif['msg'] = _('New Warnings & Errors'); $notif['class'] = 'nl_messages'; $notifications[$notif['class']] = $notif; } $otx = calc_otx_notif(); if ($otx === TRUE) { $notif['msg'] = _('Contribute to AlienVault OTX'); $notif['class'] = 'nl_otx'; $notifications[$notif['class']] = $notif; } $devices = calc_devices_total($conn); $max_dev = intval($_SESSION["_max_devices"]); //This val is loaded when the users log in. (session.inc) if ($max_dev > 0 && $devices > $max_dev) { $over = $devices - $max_dev; $notif['msg'] = _("License Violation - {$over} Assets Over"); $notif['class'] = 'nl_device_exceed'; $notifications[$notif['class']] = $notif; } } $return['error'] = FALSE; $return['output'] = $notifications; return $return; }
$conn = $db->connect(); Session::logcheck('configuration-menu', 'PolicySensors'); $version = $conf->get_conf("ossim_server_version"); $disable_inputs = FALSE; $array_priority = array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10'); $id = GET('id'); $ip = GET('ip'); $update = intval(GET('update')); ossim_valid($id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Sensor ID')); ossim_valid($ip, OSS_IP_ADDR, OSS_NULLABLE, 'illegal:' . _('IP')); if (ossim_error()) { die(ossim_error()); } // From 'Insert' link detected by server if ($ip != '' && $id == '') { $unregistered_sensors = Av_sensor::get_unregistered($conn); foreach ($unregistered_sensors as $s_data) { if ($s_data['ip'] == $ip) { $id = $s_data['id']; break; } } if ($id == '') { $id = Av_sensor::get_id_by_ip($conn, $ip); } if ($id != '') { $disable_inputs = TRUE; $sname = 'sensor-' . str_replace('.', '-', $ip); } } $can_i_modify_elem = TRUE;