mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
fix rename problem in windows, unlink first
This commit is contained in:
@@ -2060,7 +2060,11 @@ class Smarty
|
|||||||
|
|
||||||
fwrite($fd, $contents);
|
fwrite($fd, $contents);
|
||||||
fclose($fd);
|
fclose($fd);
|
||||||
rename($_tmp_file, $filename);
|
// Win32 can't rename over top another file
|
||||||
|
if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' && file_exists($filename)) {
|
||||||
|
@unlink($filename);
|
||||||
|
}
|
||||||
|
@rename($_tmp_file, $filename);
|
||||||
chmod($filename, $this->_file_perms);
|
chmod($filename, $this->_file_perms);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -25,11 +25,11 @@ function smarty_function_html_image($params, &$smarty)
|
|||||||
{
|
{
|
||||||
$name = '';
|
$name = '';
|
||||||
$border = 0;
|
$border = 0;
|
||||||
$height = null;
|
$height = '';
|
||||||
$width = null;
|
$width = '';
|
||||||
$extra = '';
|
$extra = '';
|
||||||
$basedir = isset($GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'])
|
$basedir = isset($GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'])
|
||||||
? $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'] : null;
|
? $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'] : '/';
|
||||||
|
|
||||||
foreach($params as $_key => $_val) {
|
foreach($params as $_key => $_val) {
|
||||||
switch($_key) {
|
switch($_key) {
|
||||||
@@ -46,7 +46,8 @@ function smarty_function_html_image($params, &$smarty)
|
|||||||
$width = $_val;
|
$width = $_val;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
|
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user