mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
update fetch funtion to respect security setting
This commit is contained in:
@@ -476,13 +476,17 @@ function smarty_func_math() {
|
||||
Function: smarty_func_fetch
|
||||
Purpose: fetch file, web or ftp data and display results
|
||||
\*======================================================================*/
|
||||
function smarty_func_fetch() {
|
||||
extract(func_get_arg(0));
|
||||
function smarty_func_fetch($args,&$smarty_obj) {
|
||||
extract($args);
|
||||
|
||||
if(empty($file)) {
|
||||
trigger_error("parameter 'file' cannot be empty");
|
||||
return;
|
||||
}
|
||||
if($smarty_obj->security && !preg_match("/^(http|ftp):\/\//",$file)) {
|
||||
trigger_error("(secure mode) file must start with http:// or ftp://");
|
||||
return;
|
||||
}
|
||||
readfile($file);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user