• R/O
  • HTTP
  • SSH
  • HTTPS

pukiwiki: Commit


Commit MetaInfo

Revision8e23f5085f264a8a8c013cc53ea70d6ca17a2569 (tree)
Time2016-02-05 00:43:45
Authorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

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.

Change Summary

Incremental Difference

--- a/lib/proxy.php
+++ b/lib/proxy.php
@@ -1,6 +1,7 @@
11 <?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
45 // License: GPL v2 or (at your option) any later version
56 //
67 // HTTP-Proxy related functions
@@ -8,8 +9,19 @@
89 // Max number of 'track' redirection message with 301 or 302 response
910 define('PKWK_HTTP_REQUEST_URL_REDIRECT_MAX', 2);
1011
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+
1123 /*
12- * http_request($url)
24+ * pkwk_http_request($url)
1325 * Get / Send data via HTTP request
1426 * $url : URI started with http:// (http://user:pass@host:port/path?query)
1527 * $method : GET, POST, or HEAD
@@ -18,7 +30,7 @@ define('PKWK_HTTP_REQUEST_URL_REDIRECT_MAX', 2);
1830 * $redirect_max : Max number of HTTP redirect
1931 * $content_charset : Content charset. Use '' or CONTENT_CHARSET
2032 */
21-function http_request($url, $method = 'GET', $headers = '', $post = array(),
33+function pkwk_http_request($url, $method = 'GET', $headers = '', $post = array(),
2234 $redirect_max = PKWK_HTTP_REQUEST_URL_REDIRECT_MAX, $content_charset = '')
2335 {
2436 global $use_proxy, $no_proxy, $proxy_host, $proxy_port;
@@ -114,7 +126,7 @@ function http_request($url, $method = 'GET', $headers = '', $post = array(),
114126 $url = $url_base . $url; // Add sheme, host
115127 }
116128 // Redirect
117- return http_request($url, $method, $headers, $post, $redirect_max);
129+ return pkwk_http_request($url, $method, $headers, $post, $redirect_max);
118130 }
119131 }
120132 return array(
@@ -165,4 +177,3 @@ function in_the_net($networks = array(), $host = '')
165177
166178 return FALSE; // Not found
167179 }
168-?>
--- a/plugin/amazon.inc.php
+++ b/plugin/amazon.inc.php
@@ -1,12 +1,11 @@
11 <?php
22 // 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
54 //
65 // Amazon plugin: Book-review maker via amazon.com/amazon.jp
76 //
87 // Copyright:
9-// 2004-2005 PukiWiki Developers Team
8+// 2004-2016 PukiWiki Development Team
109 // 2003 閑舎 <raku@rakunet.org> (Original author)
1110 //
1211 // License: GNU/GPL
@@ -441,7 +440,7 @@ function plugin_amazon_review_save($page, $data)
441440
442441 function plugin_amazon_get_page($url)
443442 {
444- $data = http_request($url);
443+ $data = pkwk_http_request($url);
445444 return ($data['rc'] == 200) ? $data['data'] : '';
446445 }
447446
@@ -461,4 +460,3 @@ function is_asin()
461460 return TRUE;
462461 }
463462 }
464-
--- a/plugin/showrss.inc.php
+++ b/plugin/showrss.inc.php
@@ -1,9 +1,8 @@
11 <?php
22 // 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
76 // 2002 PANDA <panda@arino.jp>
87 // (Original)hiro_do3ob@yahoo.co.jp
98 // License: GPL, same as PukiWiki
@@ -167,7 +166,7 @@ function plugin_showrss_get_rss($target, $cachehour)
167166
168167 if ($time === NULL) {
169168 // Newly get RSS
170- $data = http_request($target);
169+ $data = pkwk_http_request($target);
171170 if ($data['rc'] !== 200)
172171 return array(FALSE, 0);
173172
@@ -323,4 +322,3 @@ function plugin_showrss_get_timestamp($str)
323322 return ($time == -1) ? UTIME : $time - LOCALZONE;
324323 }
325324 }
326-?>
Show on old repository browser