Fix plugin directory access.

This commit is contained in:
andrey
2002-02-05 16:46:05 +00:00
parent 6efb1378bd
commit 4951193444
11 changed files with 28 additions and 27 deletions

View File

@@ -47,8 +47,6 @@ if (!defined('SMARTY_DIR')) {
define('SMARTY_DIR', ''); define('SMARTY_DIR', '');
} }
//require_once SMARTY_DIR.'Smarty.addons.php';
define('SMARTY_PHP_PASSTHRU', 0); define('SMARTY_PHP_PASSTHRU', 0);
define('SMARTY_PHP_QUOTE', 1); define('SMARTY_PHP_QUOTE', 1);
define('SMARTY_PHP_REMOVE', 2); define('SMARTY_PHP_REMOVE', 2);
@@ -543,7 +541,7 @@ class Smarty
if ($this->_conf_obj === null) { if ($this->_conf_obj === null) {
/* Prepare the configuration object. */ /* Prepare the configuration object. */
if (!class_exists('Config_File')) if (!class_exists('Config_File'))
include_once SMARTY_DIR.'Config_File.class.php'; require_once SMARTY_DIR.'Config_File.class.php';
$this->_conf_obj = new Config_File($this->config_dir); $this->_conf_obj = new Config_File($this->config_dir);
$this->_conf_obj->read_hidden = false; $this->_conf_obj->read_hidden = false;
} else } else
@@ -983,7 +981,7 @@ function _generate_debug_output() {
\*======================================================================*/ \*======================================================================*/
function _compile_template($tpl_file, $template_source, &$template_compiled) function _compile_template($tpl_file, $template_source, &$template_compiled)
{ {
include_once SMARTY_DIR.$this->compiler_class . '.class.php'; require_once SMARTY_DIR.$this->compiler_class . '.class.php';
$smarty_compiler = new $this->compiler_class; $smarty_compiler = new $this->compiler_class;
@@ -1555,7 +1553,8 @@ function _run_insert_handler($args)
} }
} }
$plugin_file = $this->plugins_dir . $plugin_file = SMARTY_DIR .
$this->plugins_dir .
'/' . '/' .
$type . $type .
'.' . '.' .
@@ -1652,7 +1651,8 @@ function _run_insert_handler($args)
return; return;
} }
$plugin_file = $this->plugins_dir . $plugin_file = SMARTY_DIR .
$this->plugins_dir .
'/resource.' . '/resource.' .
$type . $type .
'.php'; '.php';

View File

