5 |
* Author: Monte Ohrt <monte@ispi.net> |
* Author: Monte Ohrt <monte@ispi.net> |
6 |
* Andrei Zmievski <andrei@php.net> |
* Andrei Zmievski <andrei@php.net> |
7 |
* |
* |
8 |
* Version: 2.3.0 |
* Version: 2.3.1 |
9 |
* Copyright: 2001,2002 ispi of Lincoln, Inc. |
* Copyright: 2001,2002 ispi of Lincoln, Inc. |
10 |
* |
* |
11 |
* This library is free software; you can redistribute it and/or |
* This library is free software; you can redistribute it and/or |
171 |
var $_conf_obj = null; // configuration object |
var $_conf_obj = null; // configuration object |
172 |
var $_config = array(); // loaded configuration settings |
var $_config = array(); // loaded configuration settings |
173 |
var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; // md5 checksum of the string 'Smarty' |
var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; // md5 checksum of the string 'Smarty' |
174 |
var $_version = '2.3.0'; // Smarty version number |
var $_version = '2.3.1'; // Smarty version number |
175 |
var $_extract = false; // flag for custom functions |
var $_extract = false; // flag for custom functions |
176 |
var $_inclusion_depth = 0; // current template inclusion depth |
var $_inclusion_depth = 0; // current template inclusion depth |
177 |
var $_compile_id = null; // for different compiled templates |
var $_compile_id = null; // for different compiled templates |
931 |
} else { |
} else { |
932 |
// compile template |
// compile template |
933 |
$this->_compile_template($tpl_file, $template_source, $template_compiled); |
$this->_compile_template($tpl_file, $template_source, $template_compiled); |
934 |
$this->_write_compiled_template($compile_path, $template_compiled); |
$this->_write_compiled_template($compile_path, $template_compiled, $template_timestamp); |
935 |
return true; |
return true; |
936 |
} |
} |
937 |
} |
} |
942 |
return false; |
return false; |
943 |
} |
} |
944 |
$this->_compile_template($tpl_file, $template_source, $template_compiled); |
$this->_compile_template($tpl_file, $template_source, $template_compiled); |
945 |
$this->_write_compiled_template($compile_path, $template_compiled); |
$this->_write_compiled_template($compile_path, $template_compiled, $template_timestamp); |
946 |
return true; |
return true; |
947 |
} |
} |
948 |
} |
} |
961 |
Function: _write_compiled_template |
Function: _write_compiled_template |
962 |
Purpose: |
Purpose: |
963 |
\*======================================================================*/ |
\*======================================================================*/ |
964 |
function _write_compiled_template($compile_path, $template_compiled) |
function _write_compiled_template($compile_path, $template_compiled, $template_timestamp) |
965 |
{ |
{ |
966 |
// we save everything into $compile_dir |
// we save everything into $compile_dir |
967 |
$this->_write_file($compile_path, $template_compiled, true); |
$this->_write_file($compile_path, $template_compiled, true); |
968 |
|
touch($compile_path, $template_timestamp); |
969 |
return true; |
return true; |
970 |
} |
} |
971 |
|
|
1515 |
\*======================================================================*/ |
\*======================================================================*/ |
1516 |
function _rm_auto($auto_base, $auto_source = null, $auto_id = null, $exp_time = null) |
function _rm_auto($auto_base, $auto_source = null, $auto_id = null, $exp_time = null) |
1517 |
{ |
{ |
1518 |
if (!is_dir($auto_base)) |
if (!@is_dir($auto_base)) |
1519 |
return false; |
return false; |
1520 |
|
|
1521 |
if(!isset($auto_id) && !isset($auto_source)) { |
if(!isset($auto_id) && !isset($auto_source)) { |
1524 |
$tname = $this->_get_auto_filename($auto_base, $auto_source, $auto_id); |
$tname = $this->_get_auto_filename($auto_base, $auto_source, $auto_id); |
1525 |
|
|
1526 |
if(isset($auto_source)) { |
if(isset($auto_source)) { |
1527 |
$res = @unlink($tname); |
$res = $this->_unlink($tname); |
1528 |
} elseif ($this->use_sub_dirs) { |
} elseif ($this->use_sub_dirs) { |
1529 |
$res = $this->_rmdir($tname, 1, $exp_time); |
$res = $this->_rmdir($tname, 1, $exp_time); |
1530 |
} else { |
} else { |
1555 |
|
|
1556 |
while ($entry = readdir($handle)) { |
while ($entry = readdir($handle)) { |
1557 |
if ($entry != '.' && $entry != '..') { |
if ($entry != '.' && $entry != '..') { |
1558 |
if (is_dir($dirname . DIR_SEP . $entry)) { |
if (@is_dir($dirname . DIR_SEP . $entry)) { |
1559 |
$this->_rmdir($dirname . DIR_SEP . $entry, $level + 1, $exp_time); |
$this->_rmdir($dirname . DIR_SEP . $entry, $level + 1, $exp_time); |
1560 |
} |
} |
1561 |
else { |
else { |
1584 |
{ |
{ |
1585 |
if(isset($exp_time)) { |
if(isset($exp_time)) { |
1586 |
if(time() - filemtime($resource) >= $exp_time) { |
if(time() - filemtime($resource) >= $exp_time) { |
1587 |
unlink($resource); |
@unlink($resource); |
1588 |
} |
} |
1589 |
} else { |
} else { |
1590 |
unlink($resource); |
@unlink($resource); |
1591 |
} |
} |
1592 |
} |
} |
1593 |
|
|
1598 |
function _create_dir_structure($dir) |
function _create_dir_structure($dir) |
1599 |
{ |
{ |
1600 |
if (!@file_exists($dir)) { |
if (!@file_exists($dir)) { |
1601 |
$dir_parts = preg_split('!\\'.DIR_SEP.'+!', $dir, -1, PREG_SPLIT_NO_EMPTY); |
$_dir_parts = preg_split('!\\'.DIR_SEP.'+!', $dir, -1, PREG_SPLIT_NO_EMPTY); |
1602 |
$new_dir = ($dir{0} == DIR_SEP) ? DIR_SEP : ''; |
$_new_dir = ($dir{0} == DIR_SEP) ? DIR_SEP : ''; |
1603 |
foreach ($dir_parts as $dir_part) { |
|
1604 |
$new_dir .= $dir_part; |
// do not attempt to test or make directories outside of open_basedir |
1605 |
if (!file_exists($new_dir) && !mkdir($new_dir, 0771)) { |
$_open_basedir_ini = ini_get('open_basedir'); |
1606 |
|
if(!empty($_open_basedir_ini)) { |
1607 |
|
$_use_open_basedir = true; |
1608 |
|
$_open_basedir_sep = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') ? ';' : ':'; |
1609 |
|
$_open_basedirs = explode($_open_basedir_sep, $_open_basedir_ini); |
1610 |
|
} else { |
1611 |
|
$_use_open_basedir = false; |
1612 |
|
} |
1613 |
|
|
1614 |
|
foreach ($_dir_parts as $_dir_part) { |
1615 |
|
$_new_dir .= $_dir_part; |
1616 |
|
|
1617 |
|
if ($_use_open_basedir) { |
1618 |
|
$_make_new_dir = false; |
1619 |
|
foreach ($_open_basedirs as $_open_basedir) { |
1620 |
|
if (substr($_new_dir.'/', 0, strlen($_open_basedir)) == $_open_basedir) { |
1621 |
|
$_make_new_dir = true; |
1622 |
|
break; |
1623 |
|
} |
1624 |
|
} |
1625 |
|
} else { |
1626 |
|
$_make_new_dir = true; |
1627 |
|
} |
1628 |
|
|
1629 |
|
if ($_make_new_dir && !@file_exists($_new_dir) && !@mkdir($_new_dir, 0771)) { |
1630 |
$this->trigger_error("problem creating directory \"$dir\""); |
$this->trigger_error("problem creating directory \"$dir\""); |
1631 |
return false; |
return false; |
1632 |
} |
} |
1633 |
$new_dir .= DIR_SEP; |
$_new_dir .= DIR_SEP; |
1634 |
} |
} |
1635 |
} |
} |
1636 |
} |
} |