<?php
/******************************************************************
* $Id: template.php,v 1.11 2003/08/22 20:57:39 allowee Exp $
*
* Copyright (C) 2001-2003 PMS Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* The "GNU General Public License" (GPL) is available at
* http://www.gnu.org/copyleft/gpl.html.
******************************************************************/
/****************************************
*
*
* THIS FILES IS NOT BEING USED !!!!!!!
*
****************************************/
class Template {
/* get template */
function get($templatename) {
global $full_path;
if(!isset($this->templates[$templatename])) {
if(file_exists($full_path."/templates/".$templatename.".tpl")){
$templatedata = str_replace("\"","\\\"",implode("",file($full_path."/templates/".$templatename.".tpl")));
}else{
$templatedata = str_replace("\"","\\\"",implode("",file($full_path."/templates/no_such_template.tpl")));
}
}
return $templatedata;
}
/* print template */
function output($template) {
global $pagestarttime, $querytimer, $query_count;
// $totaltime=microtime_past($pagestarttime,microtime());
// eval ("\$totaltimemsg = \"".$this->get("footer_totaltimemsg")."\";");
// $template = str_replace("{totaltimemsg}",$totaltimemsg,$template);
// headers::send();
// $template = $this->replacevars($template);
echo $template;
}
/* replace vars
function replacevars($template) {
global $db, $n, $pmpopup, $PHP_SELF;
$hash="";
if(strstr($template,"<title>")) {
$hash = md5(uniqid(microtime()));
$x = strpos($template,"<title>");
$y = strpos($template,"</title>");
$temp = substr($template,$x,$y-$x+8);
$template = substr($template,0,$x) . $hash . substr($template,$y+8);
}
$result = $db->query("SELECT variable,substitute FROM bb".$n."_subvariables WHERE subvariablepackid = '".$this->subvariablepackid."'");
while($row = $db->fetch_array($result)) {
switch($row['variable']) {
case "<body": $template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{css}": $template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{cssfile}": $template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{imageback}": $template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{imagelogo}": $template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
case "{!DOCTYPE}": $template = $this->str_replace($row['variable'],$row['substitute'],$template); break;
default: $template = str_replace($row['variable'],$row['substitute'],$template);
}
}
if($hash!="") $template = str_replace($hash,$temp,$template);
return $template;
}
*/
}
$template = new Template;
$username = 'Allowee';
define('ROCK', 'Rock!!');
$rock = ROCK;
//eval ("\$test = \"".$template->get("footer_totaltimemsg")."\";");
//eval ('$test = "'.$template->get("footer_totaltimemsg").'";');
//echo $test;
?>