From 3fd230bb501337153771098083e1379875d98235 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 11 Sep 2015 17:11:33 +0200 Subject: Image delete feature --- inc/download.inc.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'inc/download.inc.php') diff --git a/inc/download.inc.php b/inc/download.inc.php index 5347e2ee..51601545 100644 --- a/inc/download.inc.php +++ b/inc/download.inc.php @@ -69,11 +69,13 @@ class Download public static function asStringPost($url, $params, $timeout, &$code) { $string = ''; - foreach ($params as $k => $v) { - if (!empty($string)) { - $string .= '&'; + if (is_array($params)) { + foreach ($params as $k => $v) { + if (!empty($string)) { + $string .= '&'; + } + $string .= $k . '=' . urlencode($v); } - $string .= $k . '=' . urlencode($v); } $ch = self::initCurl($url, $timeout, $head); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @@ -115,7 +117,7 @@ class Download return false; } if (preg_match_all('#\bHTTP/\d+\.\d+ (\d+) #', $head, $out, PREG_SET_ORDER)) { - $code = (int) $out[count($out)-1][1]; + $code = (int) $out[count($out) - 1][1]; } else { $code = '999 ' . curl_error($ch); } -- cgit v1.2.3-55-g7522