..\inc\common.php function pageTemplate($data){ $id = $data[0]; global $conf; global $INFO; $path = dirname(wikiFN($id)); $path = str_replace('\\' , '/' , $path ); $file = $path.'/_template.txt'; if (@file_exists($file)) { $tpl = io_readFile($file); }else{ $pathmin = $conf['datadir']; $pathmin = str_replace('\\' , '/' , $pathmin ); while ( strlen($path) >= strlen($pathmin) ){ $file = $path.'/_template_subdir.txt'; if (@file_exists($file)) { $tpl = io_readFile($file); break; } $path = substr($path , 0 , strrpos($path , '/')); } } // $tpl = io_readFile(dirname(wikiFN($id)).'/_template.txt'); $tpl = str_replace('@ID@',$id,$tpl); $tpl = str_replace('@NS@',getNS($id),$tpl); $tpl = str_replace('@PAGE@',strtr(noNS($id),'_',' '),$tpl); $tpl = str_replace('@USER@',$_SERVER['REMOTE_USER'],$tpl); $tpl = str_replace('@NAME@',$INFO['userinfo']['name'],$tpl); $tpl = str_replace('@MAIL@',$INFO['userinfo']['mail'],$tpl); $tpl = str_replace('@DATE@',date($conf['dformat']),$tpl); return $tpl; }