OSDN Git Service

BugTrack2/290 Rename 'http_request' function to 'pkwk_http_request'
authorumorigu <umorigu@gmail.com>
Thu, 4 Feb 2016 15:43:45 +0000 (00:43 +0900)
committerumorigu <umorigu@gmail.com>
Thu, 4 Feb 2016 15:43:45 +0000 (00:43 +0900)
pecl_http extension also have the function named 'http_request'.
So, if pecl_http is enable, PukiWiki crashes because of
the name conflict.
I renamed the function to 'pkwk_http_request'.
And I also defined 'http_request' function on the environment
without pecl_http for the backword (mainly your plugin) compatibility.

lib/proxy.php
plugin/amazon.inc.php
plugin/showrss.inc.php

index fb63966..3683b33 100644 (file)
@@ -1,6 +1,7 @@
 <?php
-// $Id: proxy.php,v 1.9 2005/06/28 14:03:29 henoheno Exp $
-// Copyright (C) 2003-2005 PukiWiki Developers Team
+// PukiWiki - Yet another WikiWikiWeb clone
+// proxy.php
+// Copyright: 2003-2016 PukiWiki Development Team
 // License: GPL v2 or (at your option) any later version
 //
 // HTTP-Proxy related functions
@@ -8,8 +9,19 @@
 // Max number of 'track' redirection message with 301 or 302 response
 define('PKWK_HTTP_REQUEST_URL_REDIRECT_MAX', 2);
 
+// We also define deprecated function 'http_request' for backward compatibility
+if (!function_exists('http_request')) {
+       // pecl_http extension also have the function named 'http_request'
+       function http_request($url, $method = 'GET', $headers = '',
+               $post = array(), $redirect_max = PKWK_HTTP_REQUEST_URL_REDIRECT_MAX,
+               $content_charset = '') {
+               return pkwk_http_request($url, $method, $headers, $post,
+                       $redirect_max, $content_charset);
+       }
+}
+
 /*
- * http_request($url)
+ * pkwk_http_request($url)
  *     Get / Send data via HTTP request
  * $url     : URI started with http:// (http://user:pass@host:port/path?query)
  * $method  : GET, POST, or HEAD
@@ -18,7 +30,7 @@ define('PKWK_HTTP_REQUEST_URL_REDIRECT_MAX', 2);
  * $redirect_max : Max number of HTTP redirect
  * $content_charset : Content charset. Use '' or CONTENT_CHARSET
 */
-function http_request($url, $method = 'GET', $headers = '', $post = array(),
+function pkwk_http_request($url, $method = 'GET', $headers = '', $post = array(),
        $redirect_max = PKWK_HTTP_REQUEST_URL_REDIRECT_MAX, $content_charset = '')
 {
        global $use_proxy, $no_proxy, $proxy_host, $proxy_port;
@@ -114,7 +126,7 @@ function http_request($url, $method = 'GET', $headers = '', $post = array(),
                                $url = $url_base . $url; // Add sheme, host
                        }
                        // Redirect
-                       return http_request($url, $method, $headers, $post, $redirect_max);
+                       return pkwk_http_request($url, $method, $headers, $post, $redirect_max);
                }
        }
        return array(
@@ -165,4 +177,3 @@ function in_the_net($networks = array(), $host = '')
 
        return FALSE; // Not found
 }
-?>
index bf0baeb..636edfc 100644 (file)
@@ -1,12 +1,11 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: amazon.inc.php,v 1.16 2011/01/25 15:01:01 henoheno Exp $
-// Id: amazon.inc.php,v 1.1 2003/07/24 13:00:00 閑舎
+// amazon.inc.php
 //
 // Amazon plugin: Book-review maker via amazon.com/amazon.jp
 //
 // Copyright:
-//     2004-2005 PukiWiki Developers Team
+//     2004-2016 PukiWiki Development Team
 //     2003 閑舎 <raku@rakunet.org> (Original author)
 //
 // License: GNU/GPL
@@ -441,7 +440,7 @@ function plugin_amazon_review_save($page, $data)
 
 function plugin_amazon_get_page($url)
 {
-       $data = http_request($url);
+       $data = pkwk_http_request($url);
        return ($data['rc'] == 200) ? $data['data'] : '';
 }
 
@@ -461,4 +460,3 @@ function is_asin()
                return TRUE;
        }
 }
-
index ece800b..c7bc235 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: showrss.inc.php,v 1.22 2011/01/25 15:01:01 henoheno Exp $
-//  Id:showrss.inc.php,v 1.40 2003/03/18 11:52:58 hiro Exp
-// Copyright (C):
-//     2002-2006 PukiWiki Developers Team
+// showrss.inc.php
+// Copyright:
+//     2002-2016 PukiWiki Development Team
 //     2002      PANDA <panda@arino.jp>
 //     (Original)hiro_do3ob@yahoo.co.jp
 // License: GPL, same as PukiWiki
@@ -167,7 +166,7 @@ function plugin_showrss_get_rss($target, $cachehour)
 
        if ($time === NULL) {
                // Newly get RSS
-               $data = http_request($target);
+               $data = pkwk_http_request($target);
                if ($data['rc'] !== 200)
                        return array(FALSE, 0);
 
@@ -323,4 +322,3 @@ function plugin_showrss_get_timestamp($str)
                return ($time == -1) ? UTIME : $time - LOCALZONE;
        }
 }
-?>