/** * Renders available and enabled alerts into DarkVoid notification area * * @return void */ protected function updateAlerts() { //new tickets alert if ($this->altCfg['TB_NEWTICKETNOTIFY']) { $newticketcount = zb_TicketsGetAllNewCount(); if ($newticketcount != 0) { $this->alerts .= wf_Link('?module=ticketing', wf_img('skins/ticketnotify.gif', $newticketcount . ' ' . __('support tickets expected processing')), false); } } //new signups notification if ($this->altCfg['SIGREQ_ENABLED']) { $signups = new SignupRequests(); $newreqcount = $signups->getAllNewCount(); if ($newreqcount != 0) { $this->alerts .= wf_Link('?module=sigreq', wf_img('skins/sigreqnotify.gif', $newreqcount . ' ' . __('signup requests expected processing')), false); } } //check for unread messages in instant messanger if ($this->altCfg['TB_UBIM']) { if (cfr('UBIM')) { $unreadMessageCount = im_CheckForUnreadMessages(); if ($unreadMessageCount) { //we have new messages $unreadIMNotify = __('You received') . ' ' . $unreadMessageCount . ' ' . __('new messages'); $urlIM = $unreadIMNotify . wf_delimiter() . wf_Link("?module=ubim&checknew=true", __('Click here to go to the instant messaging service.'), false, 'ubButton'); $this->alerts .= wf_Link("?module=ubim&checknew=true", wf_img("skins/ubim_blink.gif", $unreadMessageCount . ' ' . __('new message received')), false, ''); //$this->alerts.=wf_modalOpened(__('New messages received'), $urlIM, '450', '200'); } } } //check sms sending queue if ($this->altCfg['WATCHDOG_ENABLED']) { $smsQueueCount = rcms_scandir(DATA_PATH . 'tsms/'); $smsQueueCount = sizeof($smsQueueCount); if ($smsQueueCount > 0) { $this->alerts .= wf_Link("?module=tsmsqueue", wf_img("skins/sms.png", $smsQueueCount . ' ' . __('SMS in queue')), false, ''); } } if ($this->altCfg['TB_TASKMANNOTIFY']) { //only "for me" tasks notification if ($this->altCfg['TB_TASKMANNOTIFY'] == 1) { $undoneTasksCount = ts_GetUndoneCountersMy(); if ($undoneTasksCount > 0) { $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ' ' . __('for me'); $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, ''); } } //total undone tasks count notification if ($this->altCfg['TB_TASKMANNOTIFY'] == 2) { $undoneTasksCount = ts_GetUndoneCountersAll(); if ($undoneTasksCount > 0) { $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ' ' . __('for all'); $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, ''); } } //total+my undone tasks count notification if ($this->altCfg['TB_TASKMANNOTIFY'] == 3) { $undoneTasksCount = ts_GetUndoneCountersAll(); if ($undoneTasksCount > 0) { $undoneTasksCountMy = ts_GetUndoneCountersMy(); $undoneAlert = $undoneTasksCount . ' ' . __('Undone tasks') . ': ' . __('for all') . ' ' . ($undoneTasksCount - $undoneTasksCountMy) . ' / ' . __('for me') . ' ' . $undoneTasksCountMy; $this->alerts .= wf_Link("?module=taskman&show=undone", wf_img("skins/jobnotify.png", $undoneAlert), false, ''); } } } //switchmon at notify area if ($this->altCfg['TB_SWITCHMON']) { $dead_raw = zb_StorageGet('SWDEAD'); $last_pingtime = zb_StorageGet('SWPINGTIME'); $deathTime = zb_SwitchesGetAllDeathTime(); $deadarr = array(); $content = ''; if ($this->altCfg['SWYMAP_ENABLED']) { $content = wf_Link('?module=switchmap', wf_img('skins/swmapsmall.png', __('Switches map')), false); } $content .= wf_AjaxLoader() . wf_AjaxLink("?module=switches&forcereping=true&ajaxping=true", wf_img('skins/refresh.gif', __('Force ping')), 'switchping', true, ''); if ($dead_raw) { $deadarr = unserialize($dead_raw); if (!empty($deadarr)) { //there is some dead switches $deadcount = sizeof($deadarr); if ($this->altCfg['SWYMAP_ENABLED']) { //getting geodata $switchesGeo = zb_SwitchesGetAllGeo(); } //ajax container $content .= wf_tag('div', false, '', 'id="switchping"'); foreach ($deadarr as $ip => $switch) { if ($this->altCfg['SWYMAP_ENABLED']) { if (isset($switchesGeo[$ip])) { if (!empty($switchesGeo[$ip])) { $devicefind = wf_Link('?module=switchmap&finddevice=' . $switchesGeo[$ip], wf_img('skins/icon_search_small.gif', __('Find on map'))) . ' '; } else { $devicefind = ''; } } else { $devicefind = ''; } } else { $devicefind = ''; } //check morgue records for death time if (isset($deathTime[$ip])) { $deathClock = wf_img('skins/clock.png', __('Switch dead since') . ' ' . $deathTime[$ip]) . ' '; } else { $deathClock = ''; } //switch location link $switchLocator = wf_Link('?module=switches&gotoswitchbyip=' . $ip, web_edit_icon(__('Go to switch'))); //add switch as dead $content .= $devicefind . ' ' . $switchLocator . ' ' . $deathClock . $ip . ' - ' . $switch . '<br>'; } //ajax container end $content .= wf_delimiter() . __('Cache state at time') . ': ' . date("H:i:s", $last_pingtime) . wf_tag('div', true); $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('Dead switches') . ': ' . $deadcount, __('Dead switches'), $content, '', '500', '400') . wf_tag('div', true); } else { $content .= wf_tag('div', false, '', 'id="switchping"') . __('Switches are okay, everything is fine - I guarantee') . wf_delimiter() . __('Cache state at time') . ': ' . date("H:i:s", $last_pingtime) . wf_tag('div', true); $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('All switches alive'), __('All switches alive'), $content, '', '500', '400') . wf_tag('div', true); } } else { $content .= wf_tag('div', false, '', 'id="switchping"') . __('Switches are okay, everything is fine - I guarantee') . wf_delimiter() . __('Cache state at time') . ': ' . @date("H:i:s", $last_pingtime) . wf_tag('div', true); $this->alerts .= wf_tag('div', false, 'ubButton') . wf_modal(__('All switches alive'), __('All switches alive'), $content, '', '500', '400') . wf_tag('div', true); } } file_put_contents(self::CACHE_PATH . self::CACHE_PREFIX . $this->myLogin, $this->alerts); }
/** * Shows time machine snapshot by its ID * * @param int $snapshotid */ function ub_SwitchesTimeMachineShowSnapshot($snapshotid) { $snapshotid = vf($snapshotid, 3); $query = "SELECT * from `switchdeadlog` WHERE `id`='" . $snapshotid . "'"; $deaddata = simple_query($query); $deathTime = zb_SwitchesGetAllDeathTime(); if (!empty($deaddata)) { $deadarr = unserialize($deaddata['swdead']); $cells = wf_TableCell(__('Switch dead since')); $cells .= wf_TableCell(__('IP')); $cells .= wf_TableCell(__('Location')); $rows = wf_TableRow($cells, 'row1'); if (!empty($deadarr)) { foreach ($deadarr as $ip => $location) { $cells = wf_TableCell(@$deathTime[$ip]); $cells .= wf_TableCell($ip); $cells .= wf_TableCell($location); $rows .= wf_TableRow($cells, 'row3'); } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); show_window(__('Dead switches') . ' ' . $deaddata['date'], $result); show_window('', wf_Link("?module=switches&timemachine=true", 'Back', false, 'ubButton')); } }
$macfilter = ''; $filter = !empty($fdbSwitchFilter) ? '&swfilter=' . $fdbSwitchFilter : ''; $macfilter = !empty($fdbMacFilter) ? '&macfilter=' . $fdbMacFilter : ''; $filtersForm = wf_modalAuto(web_icon_search('MAC filters setup'), __('MAC filters setup'), web_FDBTableFiltersForm(), ''); $logControls = web_FDBTableLogControl(); $columns = array('Switch IP', 'Port', 'Location', 'MAC', 'User'); $result = wf_JqDtLoader($columns, '?module=switchpoller&ajax=true' . $filter . $macfilter, true, 'Objects', 100); show_window(__('Current FDB cache') . ' ' . $filtersForm . ' ' . $logControls, $result); } $allDevices = sp_SnmpGetAllDevices(); $allTemplates = sp_SnmpGetAllModelTemplates(); $allTemplatesAssoc = sp_SnmpGetModelTemplatesAssoc(); $allusermacs = zb_UserGetAllMACs(); $alladdress = zb_AddressGetFullCityaddresslist(); $alldeadswitches = zb_SwitchesGetAllDead(); $deathTime = zb_SwitchesGetAllDeathTime(); //poll single device if (wf_CheckGet(array('switchid'))) { $switchId = vf($_GET['switchid'], 3); if (!empty($allDevices)) { foreach ($allDevices as $ia => $eachDevice) { if ($eachDevice['id'] == $switchId) { //detecting device template if (!empty($allTemplatesAssoc)) { if (isset($allTemplatesAssoc[$eachDevice['modelid']])) { if (!isset($alldeadswitches[$eachDevice['ip']])) { //cache cleanup if (wf_CheckGet(array('forcecache'))) { $deviceRawSnmpCache = rcms_scandir('./exports/', $eachDevice['ip'] . '_*'); if (!empty($deviceRawSnmpCache)) { foreach ($deviceRawSnmpCache as $ir => $fileToDelete) {