cvs: phpweb /include site.inc
| From: | Philip Olson | Date: | Sat, 07 Jun 2008 05:05:19 +0000 |
| Subject: | cvs: phpweb /include site.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-1885@lists.php.net to get a copy of this message | ||
philip Sat Jun 7 05:05:19 2008 UTC
Modified files:
/phpweb/include site.inc
Log:
oops, context requires php 5+ ...
# /me curses at user-agent headers
http://cvs.php.net/viewvc.cgi/phpweb/include/site.inc?r1=1.258&r2=1.259&diff_format=u
Index: phpweb/include/site.inc
diff -u phpweb/include/site.inc:1.258 phpweb/include/site.inc:1.259
--- phpweb/include/site.inc:1.258 Sat Jun 7 02:34:53 2008
+++ phpweb/include/site.inc Sat Jun 7 05:05:19 2008
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: site.inc,v 1.258 2008/06/07 02:34:53 philip Exp $
+// $Id: site.inc,v 1.259 2008/06/07 05:05:19 philip Exp $
// Define $MIRRORS array, and some constants
include $_SERVER['DOCUMENT_ROOT'] . '/include/mirrors.inc';
@@ -176,11 +176,14 @@
// Compatibility function to fetch data from external source
function fetch_contents($url, $headers = false) {
- if(function_exists('file_get_contents') &&
ini_get('allow_url_fopen')) {
- $opts = array('user_agent' => 'php.net',);
- $context = stream_context_create(array('http' => $opts));
- $data = @file_get_contents($url, false, $context);
+ if (version_compare(PHP_VERSION, '5.0.0', '>')) {
+ if(function_exists('file_get_contents') &&
ini_get('allow_url_fopen')) {
+ $opts = array('user_agent' => 'php.net');
+ $context = stream_context_create(array('http' => $opts));
+ $data = @file_get_contents($url, false, $context);
+ }
+
if ($headers) {
return $http_response_header;
}
@@ -245,6 +248,7 @@
return $data;
}
+ // TODO: Log if we get here
// Redirect to www.php.net ?
return array("ERROR" => "Unable to find a way to retrieve data");
}