|
From: Sven <bra...@us...> - 2005-01-09 12:57:41
|
Update of /cvsroot/osbb/osbb/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29649/lib Modified Files: class_template.php constants.php Log Message: Added posibility to deactivate template caching Index: constants.php =================================================================== RCS file: /cvsroot/osbb/osbb/lib/constants.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** constants.php 7 Jan 2005 12:15:44 -0000 1.3 --- constants.php 9 Jan 2005 12:57:32 -0000 1.4 *************** *** 26,29 **** --- 26,33 ---- } + //yes and no + define('YES',1); + define('NO',0); + //table names define('TABLE_ADMINPERMISSIONS',$prefix.'_adminpermissions'); *************** *** 68,71 **** --- 72,78 ---- define('DEBUG_MODE_ADMIN_USERID',1); //the userid of the administrator! + //template cache + define('TEMPLATE_CACHE',NO); //set this to NO to deactivate template caching + //error handling define('ERROR_FATAL',1); Index: class_template.php =================================================================== RCS file: /cvsroot/osbb/osbb/lib/class_template.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** class_template.php 1 Jan 2005 17:50:32 -0000 1.3 --- class_template.php 9 Jan 2005 12:57:32 -0000 1.4 *************** *** 86,99 **** global $sql,$lang; if(!isset($this->vars[$name])) $this->vars[$name] = array(); ! $vars = array_merge($this->vars[0],$this->vars[$name]); $this->vars[$name] = array(); ! if(file_exists('./cache/templates/'.$this->tplpackid.'_'.$name.'.php')) include('./cache/templates/'.$this->tplpackid.'_'.$name.'.php'); ! elseif(file_exists('./cache/templates/0_'.$name.'.php')) include('./cache/templates/0_'.$name.'.php'); ! else{ $res = $sql->query("SELECT * FROM ".TABLE_TEMPLATES." WHERE templatename = '".addslashes($name)."'"); if ($sql->num_rows($res) == 0) osbb_die(ERROR_WARNING,'The template '.$name.' doesnt exists!',__FILE__,__LINE__); else{ $res = $sql->fetch_array($res); ! if($this->save_cached($name,$this->tplpackid,$res['template'])) include('./cache/templates/'.$this->tplpackid.'_'.$name.'.php'); } } --- 86,108 ---- global $sql,$lang; if(!isset($this->vars[$name])) $this->vars[$name] = array(); ! $vars = array_merge($this->vars['0'],$this->vars[$name]); $this->vars[$name] = array(); ! if(TEMPLATE_CACHE == YES){ ! if(file_exists('./cache/templates/'.$this->tplpackid.'_'.$name.'.php')) include('./cache/templates/'.$this->tplpackid.'_'.$name.'.php'); ! elseif(file_exists('./cache/templates/0_'.$name.'.php')) include('./cache/templates/0_'.$name.'.php'); ! else{ ! $res = $sql->query("SELECT * FROM ".TABLE_TEMPLATES." WHERE templatename = '".addslashes($name)."'"); ! if ($sql->num_rows($res) == 0) osbb_die(ERROR_WARNING,'The template '.$name.' doesnt exists!',__FILE__,__LINE__); ! else{ ! $res = $sql->fetch_array($res); ! if($this->save_cached($name,$this->tplpackid,$res['template'])) include('./cache/templates/'.$this->tplpackid.'_'.$name.'.php'); ! } ! } ! }else{ $res = $sql->query("SELECT * FROM ".TABLE_TEMPLATES." WHERE templatename = '".addslashes($name)."'"); if ($sql->num_rows($res) == 0) osbb_die(ERROR_WARNING,'The template '.$name.' doesnt exists!',__FILE__,__LINE__); else{ $res = $sql->fetch_array($res); ! eval('?> '.$this->cache('Temporary cached template',$this->tplpackid,$res['template'])); } } |