[! use strict; use Proxmox::Utils; use Proxmox::Config::System; use Proxmox::ConfigServer; use Proxmox::HTMLTable; use Proxmox::Form; !] [- my $system_cfg = $fdat{__system_config}; my $out = ""; my $url = $req_rec->uri; my $conn = Proxmox::ConfigClient::connect (); if ($fdat{action} eq 'update') { if ($udat{AM} eq 'w') { $udat{update_log} = $conn->clamav_freshclam ()->result; } else { $udat{popup_error} = Proxmox::Utils::msg ('nowr'); } } my @cellwidth = ( '70px','200px', '60px', '100px'); my @header = ( '1', '70px', __('File'), '1', '200px', __('Build time'), '1', '60px', __('Version'), '1', '100px', __('Signatures') ); my $table = Proxmox::HTMLTable->new (\@cellwidth); $table->add_headline (\@header); my $res; eval { $res = $conn->clamav_dbstat ('main')->result; $table->add_row ('' , 'main', $res->{btime}, $res->{version}, $res->{nsigs}); }; eval { $res = $conn->clamav_dbstat ('daily')->result; $table->add_row ('' , 'daily', $res->{btime}, $res->{version}, $res->{nsigs}); }; $out .= $table->out_table(); my $frm = Proxmox::Form->new (\%fdat); $frm->add_cfg_element('clamav', "dbmirror", "text", "database.clamav.net", __("Database Mirror")); if ($udat{update_log} && !$fdat{action}) { $frm->add_element("update_log", "textarea", $udat{update_log}, __("Update Log")); delete $udat{update_log}; } $frm->add_element(__("Update now"), "link", "$url?action=update", ""); $frm->add_element("m3", "hidden"); if ($frm->submit==0) { $frm->load_cfg ($system_cfg); } else { if ($udat{AM} eq 'w') { $frm->save_cfg ($system_cfg); $conn->rewrite_config_clam (); $conn->service_cmd ('freshclam', 'restart'); } else { $udat{popup_error} = Proxmox::Utils::msg ('nowr'); } } $out .= "
" . $frm->out_form; print OUT $out; -]