id = $system->getRequest('id', 0); global $config; echo "'; if (!$system->getConfig('metaconsole')) { $this->agent = agents_get_agents( [ 'disabled' => 0, 'id_agente' => $this->id, ], ['*'] ); } else { $this->agent = agents_get_meta_agents( [ 'disabled' => 0, 'id_agente' => $this->id, ], ['*'] ); } if (!empty($this->agent)) { $this->agent = $this->agent[0]; if ($system->checkACL('AR', $this->agent['id_grupo'])) { $this->correct_acl = true; } else { $this->correct_acl = false; } } else { $this->agent = null; $this->correct_acl = true; } } public function show() { if (!$this->correct_acl) { $this->show_fail_acl(); } else { $this->show_agent(); } } private function show_fail_acl() { $error['type'] = 'onStart'; $error['title_text'] = __('You don\'t have access to this page'); $error['content_text'] = System::getDefaultACLFailText(); if (class_exists('HomeEnterprise')) { $home = new HomeEnterprise(); } else { $home = new Home(); } $home->show($error); } public function ajax($parameter2=false) { $system = System::getInstance(); if (!$this->correct_acl) { return; } else { switch ($parameter2) { case 'render_events_bar': $agent_id = $system->getRequest('agent_id', '0'); $width = $system->getRequest('width', '400'); graph_graphic_agentevents( $agent_id, $width, 30, SECONDS_1DAY, ui_get_full_url(false) ); exit; } } } private function show_agent() { $ui = Ui::getInstance(); $system = System::getInstance(); $ui->createPage(); if ($this->id != 0) { $agent_alias = (string) $this->agent['alias']; $agents_filter = (string) $system->getRequest('agents_filter'); $agents_filter_q_param = empty($agents_filter) ? '' : '&agents_filter='.$agents_filter; $ui->createDefaultHeader( sprintf('%s', $agent_alias), $ui->createHeaderButton( [ 'icon' => 'back', 'pos' => 'left', 'text' => __('Back'), 'href' => 'index.php?page=agents'.$agents_filter_q_param, ] ) ); } else { $ui->createDefaultHeader(__('Agents')); } $ui->showFooter(false); $ui->beginContent(); if (empty($this->agent)) { $ui->contentAddHtml( ''.__('No agent found').'' ); } else { $ui->contentBeginGrid(); if ($this->agent['disabled']) { $agent_alias = ''.$agent_alias.''.ui_print_help_tip(__('Disabled'), true); } else if ($this->agent['quiet']) { $agent_alias = ''.$agent_alias.' '.html_print_image( 'images/dot_blue.png', true, [ 'border' => '0', 'title' => __('Quiet'), 'alt' => '', ] ).''; } if ($system->getConfig('metaconsole')) { metaconsole_connect(null, $this->agent['id_tmetaconsole_setup']); // ~ $addresses = agents_get_addresses($this->agent['id_tagente']); } else { $addresses = agents_get_addresses($this->id); } if ($system->getConfig('metaconsole')) { metaconsole_restore_db(); } $address = $this->agent['direccion']; // ~ foreach ($addresses as $k => $add) { // ~ if ($add == $address) { // ~ unset($addresses[$k]); // ~ } // ~ } // ~ $ip = html_print_image('images/world.png', // ~ true, array('title' => __('IP address'))) . // ~ ' '; $ip .= empty($address) ? ''.__('N/A').'' : $address; // ~ if (!empty($addresses)) { // ~ $ip .= ui_print_help_tip(__('Other IP addresses') . // ~ ': ' . implode(', ',$addresses), true); // ~ } $last_contact = ''.__('Last contact').': '.ui_print_timestamp($this->agent['ultimo_contacto'], true); // ~ $description = '' . __('Description') . ': '; if (empty($agent['comentarios'])) { $description .= ''.__('N/A').''; } else { $description .= $this->agent['comentarios']; } $html = '