update fetch funtion to respect security setting

This commit is contained in:
mohrt
2001-06-13 19:57:03 +00:00
parent 47119594b5
commit 098630af9d

View File

@@ -476,13 +476,17 @@ function smarty_func_math() {
Function: smarty_func_fetch Function: smarty_func_fetch
Purpose: fetch file, web or ftp data and display results Purpose: fetch file, web or ftp data and display results
\*======================================================================*/ \*======================================================================*/
function smarty_func_fetch() { function smarty_func_fetch($args,&$smarty_obj) {
extract(func_get_arg(0)); extract($args);
if(empty($file)) { if(empty($file)) {
trigger_error("parameter 'file' cannot be empty"); trigger_error("parameter 'file' cannot be empty");
return; return;
} }
if($smarty_obj->security && !preg_match("/^(http|ftp):\/\//",$file)) {
trigger_error("(secure mode) file must start with http:// or ftp://");
return;
}
readfile($file); readfile($file);
} }