cvs: smarty / BUGS FAQ INSTALL NEWS Smarty.class.php Smarty_Compiler.class.php /docs getting-started.sgml
| From: | Andrei Zmievski | Date: | Thu, 11 Apr 2002 20:27:04 +0000 |
| Subject: | cvs: smarty / BUGS FAQ INSTALL NEWS Smarty.class.php Smarty_Compiler.class.php /docs getting-started.sgml | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-43@lists.php.net to get a copy of this message | ||
andrei Thu Apr 11 16:27:04 2002 EDT
Modified files:
/smarty BUGS FAQ INSTALL NEWS Smarty.class.php
Smarty_Compiler.class.php
/smarty/docs getting-started.sgml
Log:
Fixed directory separtor issue. Requiring PHP 4.0.6 now.
Index: smarty/BUGS diff -u smarty/BUGS:1.5 smarty/BUGS:1.6 --- smarty/BUGS:1.5 Tue Feb 19 17:40:48 2002 +++ smarty/BUGS Thu Apr 11 16:27:04 2002 @@ -8,7 +8,7 @@ get_defined_vars() function. Some versions of Windows 2k have a problem with flock(). Comment out the flock() command in _write_file to get around this. -To be absolutely safe, use 4.0.4pl or later with Smarty. +To be absolutely safe, use 4.0.6 or later with Smarty. Smarty versions previous to 2.0 require the PEAR libraries. Be sure to include the path to the PEAR libraries in your php include_path. Config_file.class.php Index: smarty/FAQ diff -u smarty/FAQ:1.34 smarty/FAQ:1.35 --- smarty/FAQ:1.34 Thu Mar 28 15:03:00 2002 +++ smarty/FAQ Thu Apr 11 16:27:04 2002 @@ -143,21 +143,21 @@ --------------- Q: Smarty doesn't work. -A: You must be using PHP 4.0.4pl1 or later to fix all known problems - Smarty has with PHP. Read the BUGS file for more info. +A: You must be using PHP 4.0.6 or later if you use any version of Smarty + past 2.0.1. Read the BUGS file for more info. Q: I get the following error when running Smarty: Warning: Wrong parameter count for preg_replace() in Smarty.class.php on line 371 A: preg_replace had a parameter added in PHP 4.0.2 that Smarty - requires. Upgrade to at least 4.0.4pl to fix all known PHP issues with + requires. Upgrade to at least 4.0.6 to fix all known PHP issues with Smarty. Q: I get this error when passing variables to {include}: Fatal error: Call to undefined function: get_defined_vars() in /path/to/Smarty/templates_c/index.tpl.php on line 8 A: get_defined_vars() was added to PHP 4.0.4. If you plan on passing - variables to included templates, you will need PHP 4.0.4 or later. + variables to included templates, you will need PHP 4.0.6 or later. Q: I get PHP errors in my {if} tag logic. A: All conditional qualifiers must be separated by spaces. This syntax will not Index: smarty/INSTALL diff -u smarty/INSTALL:1.8 smarty/INSTALL:1.9 --- smarty/INSTALL:1.8 Fri Apr 5 09:19:49 2002 +++ smarty/INSTALL Thu Apr 11 16:27:04 2002 @@ -1,8 +1,6 @@ REQUIREMENTS: -Smarty requires PHP 4.0.4pl1 or later to fix all known problems Smarty has with -PHP. Smarty was developed and tested with PHP versions >= 4.0.4pl1. See the -BUGS file for more info. +Smarty requires PHP 4.0.6 or later. INSTALLATION: Index: smarty/NEWS diff -u smarty/NEWS:1.186 smarty/NEWS:1.187 --- smarty/NEWS:1.186 Thu Apr 11 12:22:50 2002 +++ smarty/NEWS Thu Apr 11 16:27:04 2002 @@ -1,3 +1,4 @@ + - fixed directory separator issue for Windows. (Andrei) - added ability to use simple variables as array indices or object properties. (Andrei) - added ability to unregister pre/postfilters plugins at Index: smarty/Smarty.class.php diff -u smarty/Smarty.class.php:1.262 smarty/Smarty.class.php:1.263 --- smarty/Smarty.class.php:1.262 Fri Apr 5 12:16:49 2002 +++ smarty/Smarty.class.php Thu Apr 11 16:27:04 2002 @@ -44,8 +44,10 @@ // set SMARTY_DIR to absolute path to Smarty library files. // if not defined, include_path will be used. +define('DIR_SEP', DIRECTORY_SEPARATOR); + if (!defined('SMARTY_DIR')) { - define('SMARTY_DIR', dirname(__FILE__) . '/'); + define('SMARTY_DIR', dirname(__FILE__) . DIR_SEP); } define('SMARTY_PHP_PASSTHRU', 0); @@ -62,9 +64,9 @@ /**************************************************************************/ // public vars - var $template_dir = './templates'; // name of directory for templates - var $compile_dir = './templates_c'; // name of directory for compiled templates - var $config_dir = './configs'; // directory where config files are located + var $template_dir = 'templates'; // name of directory for templates + var $compile_dir = 'templates_c'; // name of directory for compiled templates + var $config_dir = 'configs'; // directory where config files are located var $plugins_dir = 'plugins'; // directory where plugins are kept // (relative to Smarty directory) @@ -91,7 +93,7 @@ // overrides cache settings. default false. var $caching = false; // enable caching. true/false default false. - var $cache_dir = './cache'; // name of directory for template cache files + var $cache_dir = 'cache'; // name of directory for template cache files var $cache_lifetime = 3600; // number of seconds cached content will persist. // 0 = never expires. default is one hour (3600) var $cache_handler_func = null; // function used for cached content. this is @@ -113,7 +115,7 @@ var $security = false; // enable template security (default false) - var $secure_dir = array('./templates'); // array of directories considered secure + var $secure_dir = array('templates'); // array of directories considered secure var $security_settings = array( 'PHP_HANDLING' => false, 'IF_FUNCS' => array('array', 'list', @@ -873,8 +875,8 @@ // relative pathname to $file_base_path // use the first directory where the file is found foreach ((array)$file_base_path as $curr_path) { - if (@is_file($curr_path.'/'.$resource_name)) { - $resource_name = $curr_path.'/'.$resource_name; + if (@is_file($curr_path.DIR_SEP.$resource_name)) { + $resource_name = $curr_path.DIR_SEP.$resource_name; return true; } } @@ -1323,8 +1325,8 @@ function _get_auto_filename($auto_base, $auto_source, $auto_id = null) { $source_hash = str_replace('-','N',crc32($auto_source)); - $res = $auto_base . '/' . substr($source_hash, 0, 3) . '/' . - $source_hash . '/' . str_replace('-','N',crc32($auto_id)) . '.php'; + $res = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . + $source_hash . DIR_SEP . str_replace('-','N',crc32($auto_id)) . '.php'; return $res; } @@ -1346,7 +1348,7 @@ $res = is_file($tname) && unlink( $tname); } else { $source_hash = str_replace('-','N',crc32($auto_source)); - $tname = $auto_base . '/' . substr($source_hash, 0, 3) . '/' . $source_hash; + $tname = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . $source_hash; $res = $this->_rmdir($tname); } } @@ -1365,11 +1367,11 @@ while ($entry = readdir($handle)) { if ($entry != '.' && $entry != '..') { - if (is_dir($dirname . '/' . $entry)) { - $this->_rmdir($dirname . '/' . $entry, $level + 1); + if (is_dir($dirname . DIR_SEP . $entry)) { + $this->_rmdir($dirname . DIR_SEP . $entry, $level + 1); } else { - unlink($dirname . '/' . $entry); + unlink($dirname . DIR_SEP . $entry); } } } @@ -1389,15 +1391,15 @@ function _create_dir_structure($dir) { if (!file_exists($dir)) { - $dir_parts = preg_split('!/+!', $dir, -1, PREG_SPLIT_NO_EMPTY); - $new_dir = ($dir{0} == '/') ? '/' : ''; + $dir_parts = preg_split('!\\'.DIR_SEP.'+!', $dir, -1, PREG_SPLIT_NO_EMPTY); + $new_dir = ($dir{0} == DIR_SEP) ? DIR_SEP : ''; foreach ($dir_parts as $dir_part) { $new_dir .= $dir_part; if (!file_exists($new_dir) && !mkdir($new_dir, 0771)) { $this->trigger_error("problem creating directory \"$dir\""); return false; } - $new_dir .= '/'; + $new_dir .= DIR_SEP; } } } @@ -1492,7 +1494,7 @@ if (isset($this->_cache_info['config'])) { foreach ($this->_cache_info['config'] as $config_dep) { - if ($this->_cache_info['timestamp'] < filemtime($this->config_dir.'/'.$config_dep)) { + if ($this->_cache_info['timestamp'] < filemtime($this->config_dir.DIR_SEP.$config_dep)) { // config file has changed, regenerate cache return false; } @@ -1552,7 +1554,7 @@ $plugin_file = SMARTY_DIR . $this->plugins_dir . - '/' . + DIR_SEP . $type . '.' . $name . @@ -1657,8 +1659,8 @@ } $plugin_file = SMARTY_DIR . - $this->plugins_dir . - '/resource.' . + $this->plugins_dir . DIR_SEP . + 'resource.' . $type . '.php'; Index: smarty/Smarty_Compiler.class.php diff -u smarty/Smarty_Compiler.class.php:1.109 smarty/Smarty_Compiler.class.php:1.110 --- smarty/Smarty_Compiler.class.php:1.109 Thu Apr 11 12:22:50 2002 +++ smarty/Smarty_Compiler.class.php Thu Apr 11 16:27:04 2002 @@ -353,8 +353,8 @@ $have_function = true; $plugin_file = SMARTY_DIR . - $this->plugins_dir . - '/compiler.' . + $this->plugins_dir . DIR_SEP . + 'compiler.' . $tag_command . '.php'; @@ -423,8 +423,8 @@ $have_function = true; $plugin_file = SMARTY_DIR . - $this->plugins_dir . - '/block.' . + $this->plugins_dir . DIR_SEP . + 'block.' . $tag_command . '.php'; @@ -1375,7 +1375,7 @@ $this->_plugins[$parts[0]][$parts[1]] === false)) continue; - $plugin_file = $plugins_dir . '/' . $entry; + $plugin_file = $plugins_dir . DIR_SEP . $entry; include_once $plugin_file; $plugin_func = 'smarty_' . $parts[0] . '_' . $parts[1]; if (!function_exists($plugin_func)) { Index: smarty/docs/getting-started.sgml diff -u smarty/docs/getting-started.sgml:1.6 smarty/docs/getting-started.sgml:1.7 --- smarty/docs/getting-started.sgml:1.6 Tue Mar 12 16:39:57 2002 +++ smarty/docs/getting-started.sgml Thu Apr 11 16:27:04 2002 @@ -108,7 +108,7 @@ <sect1 id="installation.requirements"> <title>Requirements</title> <para> - Smarty requires PHP 4.0.4pl1 or later. See the + Smarty requires PHP 4.0.6 or later. See the <link linkend="bugs">BUGS</link> section for caveats. </para> </sect1>
Index: smarty/BUGS diff -u smarty/BUGS:1.5 smarty/BUGS:1.6 --- smarty/BUGS:1.5 Tue Feb 19 17:40:48 2002 +++ smarty/BUGS Thu Apr 11 16:27:04 2002 @@ -8,7 +8,7 @@ get_defined_vars() function. Some versions of Windows 2k have a problem with flock(). Comment out the flock() command in _write_file to get around this. -To be absolutely safe, use 4.0.4pl or later with Smarty. +To be absolutely safe, use 4.0.6 or later with Smarty. Smarty versions previous to 2.0 require the PEAR libraries. Be sure to include the path to the PEAR libraries in your php include_path. Config_file.class.php Index: smarty/FAQ diff -u smarty/FAQ:1.34 smarty/FAQ:1.35 --- smarty/FAQ:1.34 Thu Mar 28 15:03:00 2002 +++ smarty/FAQ Thu Apr 11 16:27:04 2002 @@ -143,21 +143,21 @@ --------------- Q: Smarty doesn't work. -A: You must be using PHP 4.0.4pl1 or later to fix all known problems - Smarty has with PHP. Read the BUGS file for more info. +A: You must be using PHP 4.0.6 or later if you use any version of Smarty + past 2.0.1. Read the BUGS file for more info. Q: I get the following error when running Smarty: Warning: Wrong parameter count for preg_replace() in Smarty.class.php on line 371 A: preg_replace had a parameter added in PHP 4.0.2 that Smarty - requires. Upgrade to at least 4.0.4pl to fix all known PHP issues with + requires. Upgrade to at least 4.0.6 to fix all known PHP issues with Smarty. Q: I get this error when passing variables to {include}: Fatal error: Call to undefined function: get_defined_vars() in /path/to/Smarty/templates_c/index.tpl.php on line 8 A: get_defined_vars() was added to PHP 4.0.4. If you plan on passing - variables to included templates, you will need PHP 4.0.4 or later. + variables to included templates, you will need PHP 4.0.6 or later. Q: I get PHP errors in my {if} tag logic. A: All conditional qualifiers must be separated by spaces. This syntax will not Index: smarty/INSTALL diff -u smarty/INSTALL:1.8 smarty/INSTALL:1.9 --- smarty/INSTALL:1.8 Fri Apr 5 09:19:49 2002 +++ smarty/INSTALL Thu Apr 11 16:27:04 2002 @@ -1,8 +1,6 @@ REQUIREMENTS: -Smarty requires PHP 4.0.4pl1 or later to fix all known problems Smarty has with -PHP. Smarty was developed and tested with PHP versions >= 4.0.4pl1. See the -BUGS file for more info. +Smarty requires PHP 4.0.6 or later. INSTALLATION: Index: smarty/NEWS diff -u smarty/NEWS:1.186 smarty/NEWS:1.187 --- smarty/NEWS:1.186 Thu Apr 11 12:22:50 2002 +++ smarty/NEWS Thu Apr 11 16:27:04 2002 @@ -1,3 +1,4 @@ + - fixed directory separator issue for Windows. (Andrei) - added ability to use simple variables as array indices or object properties. (Andrei) - added ability to unregister pre/postfilters plugins at Index: smarty/Smarty.class.php diff -u smarty/Smarty.class.php:1.262 smarty/Smarty.class.php:1.263 --- smarty/Smarty.class.php:1.262 Fri Apr 5 12:16:49 2002 +++ smarty/Smarty.class.php Thu Apr 11 16:27:04 2002 @@ -44,8 +44,10 @@ // set SMARTY_DIR to absolute path to Smarty library files. // if not defined, include_path will be used. +define('DIR_SEP', DIRECTORY_SEPARATOR); + if (!defined('SMARTY_DIR')) { - define('SMARTY_DIR', dirname(__FILE__) . '/'); + define('SMARTY_DIR', dirname(__FILE__) . DIR_SEP); } define('SMARTY_PHP_PASSTHRU', 0); @@ -62,9 +64,9 @@ /**************************************************************************/ // public vars - var $template_dir = './templates'; // name of directory for templates - var $compile_dir = './templates_c'; // name of directory for compiled templates - var $config_dir = './configs'; // directory where config files are located + var $template_dir = 'templates'; // name of directory for templates + var $compile_dir = 'templates_c'; // name of directory for compiled templates + var $config_dir = 'configs'; // directory where config files are located var $plugins_dir = 'plugins'; // directory where plugins are kept // (relative to Smarty directory) @@ -91,7 +93,7 @@ // overrides cache settings. default false. var $caching = false; // enable caching. true/false default false. - var $cache_dir = './cache'; // name of directory for template cache files + var $cache_dir = 'cache'; // name of directory for template cache files var $cache_lifetime = 3600; // number of seconds cached content will persist. // 0 = never expires. default is one hour (3600) var $cache_handler_func = null; // function used for cached content. this is @@ -113,7 +115,7 @@ var $security = false; // enable template security (default false) - var $secure_dir = array('./templates'); // array of directories considered secure + var $secure_dir = array('templates'); // array of directories considered secure var $security_settings = array( 'PHP_HANDLING' => false, 'IF_FUNCS' => array('array', 'list', @@ -873,8 +875,8 @@ // relative pathname to $file_base_path // use the first directory where the file is found foreach ((array)$file_base_path as $curr_path) { - if (@is_file($curr_path.'/'.$resource_name)) { - $resource_name = $curr_path.'/'.$resource_name; + if (@is_file($curr_path.DIR_SEP.$resource_name)) { + $resource_name = $curr_path.DIR_SEP.$resource_name; return true; } } @@ -1323,8 +1325,8 @@ function _get_auto_filename($auto_base, $auto_source, $auto_id = null) { $source_hash = str_replace('-','N',crc32($auto_source)); - $res = $auto_base . '/' . substr($source_hash, 0, 3) . '/' . - $source_hash . '/' . str_replace('-','N',crc32($auto_id)) . '.php'; + $res = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . + $source_hash . DIR_SEP . str_replace('-','N',crc32($auto_id)) . '.php'; return $res; } @@ -1346,7 +1348,7 @@ $res = is_file($tname) && unlink( $tname); } else { $source_hash = str_replace('-','N',crc32($auto_source)); - $tname = $auto_base . '/' . substr($source_hash, 0, 3) . '/' . $source_hash; + $tname = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . $source_hash; $res = $this->_rmdir($tname); } } @@ -1365,11 +1367,11 @@ while ($entry = readdir($handle)) { if ($entry != '.' && $entry != '..') { - if (is_dir($dirname . '/' . $entry)) { - $this->_rmdir($dirname . '/' . $entry, $level + 1); + if (is_dir($dirname . DIR_SEP . $entry)) { + $this->_rmdir($dirname . DIR_SEP . $entry, $level + 1); } else { - unlink($dirname . '/' . $entry); + unlink($dirname . DIR_SEP . $entry); } } } @@ -1389,15 +1391,15 @@ function _create_dir_structure($dir) { if (!file_exists($dir)) { - $dir_parts = preg_split('!/+!', $dir, -1, PREG_SPLIT_NO_EMPTY); - $new_dir = ($dir{0} == '/') ? '/' : ''; + $dir_parts = preg_split('!\\'.DIR_SEP.'+!', $dir, -1, PREG_SPLIT_NO_EMPTY); + $new_dir = ($dir{0} == DIR_SEP) ? DIR_SEP : ''; foreach ($dir_parts as $dir_part) { $new_dir .= $dir_part; if (!file_exists($new_dir) && !mkdir($new_dir, 0771)) { $this->trigger_error("problem creating directory \"$dir\""); return false; } - $new_dir .= '/'; + $new_dir .= DIR_SEP; } } } @@ -1492,7 +1494,7 @@ if (isset($this->_cache_info['config'])) { foreach ($this->_cache_info['config'] as $config_dep) { - if ($this->_cache_info['timestamp'] < filemtime($this->config_dir.'/'.$config_dep)) { + if ($this->_cache_info['timestamp'] < filemtime($this->config_dir.DIR_SEP.$config_dep)) { // config file has changed, regenerate cache return false; } @@ -1552,7 +1554,7 @@ $plugin_file = SMARTY_DIR . $this->plugins_dir . - '/' . + DIR_SEP . $type . '.' . $name . @@ -1657,8 +1659,8 @@ } $plugin_file = SMARTY_DIR . - $this->plugins_dir . - '/resource.' . + $this->plugins_dir . DIR_SEP . + 'resource.' . $type . '.php'; Index: smarty/Smarty_Compiler.class.php diff -u smarty/Smarty_Compiler.class.php:1.109 smarty/Smarty_Compiler.class.php:1.110 --- smarty/Smarty_Compiler.class.php:1.109 Thu Apr 11 12:22:50 2002 +++ smarty/Smarty_Compiler.class.php Thu Apr 11 16:27:04 2002 @@ -353,8 +353,8 @@ $have_function = true; $plugin_file = SMARTY_DIR . - $this->plugins_dir . - '/compiler.' . + $this->plugins_dir . DIR_SEP . + 'compiler.' . $tag_command . '.php'; @@ -423,8 +423,8 @@ $have_function = true; $plugin_file = SMARTY_DIR . - $this->plugins_dir . - '/block.' . + $this->plugins_dir . DIR_SEP . + 'block.' . $tag_command . '.php'; @@ -1375,7 +1375,7 @@ $this->_plugins[$parts[0]][$parts[1]] === false)) continue; - $plugin_file = $plugins_dir . '/' . $entry; + $plugin_file = $plugins_dir . DIR_SEP . $entry; include_once $plugin_file; $plugin_func = 'smarty_' . $parts[0] . '_' . $parts[1]; if (!function_exists($plugin_func)) { Index: smarty/docs/getting-started.sgml diff -u smarty/docs/getting-started.sgml:1.6 smarty/docs/getting-started.sgml:1.7 --- smarty/docs/getting-started.sgml:1.6 Tue Mar 12 16:39:57 2002 +++ smarty/docs/getting-started.sgml Thu Apr 11 16:27:04 2002 @@ -108,7 +108,7 @@ <sect1 id="installation.requirements"> <title>Requirements</title> <para> - Smarty requires PHP 4.0.4pl1 or later. See the + Smarty requires PHP 4.0.6 or later. See the <link linkend="bugs">BUGS</link> section for caveats. </para> </sect1>