Re: cvs: smarty /libs Smarty.class.php Smarty_Compiler.class.php debug.tpl /libs/core core.assemble_plugin_filepath.php core.read_cache_file.php core.write_file.php /libs/plugins function.eval.php function.popup.php modifier.escape.php shared.make_timestamp.php

messju mohr <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <[email protected]>
shit!, this was committed by accident. I only wanted to commit Smarty_Compiler.class.php.
I'll revert this stuff immediately!


On Fri, Apr 16, 2004 at 07:53:38AM -0000, Messju Mohr wrote:
> messju		Fri Apr 16 03:53:38 2004 EDT
> 
>   Modified files:              
>     /smarty/libs	Smarty.class.php Smarty_Compiler.class.php debug.tpl 
>     /smarty/libs/core	core.assemble_plugin_filepath.php 
>                      	core.read_cache_file.php core.write_file.php 
>     /smarty/libs/plugins	function.eval.php function.popup.php 
>                         	modifier.escape.php shared.make_timestamp.php 
>   Log:
>   Smarty_Compiler.class.php
>   
> http://cvs.php.net/diff.php/smarty/libs/Smarty.class.php?r1=1.485&r2=1.486&ty=u
> Index: smarty/libs/Smarty.class.php
> diff -u smarty/libs/Smarty.class.php:1.485 smarty/libs/Smarty.class.php:1.486
> --- smarty/libs/Smarty.class.php:1.485	Mon Apr 12 08:38:36 2004
> +++ smarty/libs/Smarty.class.php	Fri Apr 16 03:53:36 2004
> @@ -30,7 +30,7 @@
>   * @version 2.6.3-dev
>   */
>  
> -/* $Id: Smarty.class.php,v 1.485 2004/04/12 12:38:36 messju Exp $ */
> +/* $Id: Smarty.class.php,v 1.486 2004/04/16 07:53:36 messju Exp $ */
>  
>  /**
>   * DIR_SEP isn't used anymore, but third party apps might
> @@ -183,6 +183,9 @@
>       */
>      var $cache_modified_check = false;
>  
> +    var $volatile_plugins = array('volatile'=>true,
> +                                  'insert_f' => '*');
> +
>      /**
>       * This determines how Smarty handles "<?php ... ?>" tags in templates.
>       * possible values:
> @@ -1223,6 +1226,14 @@
>                      header("Last-Modified: ".gmdate('D, d M Y H:i:s', time()).' GMT');
>                  }
>              }
> +
> +            if (isset($this->_cache_info['expires'])) {
> +                $expires = $this->_cache_info['expires'];
> +            } else {
> +                $expires = 0;
> +            }
> +            header("Expires: " . gmdate('D, d M Y H:i:s', $expires) . ' GMT');
> +
>          }
>  
>          // load filters that are marked as autoload
> @@ -1447,7 +1458,7 @@
>          }
>  
>  
> -        $smarty_compiler = new $this->compiler_class;
> +        $smarty_compiler =& new $this->compiler_class();
>  
>          $smarty_compiler->template_dir      = $this->template_dir;
>          $smarty_compiler->compile_dir       = $this->compile_dir;
> http://cvs.php.net/diff.php/smarty/libs/Smarty_Compiler.class.php?r1=1.315&r2=1.316&ty=u
> Index: smarty/libs/Smarty_Compiler.class.php
> diff -u smarty/libs/Smarty_Compiler.class.php:1.315 smarty/libs/Smarty_Compiler.class.php:1.316
> --- smarty/libs/Smarty_Compiler.class.php:1.315	Mon Feb 23 18:14:40 2004
> +++ smarty/libs/Smarty_Compiler.class.php	Fri Apr 16 03:53:36 2004
> @@ -26,7 +26,7 @@
>   * @package Smarty
>   */
>  
> -/* $Id: Smarty_Compiler.class.php,v 1.315 2004/02/23 23:14:40 messju Exp $ */
> +/* $Id: Smarty_Compiler.class.php,v 1.316 2004/04/16 07:53:36 messju Exp $ */
>  
>  /**
>   * Template compiling class
> @@ -1017,7 +1017,7 @@
>              $this->_syntax_error("missing section name", E_USER_ERROR, __FILE__, __LINE__);
>          }
>  
> -        $output .= "if (isset(\$this->_sections[$section_name])) unset(\$this->_sections[$section_name]);\n";
> +        $output .= "unset(\$this->_sections[$section_name]);\n";
>          $section_props = "\$this->_sections[$section_name]";
>  
>          foreach ($attrs as $attr_name => $attr_value) {
> http://cvs.php.net/diff.php/smarty/libs/debug.tpl?r1=1.8&r2=1.9&ty=u
> Index: smarty/libs/debug.tpl
> diff -u smarty/libs/debug.tpl:1.8 smarty/libs/debug.tpl:1.9
> --- smarty/libs/debug.tpl:1.8	Wed Aug 13 10:15:30 2003
> +++ smarty/libs/debug.tpl	Fri Apr 16 03:53:36 2004
> @@ -29,14 +29,14 @@
>  </BODY></HTML>
>  {else}
>  <SCRIPT language=javascript>
> -	if( self.name == '' ) {ldelim}
> +	if( !self.name || ( self.name == '' ) ) {ldelim}
>  	   var title = 'Console';
>  	{rdelim}
>  	else {ldelim}
>  	   var title = 'Console_' + self.name;
>  	{rdelim}
>  	_smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
> -	_smarty_console.document.write("<HTML><TITLE>Smarty Debug Console_"+self.name+"</TITLE><BODY bgcolor=#ffffff>");
> +	_smarty_console.document.write("<HTML><TITLE>Smarty Debug " +title+"</TITLE><BODY bgcolor=#ffffff>");
>  	_smarty_console.document.write("<table border=0 width=100%>");
>  	_smarty_console.document.write("<tr bgcolor=#cccccc><th colspan=2>Smarty Debug Console</th></tr>");
>  	_smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>included templates & config files (load time in seconds):</b></td></tr>");
> http://cvs.php.net/diff.php/smarty/libs/core/core.assemble_plugin_filepath.php?r1=1.8&r2=1.9&ty=u
> Index: smarty/libs/core/core.assemble_plugin_filepath.php
> diff -u smarty/libs/core/core.assemble_plugin_filepath.php:1.8 smarty/libs/core/core.assemble_plugin_filepath.php:1.9
> --- smarty/libs/core/core.assemble_plugin_filepath.php:1.8	Thu Mar 11 13:16:29 2004
> +++ smarty/libs/core/core.assemble_plugin_filepath.php	Fri Apr 16 03:53:37 2004
> @@ -29,11 +29,6 @@
>          // see if path is relative
>          if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
>              $_relative_paths[] = $_plugin_dir;
> -            // relative path, see if it is in the SMARTY_DIR
> -            if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
> -                $_return = SMARTY_DIR . $_plugin_filepath;
> -                break;
> -            }
>          }
>          // try relative to cwd (or absolute)
>          if (@is_readable($_plugin_filepath)) {
> @@ -55,6 +50,12 @@
>                      $_return = $_params['new_file_path'];
>                      break;
>                  }
> +                // maybe it is in the SMARTY_DIR
> +                if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
> +                    $_return = SMARTY_DIR . $_plugin_filepath;
> +                    break;
> +                }
> +
>              }
>          }
>      }
> http://cvs.php.net/diff.php/smarty/libs/core/core.read_cache_file.php?r1=1.14&r2=1.15&ty=u
> Index: smarty/libs/core/core.read_cache_file.php
> diff -u smarty/libs/core/core.read_cache_file.php:1.14 smarty/libs/core/core.read_cache_file.php:1.15
> --- smarty/libs/core/core.read_cache_file.php:1.14	Thu Nov  6 12:16:32 2003
> +++ smarty/libs/core/core.read_cache_file.php	Fri Apr 16 03:53:37 2004
> @@ -41,6 +41,7 @@
>          $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']);
>          $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id);
>          $params['results'] = $smarty->_read_file($_cache_file);
> +        # $params['results'] = file_get_contents($_cache_file);
>      }
>  
>      if (empty($params['results'])) {
> @@ -52,6 +53,8 @@
>      $cache_header = $cache_split[0];
>  
>      $_cache_info = unserialize($cache_header);
> +    if (!isset($_cache_info['expires']))
> +        $_cache_info['expires'] = time() + $smarty->cache_lifetime;
>  
>      if ($smarty->caching == 2 && isset ($_cache_info['expires'])){
>          // caching by expiration time
> http://cvs.php.net/diff.php/smarty/libs/core/core.write_file.php?r1=1.8&r2=1.9&ty=u
> Index: smarty/libs/core/core.write_file.php
> diff -u smarty/libs/core/core.write_file.php:1.8 smarty/libs/core/core.write_file.php:1.9
> --- smarty/libs/core/core.write_file.php:1.8	Sun Nov 23 03:37:43 2003
> +++ smarty/libs/core/core.write_file.php	Fri Apr 16 03:53:37 2004
> @@ -25,7 +25,9 @@
>  
>      // write to tmp file, then rename it to avoid
>      // file locking race condition
> -    $_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('');
> +    # $_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('');
> +    $_tmp_file = tempnam($_dirname , '_tmp');
> +    # $_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('', true);
>  
>      if (!($fd = @fopen($_tmp_file, 'w'))) {
>          $smarty->trigger_error("problem writing temporary file '$_tmp_file'");
> http://cvs.php.net/diff.php/smarty/libs/plugins/function.eval.php?r1=1.12&r2=1.13&ty=u
> Index: smarty/libs/plugins/function.eval.php
> diff -u smarty/libs/plugins/function.eval.php:1.12 smarty/libs/plugins/function.eval.php:1.13
> --- smarty/libs/plugins/function.eval.php:1.12	Wed Jul 23 12:14:47 2003
> +++ smarty/libs/plugins/function.eval.php	Fri Apr 16 03:53:37 2004
> @@ -20,7 +20,7 @@
>  function smarty_function_eval($params, &$smarty)
>  {
>  
> -    if (!isset($params['var'])) {
> +    if (!array_key_exists('var', $params)) {
>          $smarty->trigger_error("eval: missing 'var' parameter");
>          return;
>      }
> http://cvs.php.net/diff.php/smarty/libs/plugins/function.popup.php?r1=1.12&r2=1.13&ty=u
> Index: smarty/libs/plugins/function.popup.php
> diff -u smarty/libs/plugins/function.popup.php:1.12 smarty/libs/plugins/function.popup.php:1.13
> --- smarty/libs/plugins/function.popup.php:1.12	Mon Feb 23 18:17:19 2004
> +++ smarty/libs/plugins/function.popup.php	Fri Apr 16 03:53:37 2004
> @@ -99,7 +99,9 @@
>  
>      if (empty($trigger)) { $trigger = "onmouseover"; }
>  
> -    $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
> +    $retval = $trigger . '="' . htmlspecialchars(
> +        'return overlib(\''.preg_replace(array("!'!","![\r\n]!"),
> +                                         array("\'",'\r'),$text).'\'');
>      $retval .= $append . ');" onmouseout="nd();"';
>  
>      return $retval;
> http://cvs.php.net/diff.php/smarty/libs/plugins/modifier.escape.php?r1=1.11&r2=1.12&ty=u
> Index: smarty/libs/plugins/modifier.escape.php
> diff -u smarty/libs/plugins/modifier.escape.php:1.11 smarty/libs/plugins/modifier.escape.php:1.12
> --- smarty/libs/plugins/modifier.escape.php:1.11	Fri Dec 19 12:18:56 2003
> +++ smarty/libs/plugins/modifier.escape.php	Fri Apr 16 03:53:37 2004
> @@ -51,7 +51,12 @@
>  
>          case 'javascript':
>              // escape quotes and backslashes and newlines
> -            return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n'));
> +            $return = strtr($string, array(
> +                                "\x08" => '\\b', "\x09" => '\\t', "\n" => '\\n', 
> +                                "\x0b" => '\\v', "\x0c" => '\\f', "\r" => '\\r', 
> +                                '"' => '\\"', '\'' => '\\\'', '\\' => '\\\\'));
> +
> +            return preg_replace('!<(/\w)!', "<\\\\$1", $return);
>  
>          default:
>              return $string;
> http://cvs.php.net/diff.php/smarty/libs/plugins/shared.make_timestamp.php?r1=1.5&r2=1.6&ty=u
> Index: smarty/libs/plugins/shared.make_timestamp.php
> diff -u smarty/libs/plugins/shared.make_timestamp.php:1.5 smarty/libs/plugins/shared.make_timestamp.php:1.6
> --- smarty/libs/plugins/shared.make_timestamp.php:1.5	Sat Oct 11 05:33:50 2003
> +++ smarty/libs/plugins/shared.make_timestamp.php	Fri Apr 16 03:53:37 2004
> @@ -16,18 +16,20 @@
>  function smarty_make_timestamp($string)
>  {
>      if(empty($string)) {
> -        $string = "now";
> -    }
> -    $time = strtotime($string);
> -    if (is_numeric($time) && $time != -1)
> -        return $time;
> +        // now
> +        $time = -1;
>  
> -    // is mysql timestamp format of YYYYMMDDHHMMSS?
> -    if (preg_match('/^\d{14}$/', $string)) {
> +    } elseif (preg_match('/^\d{14}$/', $string)) {
> +        // is mysql timestamp format of YYYYMMDDHHMMSS?
>          $time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2),
>                 substr($string,4,2),substr($string,6,2),substr($string,0,4));
>  
>          return $time;
> +
> +    } else {
> +        $time = strtotime($string);
> +        if (is_numeric($time) && $time != -1)
> +            return $time;
>      }
>  
>      // couldn't recognize it, try to return a time
> 

> -- 
> Smarty CVS Mailing List (http://cvs.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.