PukiWiki
修订版 | 8e23f5085f264a8a8c013cc53ea70d6ca17a2569 (tree) |
---|---|
时间 | 2016-02-05 00:43:45 |
作者 | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack2/290 Rename 'http_request' function to 'pkwk_http_request'
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.
@@ -1,6 +1,7 @@ | ||
1 | 1 | <?php |
2 | -// $Id: proxy.php,v 1.9 2005/06/28 14:03:29 henoheno Exp $ | |
3 | -// Copyright (C) 2003-2005 PukiWiki Developers Team | |
2 | +// PukiWiki - Yet another WikiWikiWeb clone | |
3 | +// proxy.php | |
4 | +// Copyright: 2003-2016 PukiWiki Development Team | |
4 | 5 | // License: GPL v2 or (at your option) any later version |
5 | 6 | // |
6 | 7 | // HTTP-Proxy related functions |
@@ -8,8 +9,19 @@ | ||
8 | 9 | // Max number of 'track' redirection message with 301 or 302 response |
9 | 10 | define('PKWK_HTTP_REQUEST_URL_REDIRECT_MAX', 2); |
10 | 11 | |
12 | +// We also define deprecated function 'http_request' for backward compatibility | |
13 | +if (!function_exists('http_request')) { | |
14 | + // pecl_http extension also have the function named 'http_request' | |
15 | + function http_request($url, $method = 'GET', $headers = '', | |
16 | + $post = array(), $redirect_max = PKWK_HTTP_REQUEST_URL_REDIRECT_MAX, | |
17 | + $content_charset = '') { | |
18 | + return pkwk_http_request($url, $method, $headers, $post, | |
19 | + $redirect_max, $content_charset); | |
20 | + } | |
21 | +} | |
22 | + | |
11 | 23 | /* |
12 | - * http_request($url) | |
24 | + * pkwk_http_request($url) | |
13 | 25 | * Get / Send data via HTTP request |
14 | 26 | * $url : URI started with http:// (http://user:pass@host:port/path?query) |
15 | 27 | * $method : GET, POST, or HEAD |
@@ -18,7 +30,7 @@ define('PKWK_HTTP_REQUEST_URL_REDIRECT_MAX', 2); | ||
18 | 30 | * $redirect_max : Max number of HTTP redirect |
19 | 31 | * $content_charset : Content charset. Use '' or CONTENT_CHARSET |
20 | 32 | */ |
21 | -function http_request($url, $method = 'GET', $headers = '', $post = array(), | |
33 | +function pkwk_http_request($url, $method = 'GET', $headers = '', $post = array(), | |
22 | 34 | $redirect_max = PKWK_HTTP_REQUEST_URL_REDIRECT_MAX, $content_charset = '') |
23 | 35 | { |
24 | 36 | global $use_proxy, $no_proxy, $proxy_host, $proxy_port; |
@@ -114,7 +126,7 @@ function http_request($url, $method = 'GET', $headers = '', $post = array(), | ||
114 | 126 | $url = $url_base . $url; // Add sheme, host |
115 | 127 | } |
116 | 128 | // Redirect |
117 | - return http_request($url, $method, $headers, $post, $redirect_max); | |
129 | + return pkwk_http_request($url, $method, $headers, $post, $redirect_max); | |
118 | 130 | } |
119 | 131 | } |
120 | 132 | return array( |
@@ -165,4 +177,3 @@ function in_the_net($networks = array(), $host = '') | ||
165 | 177 | |
166 | 178 | return FALSE; // Not found |
167 | 179 | } |
168 | -?> |
@@ -1,12 +1,11 @@ | ||
1 | 1 | <?php |
2 | 2 | // PukiWiki - Yet another WikiWikiWeb clone. |
3 | -// $Id: amazon.inc.php,v 1.16 2011/01/25 15:01:01 henoheno Exp $ | |
4 | -// Id: amazon.inc.php,v 1.1 2003/07/24 13:00:00 閑舎 | |
3 | +// amazon.inc.php | |
5 | 4 | // |
6 | 5 | // Amazon plugin: Book-review maker via amazon.com/amazon.jp |
7 | 6 | // |
8 | 7 | // Copyright: |
9 | -// 2004-2005 PukiWiki Developers Team | |
8 | +// 2004-2016 PukiWiki Development Team | |
10 | 9 | // 2003 閑舎 <raku@rakunet.org> (Original author) |
11 | 10 | // |
12 | 11 | // License: GNU/GPL |
@@ -441,7 +440,7 @@ function plugin_amazon_review_save($page, $data) | ||
441 | 440 | |
442 | 441 | function plugin_amazon_get_page($url) |
443 | 442 | { |
444 | - $data = http_request($url); | |
443 | + $data = pkwk_http_request($url); | |
445 | 444 | return ($data['rc'] == 200) ? $data['data'] : ''; |
446 | 445 | } |
447 | 446 |
@@ -461,4 +460,3 @@ function is_asin() | ||
461 | 460 | return TRUE; |
462 | 461 | } |
463 | 462 | } |
464 | - |
@@ -1,9 +1,8 @@ | ||
1 | 1 | <?php |
2 | 2 | // PukiWiki - Yet another WikiWikiWeb clone |
3 | -// $Id: showrss.inc.php,v 1.22 2011/01/25 15:01:01 henoheno Exp $ | |
4 | -// Id:showrss.inc.php,v 1.40 2003/03/18 11:52:58 hiro Exp | |
5 | -// Copyright (C): | |
6 | -// 2002-2006 PukiWiki Developers Team | |
3 | +// showrss.inc.php | |
4 | +// Copyright: | |
5 | +// 2002-2016 PukiWiki Development Team | |
7 | 6 | // 2002 PANDA <panda@arino.jp> |
8 | 7 | // (Original)hiro_do3ob@yahoo.co.jp |
9 | 8 | // License: GPL, same as PukiWiki |
@@ -167,7 +166,7 @@ function plugin_showrss_get_rss($target, $cachehour) | ||
167 | 166 | |
168 | 167 | if ($time === NULL) { |
169 | 168 | // Newly get RSS |
170 | - $data = http_request($target); | |
169 | + $data = pkwk_http_request($target); | |
171 | 170 | if ($data['rc'] !== 200) |
172 | 171 | return array(FALSE, 0); |
173 | 172 |
@@ -323,4 +322,3 @@ function plugin_showrss_get_timestamp($str) | ||
323 | 322 | return ($time == -1) ? UTIME : $time - LOCALZONE; |
324 | 323 | } |
325 | 324 | } |
326 | -?> |