SSI in YaBB2 Template
1.3
This is an updated version of mod made by Techneaux (Jay Silverman), it has been modified for YaBB2.
This mod lets you use the SSI command in your template.
Version 1.3 Had to rewrite as I previously somehow lost it and released the old version of mod.
Version 1.2 Modified for YaBB2, added listing to ModList.
Version 1.1 fixed a little bug.
Kong (kong@3dxl.com
http://www.3dxl.com
Admin/ModList.pl
### END BOARDMOD ANCHOR ###
$template_ssi_include = "SSI in YaBB2 Template|Kong|This mod lets you use the <!--#include file="filename" --> SSI command in your template.|1.3|June 8, 2005";
push (@installed_mods, "$template_ssi_include");
Sources\Subs.pl
@yytemplate = ;
fclose(TEMPLATE);
foreach $yytemplate (@yytemplate){
$yytemplate =~ s/<\!--#include file\s*?=\s*?"(\S+?)"\s*?-->/${\(VNFileLoad($1))}/gi;
}
}
$yyurl = $scripturl;
$curline =~ s~~${"yy$1"}~g;
$curline =~ s~~${\(IncludeFile($1))}~g;
$curline =~ s~img src\=\"$imagesdir\/(.+?)\"~&ImgLoc($1)~eisg;
$curline =~ s~alt\=\"(.*?)\"~alt\=\"$1\" title\=\"$1\"~ig;
$output .= $curline;
}
if($yycopyin == 0) {
$output = q~Sorry, the copyright tag must be in the template.
Please notify this forum's administrator that this site is using an ILLEGAL copy of YaBB!
~;
}
# do output
if ($gzcomp && $gzaccept) {
if ($gzcomp==1) {
$| = 1;
open(GZIP, "| gzip -f");
print GZIP $output;
close(GZIP);
} else {
require Compress::Zlib;
binmode STDOUT;
print Compress::Zlib::memGzip($output);
}
} else { print $output; }
}
sub VNFileLoad {
my $fname = shift;
my $file;
$fname =~ s/([\&;\`'\|\"*\?\~\^\(\)\[\]\{\}\$\n\r])//g;
open(FILE, $fname) || return '[an error occured while processing this directive]';
my @file = ;
close(FILE);
$file = join('', @file);
return $file;
}