Fixup some naming.

This commit is contained in:
andrey
2002-02-20 22:24:32 +00:00
parent 2c3bd85dee
commit ffe52be500
18 changed files with 142 additions and 146 deletions

View File

@@ -8,29 +8,29 @@
* Purpose: fetch file, web or ftp data and display results
* -------------------------------------------------------------
*/
function smarty_function_fetch($args, &$smarty_obj)
function smarty_function_fetch($params, &$smarty)
{
extract($args);
extract($params);
if (empty($file)) {
$smarty_obj->_trigger_error_msg("parameter 'file' cannot be empty");
$smarty->trigger_error("parameter 'file' cannot be empty");
return;
}
if ($smarty_obj->security && !preg_match('!^(http|ftp)://!', $file)) {
if ($smarty->security && !preg_match('!^(http|ftp)://!', $file)) {
// make sure fetched file comes from secure directory
foreach ($smarty_obj->secure_dir as $curr_dir) {
foreach ($smarty->secure_dir as $curr_dir) {
if (substr(realpath($file), 0, strlen(realpath($curr_dir))) == realpath($curr_dir)) {
$resource_is_secure = true;
break;
}
}
if (!$resource_is_secure) {
$smarty_obj->_trigger_error_msg("(secure mode) fetch '$file' is not allowed");
$smarty->trigger_error("(secure mode) fetch '$file' is not allowed");
return;
}
if (!@is_readable($file)) {
$smarty_obj->_trigger_error_msg("fetch cannot read file '$file'");
$smarty->trigger_error("fetch cannot read file '$file'");
return;
}
}
@@ -39,7 +39,7 @@ function smarty_function_fetch($args, &$smarty_obj)
if (!empty($assign)) {
ob_start();
readfile($file);
$smarty_obj->assign($assign,ob_get_contents());
$smarty->assign($assign,ob_get_contents());
ob_end_clean();
} else {
readfile($file);