template_error("Template file [admin_dir]/template/*******/$filename.tmpl is corrupt! It does not contain the <!--END--> identifier. Perhaps it was not completely uploaded!") if !grep(m|^\s*<!--END-->\s*$|, @template);
performance_string("+ inserting template ($filename.tmpl) via templ_int");
while ($_ = shift(@template)) {
return (parse_handle(\@template, $substitutions, 1))[0] if m|^\s*<!--BEGIN-->\s*$|;
}
template_error("Template file [admin_dir]/template/*******/$filename.tmpl is corrupt! It does not contain a <!--BEGIN--> identifier!");
}
sub fetch_template_file {
my ($filename, $forcedir, $docache) = @_;
my @dirs = ('custom', 'pro', 'admin', 'ui', 'mailmesg');
# @dirs = ($forcedir) if defined $forcedir;
performance_string("< fetch_template_file for file $filename [force dir: $forcedir]");
template_error("Recursive Part Call Error: Template depth limited to 50 levels for safety reasons. Expect a recursive call from a template to itself. Part called: [$part]; line $line") if $substitutions->{'_internal'}->{'depth'} > 50;
if ($once ne "" && defined $PARAMS->{"once,$topic,$part"}) {
template_error("Recursive Template Call Error: Template depth limited to 50 levels for safety reasons. Expect a recursive call from a template to itself. Last template: [$template]") if $substitutions->{'_internal'}->{'depth'} > 50;
template_error("Invalid selection index '$item_choice' in [$match]!");
}
my $arrindex = ($item_no - 1) % scalar(@item_choose);
&template_error("Use of undefined index [ $item_choose[$arrindex] ] for array index $arrindex in item choices ($item_choice)!") unless (@{ $substitutions->{$arrayname} })[ $item_choose[$arrindex] - 1 ];
template_error("Invalid selection index '$item_choice' in [$match]!");
}
my $arrindex = ($item_no - 1) % scalar(@item_choose);
&template_error("Use of undefined index [ $item_choose[$arrindex] ] for array index $arrindex in item choices ($item_choice)!") unless (@{ $substitutions->{$arrayname} })[ $item_choose[$arrindex] - 1 ];
$msg .= "<p>Perhaps the command <#$1 ... #> does not exist?</p>";
}
template_error($msg);
}
if ($GLOBAL_OPTIONS->{'version_verify'}) {
my $str1 = "<is><dfoufs><gpou dpmps=#gg0000 tjaf=4>Uijt tpguxbsf jt cfjoh vtfe jo wjpmbujpo pg jut mjdfotf bhsffnfou.</gpou></dfoufs><is>"; $str1 =~ tr/B-ZAb-za/A-Za-z/;
my $str2 = "<is><dfoufs><gpou dpmps=#gg0000 tjaf=4>Qmfbtf fodpvsbhf uif cpbse benjojtusbups up qspqfsmz sfhjtufs uijt tpguxbsf.</gpou></dfoufs><is>"; $str2 =~ tr/B-ZAb-za/A-Za-z/;
$text =~ s/<body([^>]*)>/<body$1>$str1/ig;
$text =~ s/<\/body([^>]*)>/<\/body$1>$str2/ig;
}
$text =~ s/\s*\\\s*$//;
return $text;
}
sub program_sub {
my ($requirement, $subroutine, $arguments) = @_;
dreq($requirement) if $requirement ne "";
my @arg = split(/,/, $arguments);
foreach my $argu (@arg) {
$argu = trim($argu);
$argu = $1 if $argu =~ /"(.*)"/;
}
my $j = \&{ $subroutine };
my $K = eval '&{ $j }(@arg);';
return $K;
}
sub element_array_grep {
my ($substitutions, $element, $pattern, $arrayname, $return_key, $match) = @_;
return "" if $pattern eq "";
if (ref $substitutions->{$arrayname} ne "ARRAY") {
$match =~ s/</</g; $match =~ s/>/>/g;
template_error("Use of undefined array \@$arrayname in grep statement [$match]");
}
my $x = (grep($_->{$element} eq $pattern, @{ $substitutions->{$arrayname} }))[0];