package IId4a7c17b46bb480efd9d457a0c307ddc; use strict 'vars'; use base qw/II204db1fcd6a282b2f54a7833efd41684/; use Archive::Zip; use File::Temp qw/tempfile/; use II4212c07ddfb1652c969722f1a6817994; use IIa67e09caf104f2e50322b7bc59b766fb; use IId32b8941148ee7989049ee1cb1516c83; BEGIN{*IId4a7c17b46bb480efd9d457a0c307ddc::IlIIIIlllIIllIlI=\%{pack('H6','0e7405')^'K:S'};*IId4a7c17b46bb480efd9d457a0c307ddc::lIIlIllIlIlIIIII=\&{pack('H24','2f5238556e7b27737637410a')^'B3Q;TATKAU9>'};$IId4a7c17b46bb480efd9d457a0c307ddc::lIIIlIIlIIIIIIIl=pack('H18','1f00140906031a0b04')^'WT@YYKUXP';$IId4a7c17b46bb480efd9d457a0c307ddc::IIIIlIIllIlllllI=pack('H12','741d17181801')^'>TYTQB'};sub mnt { my ($class, $C) = @_; my $in = $C->{INPUT}; my $request = Zen->getRequest; return unless $in->{export}; my $admin = IIa67e09caf104f2e50322b7bc59b766fb::IIllIlIIllIllIll($II204db1fcd6a282b2f54a7833efd41684::llIIIllllIllIIIl{$II4212c07ddfb1652c969722f1a6817994::llIIlllIlIlllllI},47,$II204db1fcd6a282b2f54a7833efd41684::llIIIllllIllIIIl{$IId4a7c17b46bb480efd9d457a0c307ddc::IIIIlIIllIlllllI})->getAdmin; unless ($admin->{passwd} eq $in->{admin_password}) { $C->{Error} = 'AdminPasswordMismatch'; return; } my $cc_key = IId4a7c17b46bb480efd9d457a0c307ddc::lIIlIllIlIlIIIII($IId4a7c17b46bb480efd9d457a0c307ddc::IlIIIIlllIIllIlI{$IIa67e09caf104f2e50322b7bc59b766fb::lIlIIlIIlIIlllll},179,$IId4a7c17b46bb480efd9d457a0c307ddc::IlIIIIlllIIllIlI{$II204db1fcd6a282b2f54a7833efd41684::IIllIIllIllIllll})->getk; if ($in->{include_cc_data}) { unless ($cc_key) { $C->{Error} = 'CCKeyNotInstalled'; return; } unless ($cc_key eq $in->{cc_security_key}) { $C->{Error} = 'CCKeyMismatch'; return; } } my $dbc = II204db1fcd6a282b2f54a7833efd41684::lIIIllIllIllIllI($IId4a7c17b46bb480efd9d457a0c307ddc::IlIIIIlllIIllIlI{$IId4a7c17b46bb480efd9d457a0c307ddc::lIIIlIIlIIIIIIIl},994,$IId4a7c17b46bb480efd9d457a0c307ddc::IlIIIIlllIIllIlI{$IId4a7c17b46bb480efd9d457a0c307ddc::IIIIlIIllIlllllI})->get; my $zip = Archive::Zip->new(); for my $tbl (grep { /^jin_/ } $dbc->getColumn("show tables")) { if ($tbl eq 'jin_ccs') { if ($in->{include_cc_data}) { my $data = join(',', qw/user_id type number exp_month exp_year/) . "\n"; for my $user_id ($dbc->getColumn("select user_id from $tbl where user_id>0")) { my $ccd = IIa67e09caf104f2e50322b7bc59b766fb::IIllllllllIllIII($IId32b8941148ee7989049ee1cb1516c83::IIIIIIlllIIIIlII{$II204db1fcd6a282b2f54a7833efd41684::lIllllIIllIlIlII},179,$IId32b8941148ee7989049ee1cb1516c83::IIIIIIlllIIIIlII{$IIa67e09caf104f2e50322b7bc59b766fb::IlIIIllIIlIlllII})->loadForUser($user_id); $data .= join(',', $user_id, $ccd->{cardtype}, $ccd->{cardnumber}, $ccd->{cardexpmonth}, $ccd->{cardexpyear}) . "\n"; $zip->addString($data, "$tbl.csv"); } } } else { my @fields = $dbc->getColumn("desc $tbl"); my ($tmp_fh, $tmp_file) = tempfile(); my $iter = $dbc->getRecordsIterator("select * from $tbl"); $class->writeCSVFromIterToFH($iter, $tmp_fh, \@fields, \@fields, $in->{owner_id} ? $in->{owner_id} : 0, $tbl); close $tmp_fh; $zip->addFile($tmp_file, "$tbl.csv"); } } my $tstamp = IId4a7c17b46bb480efd9d457a0c307ddc::lIIlIllIlIlIIIII($IIa67e09caf104f2e50322b7bc59b766fb::IllIlIIllIIIlIlI{$IId4a7c17b46bb480efd9d457a0c307ddc::lIIIlIIlIIIIIIIl},1010,$IIa67e09caf104f2e50322b7bc59b766fb::IllIlIIllIIIlIlI{$IId32b8941148ee7989049ee1cb1516c83::lIIlllIIlIllIlIl})->new->datetime; $tstamp =~ s/\D//g; my $zipfilename = "delavo_full_db_$tstamp"; print "Content-Type: application/zip; name=\"$zipfilename.zip\"\n"; print "Content-Disposition: attachment; filename=\"$zipfilename.zip\"\n\n"; $zip->writeToFileHandle(\*STDOUT); Zen->getRequest->finish; return; } 1; 