| Server IP : 170.10.161.225 / Your IP : 216.73.216.78 Web Server : Apache System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : calvet ( 273824) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : ON Directory : /lib64/perl5/vendor_perl/Razor2/Preproc/ |
Upload File : |
package Razor2::Preproc::enBase64;
sub new {
return bless {}, shift;
}
sub isit {
my ( $self, $text ) = @_;
my $is_binary = ( $$text =~ /^Content-Type-Encoding: 8-bit/ )
|| ( $$text =~ /([\x00-\x1f|\x7f-\xff])/ and $1 !~ /[\r\n\t]/ );
return $is_binary;
}
sub doit {
my ( $self, $text ) = @_;
pos($$text) = 0; # ensure start at the beginning
my $res = join '', map( pack( 'u', $_ ) =~ /^.(\S*)/, ( $$text =~ /(.{1,45})/gs ) );
$res =~ tr|` -_|AA-Za-z0-9+/|; # `# help emacs
# fix padding at the end
my $padding = ( 3 - length($$text) % 3 ) % 3;
$res =~ s/.{$padding}$/'=' x $padding/e if $padding;
# split into lines
$res =~ s/(.{1,76})/$1\n/g;
$res = "Content-Transfer-Encoding: base64\n\n$res";
$$text = $res;
}
1;