Index. php call File
/Common. inc. Php file
Template. func. Php file
<?
If (! Defined ('in _ site ')){
Exit ('Access denied! ');
}
Function checktplrefresh ($ tplfile, $ timecompare ){
Global $ tplrefresh;
If ($ tplrefresh = 1 & @ filemtime ($ tplfile )! = $ Timecompare ){
Parse_template ($ tplfile );
}
Return true;
}
Function template ($ file ){
Global $ tpldir, $ objdir;
$ Objfile = $ objdir. $ file. '. tpl. Php ';
If (! File_exists ($ objfile )){
$ Tplfile = effectpldir.20.file.'.htm ';
Parse_template ($ tplfile );
}
Return $ objfile;
}
Function parse_template ($ tplfile ){
Global $ tpldir, $ objdir;
$ File = basename ($ tplfile, '.htm ');
$ Objfile = $ objdir. $ file. '. tpl. Php ';
If (! $ Fp = @ fopen ($ tplfile, 'r ')){
Exit ("current template file '$ tplfile' not found or have no access! ");
}
$ Template = fread ($ fp, max (filesize ($ tplfile), 1 ));
Fclose ($ fp );
$ Template = preg_replace ("/[nrt] * {subtemplates + ([a-z0-9 _:] +)} [nrt] */is", "<? Php include template ('1');?> ", $ Template );
$ Template = preg_replace ("/([nr] +) t +/s", "1", $ template );
$ Template = preg_replace ("/<! -- {(. + ?)} -->/S "," {1} ", $ template );
$ Template = preg_replace ("/{($ [A-Za-z0-9 _ [] '" $. X7f-xff] +)}/s "," <? Php echo 1;?> ", $ Template );
$ Template = preg_replace ("/[nrt] * {evals + (. + ?)} [Nrt] */is "," <? Php 1;?> ", $ Template );
$ Template = preg_replace ("/[nrt] * {echos + (. + ?)} [Nrt] */is "," <? Php echo 1;?> ", $ Template );
$ Template = preg_replace ("/([nrt] *) {elseifs + (. + ?)} ([Nrt] *)/is "," 1 <? Php} elseif (2) {?> 3 ", $ template );
$ Template = preg_replace ("/([nrt] *) {else} ([nrt] *)/is", "1 <? Php} else {?> 2 ", $ template );
For ($ I = 0; $ I <5; $ I ++ ){
$ Template = preg_replace ("/[nrt] * {loops + (s +) s + (s +)} [nr] * (. + ?) [Nr] * {/loop} [nrt] */is "," <? Php if (is_array (1) {foreach (1 as 2) {?> 3 <? Php }}?> ", $ Template );
$ Template = preg_replace ("/[nrt] * {loops + (s +) s + (s +)} [nrt] * (. + ?) [Nrt] * {/loop} [nrt] */is "," <? Php if (is_array (1) {foreach (1 as 2 => 3) {?> 4 <? Php }}?> ", $ Template );
$ Template = preg_replace ("/([nrt] *) {ifs + (. + ?)} ([Nr] *) (. + ?) ([Nr] *) {/if} ([nrt] *)/is "," 1 <? Php if (2) {?> 345 <? Php }?> 6 ", $ template );
}
$ Template = preg_replace ("/{([a-za-z_x7f-xff] [a-za-z0-9_x7f-xff] *)}/s", "<? Php echo 1;?> ", $ Template );
$ Template = preg_replace ("/?> [Nr] * <? Php/s "," ", $ template );
$ Template = preg_replace ("/" (http )? [W./:] +? [^ "] +? & [^ "] +? "/E", "transamp ('') ", $ template );
$ Template = preg_replace ("/<script [^>] *? Src = "(. + ?) "(. *?)> S * </script>/ise "," strips tutorial criptamp ('1', '2') ", $ template );
$ Template = "<? Php if (! Defined ('in _ site') exit ('Access denied! '); Checktplrefresh (' $ tplfile', ". time ().");?> N $ template ";
If (! $ Fp = @ fopen ($ objfile, 'wb ')){
Exit ("directory '$ objdir' not found or have no access! ");
}
Flock ($ fp, lock_ex );
Fwrite ($ fp, $ template );
Flock ($ fp, lock_un );
Fclose ($ fp );
}
Function transamp ($ str ){
$ Str = str_replace ('&', '& amp;', $ str );
$ Str = str_replace ('& amp;', '& amp;', $ str );
$ Str = str_replace ('"', '"', $ str );
Return $ str;
}
Function stripscriptamp ($ s, $ extra ){
$ Extra = str_replace ('"', '"', $ extra );
$ S = str_replace ('& amp;', '&', $ s );
Return "<script src =" $ s "type =" text/webpage effects "$ extra> </script> ";
}
?>