silence warnings in fetch plugin

This commit is contained in:
mohrt
2003-02-24 14:23:39 +00:00
parent 4a12662369
commit 52f15b67b2
2 changed files with 6 additions and 3 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- silence PHP warnings in function.fetch.php (Eduardo,
Monte)
- added get_config_vars(), same basic functionality as - added get_config_vars(), same basic functionality as
get_template_vars() (Monte) get_template_vars() (Monte)
- update get_template_vars() to be able to get - update get_template_vars() to be able to get

View File

@@ -59,7 +59,7 @@ function smarty_function_fetch($params, &$smarty)
$port = $uri_parts['port']; $port = $uri_parts['port'];
} }
if(empty($uri_parts['user'])) { if(empty($uri_parts['user'])) {
$user = $uri_parts['user']; $user = '';
} }
// loop through parameters, setup headers // loop through parameters, setup headers
foreach($params as $param_key => $param_value) { foreach($params as $param_key => $param_value) {
@@ -157,7 +157,7 @@ function smarty_function_fetch($params, &$smarty)
if(!empty($referer)) { if(!empty($referer)) {
fputs($fp, "Referer: $referer\r\n"); fputs($fp, "Referer: $referer\r\n");
} }
if(is_array($extra_headers)) { if(isset($extra_headers) && is_array($extra_headers)) {
foreach($extra_headers as $curr_header) { foreach($extra_headers as $curr_header) {
fputs($fp, $curr_header."\r\n"); fputs($fp, $curr_header."\r\n");
} }
@@ -166,6 +166,7 @@ function smarty_function_fetch($params, &$smarty)
fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n"); fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
} }
$content = '';
fputs($fp, "\r\n"); fputs($fp, "\r\n");
while(!feof($fp)) { while(!feof($fp)) {
$content .= fgets($fp,4096); $content .= fgets($fp,4096);