Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
function get_monitored_devices($conn)
{
    $devices = calc_devices_total($conn);
    $return['error'] = FALSE;
    $return['output'] = format_notif_number($devices);
    return $return;
}