Update of /cvsroot/php-blog/serendipity/include/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26947/include/admin
Modified Files:
images.inc.php
Log Message:
now that we have the needed pear classes anyway, we could use http_request and make it possible to fetch remote images even if allow_furl_open is disabled.
Index: images.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/images.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- images.inc.php 27 Nov 2004 22:14:15 -0000 1.3
+++ images.inc.php 6 Dec 2004 09:28:36 -0000 1.4
@@ -122,10 +122,15 @@
if (file_exists($target)) {
echo '(' . $target . ') ' . ERROR_FILE_EXISTS_ALREADY;
} else {
- // Fetch file
- if (!$fContent = @file_get_contents($serendipity['POST']['imageurl']) ) {
+ require_once "HTTP/Request.php";
+ $req = &new HTTP_Request($serendipity['POST']['imageurl']);
+ // Try to get the URL
+
+ if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
printf(REMOTE_FILE_NOT_FOUND, $serendipity['POST']['imageurl']);
} else {
+ // Fetch file
+ $fContent = $req->getResponseBody();
$fp = fopen($target, 'w');
fwrite($fp, $fContent);
fclose($fp);
|