- added test that $_SERVER['SCRIPT_NAME'] does exist in Smarty.class.php

This commit is contained in:
Uwe.Tews
2010-01-25 19:02:34 +00:00
parent 8defafbb14
commit 3c88d12e00
2 changed files with 15 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
01/25/2010
- bugfix cache resource was not loaded when caching was globally off but enabled at a template object
- added test that $_SERVER['SCRIPT_NAME'] does exist in Smarty.class.php
01/22/2010
- new method $smarty->createData([$parent]) for creating a data object (required for bugfixes below)

View File

@@ -267,8 +267,10 @@ class Smarty extends Smarty_Internal_Data {
}
}
}
if (isset($_SERVER['SCRIPT_NAME'])) {
$this->assign_global('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
}
}
/**
* Class destructor
@@ -354,8 +356,7 @@ class Smarty extends Smarty_Internal_Data {
* @param object $parent next higher level of Smarty variables
* @returns object data object
*/
public function createData($parent = null)
{
public function createData($parent = null) {
return new Smarty_Data($parent, $this);
}
@@ -368,8 +369,7 @@ class Smarty extends Smarty_Internal_Data {
* @param mixed $compile_id compile id to be used with this template
* @returns object template object
*/
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
{
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null) {
if (is_object($cache_id) || is_array($cache_id)) {
$parent = $cache_id;
$cache_id = null;
@@ -377,7 +377,8 @@ class Smarty extends Smarty_Internal_Data {
if (is_array($parent)) {
$data = $parent;
$parent = null;
} else {
}
else {
$data = null;
}
if (!is_object($template)) {
@@ -387,11 +388,13 @@ class Smarty extends Smarty_Internal_Data {
if (isset($this->template_objects[$_templateId]) && $this->caching) {
// return cached template object
$tpl = $this->template_objects[$_templateId];
} else {
}
else {
// create new template object
$tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id);
}
} else {
}
else {
// just return a copy of template class
$tpl = $template;
}