@@ -340,7 +340,8 @@ class Smarty_Compiler extends Smarty {
$found = false; $found = false;
$have_function = true; $have_function = true;
$plugin_file = $this->plugins_dir . $plugin_file = SMARTY_DIR .
$this->plugins_dir .
'/compiler.' . '/compiler.' .
$tag_command . $tag_command .
'.php'; '.php';
@@ -1233,7 +1234,7 @@ class Smarty_Compiler extends Smarty {
\*======================================================================*/ \*======================================================================*/
function _load_filters() function _load_filters()
{ {
$plugins_dir = $this->plugins_dir; $plugins_dir = SMARTY_DIR . $this->plugins_dir;
$handle = opendir($plugins_dir); $handle = opendir($plugins_dir);
while ($entry = readdir($handle)) { while ($entry = readdir($handle)) {
$parts = explode('.', $entry, 3); $parts = explode('.', $entry, 3);

3
TODO
View File

@@ -1,9 +1,6 @@
* Ability to load multiple sections in one {config_load ...}
* handle asp style tags in $php_handler * handle asp style tags in $php_handler
* correctly capture nested php tag syntax in templates: * correctly capture nested php tag syntax in templates:
<?php echo "<?php exit(); ?>"; ?> <?php echo "<?php exit(); ?>"; ?>
* think about passing default structures to includes, i.e. {include
default=$foo}, then using $bar in included template, instead of $foo.bar
* support implementations of prefiltes, mods, and others as class methods. * support implementations of prefiltes, mods, and others as class methods.
* possibly implement default modifiers that apply to variables upon display * possibly implement default modifiers that apply to variables upon display
* think about possibility of supporting something like {$data[foo].$key[bar]} * think about possibility of supporting something like {$data[foo].$key[bar]}

View File

@@ -47,8 +47,6 @@ if (!defined('SMARTY_DIR')) {
define('SMARTY_DIR', ''); define('SMARTY_DIR', '');
} }
//require_once SMARTY_DIR.'Smarty.addons.php';
define('SMARTY_PHP_PASSTHRU', 0); define('SMARTY_PHP_PASSTHRU', 0);
define('SMARTY_PHP_QUOTE', 1); define('SMARTY_PHP_QUOTE', 1);
define('SMARTY_PHP_REMOVE', 2); define('SMARTY_PHP_REMOVE', 2);
@@ -543,7 +541,7 @@ class Smarty
if ($this->_conf_obj === null) { if ($this->_conf_obj === null) {
/* Prepare the configuration object. */ /* Prepare the configuration object. */
if (!class_exists('Config_File')) if (!class_exists('Config_File'))
include_once SMARTY_DIR.'Config_File.class.php'; require_once SMARTY_DIR.'Config_File.class.php';
$this->_conf_obj = new Config_File($this->config_dir); $this->_conf_obj = new Config_File($this->config_dir);
$this->_conf_obj->read_hidden = false; $this->_conf_obj->read_hidden = false;
} else } else
@@ -983,7 +981,7 @@ function _generate_debug_output() {
\*======================================================================*/ \*======================================================================*/
function _compile_template($tpl_file, $template_source, &$template_compiled) function _compile_template($tpl_file, $template_source, &$template_compiled)
{ {
include_once SMARTY_DIR.$this->compiler_class . '.class.php'; require_once SMARTY_DIR.$this->compiler_class . '.class.php';
$smarty_compiler = new $this->compiler_class; $smarty_compiler = new $this->compiler_class;
@@ -1555,7 +1553,8 @@ function _run_insert_handler($args)
} }
} }
$plugin_file = $this->plugins_dir . $plugin_file = SMARTY_DIR .
$this->plugins_dir .
'/' . '/' .
$type . $type .
'.' . '.' .
@@ -1652,7 +1651,8 @@ function _run_insert_handler($args)
return; return;
} }
$plugin_file = $this->plugins_dir . $plugin_file = SMARTY_DIR .
$this->plugins_dir .
'/resource.' . '/resource.' .
$type . $type .
'.php'; '.php';

View File

@@ -340,7 +340,8 @@ class Smarty_Compiler extends Smarty {
$found = false; $found = false;
$have_function = true; $have_function = true;
$plugin_file = $this->plugins_dir . $plugin_file = SMARTY_DIR .
$this->plugins_dir .
'/compiler.' . '/compiler.' .
$tag_command . $tag_command .
'.php'; '.php';
@@ -1233,7 +1234,7 @@ class Smarty_Compiler extends Smarty {
\*======================================================================*/ \*======================================================================*/
function _load_filters() function _load_filters()
{ {
$plugins_dir = $this->plugins_dir; $plugins_dir = SMARTY_DIR . $this->plugins_dir;
$handle = opendir($plugins_dir); $handle = opendir($plugins_dir);
while ($entry = readdir($handle)) { while ($entry = readdir($handle)) {
$parts = explode('.', $entry, 3); $parts = explode('.', $entry, 3);

View File

@@ -8,8 +8,8 @@
* Purpose: Prints the dropdowns for date selection. * Purpose: Prints the dropdowns for date selection.
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
include_once dirname(__FILE__) . '/.make_timestamp.php'; require_once SMARTY_DIR . 'plugins/.make_timestamp.php';
include_once dirname(__FILE__) . '/function.html_options.php'; require_once SMARTY_DIR . 'plugins/function.html_options.php';
function smarty_function_html_select_date($params, &$smarty) function smarty_function_html_select_date($params, &$smarty)
{ {
/* Default values. */ /* Default values. */

View File

@@ -8,8 +8,8 @@
* Purpose: Prints the dropdowns for time selection * Purpose: Prints the dropdowns for time selection
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
include_once dirname(__FILE__) . '/.make_timestamp.php'; require_once SMARTY_DIR . 'plugins/.make_timestamp.php';
include_once dirname(__FILE__) . '/function.html_options.php'; require_once SMARTY_DIR . 'plugins/function.html_options.php';
function smarty_function_html_select_time($params, &$smarty) function smarty_function_html_select_time($params, &$smarty)
{ {
/* Default values. */ /* Default values. */

View File

@@ -8,6 +8,7 @@
* Purpose: format datestamps via strftime * Purpose: format datestamps via strftime
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
require_once SMARTY_DIR . 'plugins/.make_timestamp.php';
function smarty_modifier_date_format($string, $format="%b %e, %Y") function smarty_modifier_date_format($string, $format="%b %e, %Y")
{ {
return strftime($format, smarty_make_timestamp($string)); return strftime($format, smarty_make_timestamp($string));

View File

@@ -8,8 +8,8 @@
* Purpose: Prints the dropdowns for date selection. * Purpose: Prints the dropdowns for date selection.
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
include_once dirname(__FILE__) . '/.make_timestamp.php'; require_once SMARTY_DIR . 'plugins/.make_timestamp.php';
include_once dirname(__FILE__) . '/function.html_options.php'; require_once SMARTY_DIR . 'plugins/function.html_options.php';
function smarty_function_html_select_date($params, &$smarty) function smarty_function_html_select_date($params, &$smarty)
{ {
/* Default values. */ /* Default values. */

View File

@@ -8,8 +8,8 @@
* Purpose: Prints the dropdowns for time selection * Purpose: Prints the dropdowns for time selection
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
include_once dirname(__FILE__) . '/.make_timestamp.php'; require_once SMARTY_DIR . 'plugins/.make_timestamp.php';
include_once dirname(__FILE__) . '/function.html_options.php'; require_once SMARTY_DIR . 'plugins/function.html_options.php';
function smarty_function_html_select_time($params, &$smarty) function smarty_function_html_select_time($params, &$smarty)
{ {
/* Default values. */ /* Default values. */

View File

@@ -8,6 +8,7 @@
* Purpose: format datestamps via strftime * Purpose: format datestamps via strftime
* ------------------------------------------------------------- * -------------------------------------------------------------
*/ */
require_once SMARTY_DIR . 'plugins/.make_timestamp.php';
function smarty_modifier_date_format($string, $format="%b %e, %Y") function smarty_modifier_date_format($string, $format="%b %e, %Y")
{ {
return strftime($format, smarty_make_timestamp($string)); return strftime($format, smarty_make_timestamp($string));