[! use strict; use Proxmox::Utils; use Proxmox::HTMLTable; use Proxmox::HTMLDropDown; use Proxmox::Form; use Proxmox::License; use Proxmox::ConfigServer; use HTML::Entities; !] [- my $out = ''; my $frm = Proxmox::Form->new (\%fdat); $frm->add_element('LicFile', "file", '', __('Upload new license file'), ''); if ($frm->submit == 1) { if ($udat{AM} eq 'w') { if ($fdat{LicFile}) { my $buffer = ""; my $oldlic = Proxmox::License->new (); my $was_free = $oldlic->demo_msg; my $tmpfn = "/etc/proxmox/license.dat.tmp"; open FILE, ">$tmpfn"; print FILE $buffer while read($fdat{LicFile}, $buffer, 32768); close FILE; my $newlic = Proxmox::License->new ($tmpfn, '*'); if ($newlic->valid) { my $conn = Proxmox::ConfigClient::connect (); if ($newlic->license_type eq 'PMG_KAV') { rename $tmpfn, "/etc/proxmox/kavlicense.dat"; $conn->rewrite_config_kav (); $conn->service_cmd ('aveserver', 'restart'); $conn->service_cmd ('proxprox', 'reload'); } else { rename $tmpfn, "/etc/proxmox/license.dat"; # reset rule database if someone tries to downgrade $conn->reset_ruledb () if $newlic->demo_msg && !$was_free; # reload postfix because domains may have changed $conn->rewrite_config_postfix (); $conn->service_cmd ('proxprox', 'reload'); $conn->service_cmd ('postfix', 'reload'); } } else { $udat{popup_error} = __("Invalid file - not uploaded") . ": " . $newlic->status_text; unlink $tmpfn; } } } else { $udat{popup_error} = Proxmox::Utils::msg ('nowr'); } } my $lic = Proxmox::License->new (); if (my $msg = $lic->demo_msg) { $out .= "

$msg


"; } my @cellwidth = ('250px', '490px'); my @header; if ($lic->valid()) { @header = ('3', '200px', __('License Information')); } else { @header = ('3', '200px', __('License Invalid')); } my $table = Proxmox::HTMLTable->new (\@cellwidth); $table->add_headline (\@header); if ($lic->valid()) { $table->add_row ('', __("License Nr."), $lic->{data}->{licensenr}); $table->add_row ('', __("Company"), encode_entities ($lic->{data}->{company})); $table->add_row ('', __("Name"), encode_entities ($lic->{data}->{firstname} . " " . $lic->{data}->{lastname})); $table->add_row ('', __("Product"), $lic->product_name); $table->add_row ('', __("Expires"), $lic->expiration_text); $table->add_row ('', __("License MAC Address"), $lic->{data}->{hwaddress}) if $lic->{data}->{hwaddress}; } if (my $msg = $lic->status_text) { $table->add_row ('', __("Attention"), "$msg"); $table->add_row ('', __("Host MAC Address"), Proxmox::Utils::get_hwaddress); } $out .= $table->out_table(); # kaspersky license info my $lic = Proxmox::License->kavnew (); if ($lic->file_exists) { if ($lic->valid()) { @header = ('3', '400px', 'Kaspersky Antivirus - ' . __('License Information')); } else { @header = ('3', '400px', 'Kaspersky Antivirus - ' . __('License Invalid')); } $table = Proxmox::HTMLTable->new (\@cellwidth); $table->add_headline (\@header); if ($lic->valid()) { $table->add_row ('', __("License Nr."), $lic->{data}->{licensenr}); $table->add_row ('', __("Company"), encode_entities ($lic->{data}->{company})); $table->add_row ('', __("Name"), encode_entities ($lic->{data}->{firstname} . " " . $lic->{data}->{lastname})); $table->add_row ('', __("Product"), sprintf ($lic->product_name . ' (' . __("%d users") . ')', $lic->{data}->{maxusers})); $table->add_row ('', __("Expires"), $lic->expiration_text); $table->add_row ('', __("License MAC Address"), $lic->{data}->{hwaddress}) if $lic->{data}->{hwaddress}; } if (my $msg = $lic->status_text) { $table->add_row ('', __("Attention"), "$msg"); $table->add_row ('', __("Host MAC Address"), Proxmox::Utils::get_hwaddress); } $out .= "
" . $table->out_table(); } $out .= "
" .$frm->out_form; print OUT $out; -]