mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/11603] Fix spacing and add some comments
PHPBB3-11603
This commit is contained in:
parent
e4ccc5e6ea
commit
92c55ab111
1 changed files with 5 additions and 2 deletions
|
@ -161,12 +161,14 @@ function api_request($query, $full_url = false)
|
||||||
curl_close($c);
|
curl_close($c);
|
||||||
|
|
||||||
$sub_request_result = array();
|
$sub_request_result = array();
|
||||||
|
// Split possible headers from the body
|
||||||
if ($contents && strpos($contents, "\r\n\r\n") > 0)
|
if ($contents && strpos($contents, "\r\n\r\n") > 0)
|
||||||
{
|
{
|
||||||
list($header, $contents) = explode("\r\n\r\n", $contents);
|
list($header, $contents) = explode("\r\n\r\n", $contents);
|
||||||
foreach (explode("\n", $header) as $header_element)
|
foreach (explode("\n", $header) as $header_element)
|
||||||
{
|
{
|
||||||
if (strpos($header_element, 'Link') === 0)
|
// Find Link Header which gives us a link to the next page
|
||||||
|
if (strpos($header_element, 'Link: ') === 0)
|
||||||
{
|
{
|
||||||
list($head, $header_content) = explode(': ', $header_element);
|
list($head, $header_content) = explode(': ', $header_element);
|
||||||
foreach (explode(', ', $header_content) as $links)
|
foreach (explode(', ', $header_content) as $links)
|
||||||
|
@ -174,6 +176,7 @@ function api_request($query, $full_url = false)
|
||||||
list($url, $rel) = explode('; ', $links);
|
list($url, $rel) = explode('; ', $links);
|
||||||
if ($rel == 'rel="next"')
|
if ($rel == 'rel="next"')
|
||||||
{
|
{
|
||||||
|
// Found a next link, follow it and merge the results
|
||||||
$sub_request_result = api_request(substr($url, 1, -1), true);
|
$sub_request_result = api_request(substr($url, 1, -1), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue