Include image count and offset in root tag
This commit is contained in:
parent
b6235695da
commit
619382d1b9
1 changed files with 3 additions and 2 deletions
|
@ -265,7 +265,7 @@ class DanbooruApi extends Extension {
|
|||
* id: id to search for (comma delimited)
|
||||
* tags: what tags to search for
|
||||
* limit: limit
|
||||
* offset: offset
|
||||
* page: page number
|
||||
* after_id: limit results to posts added after this id
|
||||
*/
|
||||
if(($event->get_arg(1) == 'find_posts') || (($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'index.xml')))
|
||||
|
@ -290,12 +290,13 @@ class DanbooruApi extends Extension {
|
|||
$limit = isset($_GET['limit']) ? int_escape($_GET['limit']) : 100;
|
||||
$start = (isset($_GET['page']) ? int_escape($_GET['page'])-1 : 0) * $limit;
|
||||
$tags = isset($_GET['tags']) ? Tag::explode($_GET['tags']) : array();
|
||||
$count = Image::count_images($tags);
|
||||
$results = Image::find_images(max($start, 0), min($limit, 100), $tags);
|
||||
}
|
||||
|
||||
// Now we have the array $results filled with Image objects
|
||||
// Let's display them
|
||||
$xml = "<posts>\n";
|
||||
$xml = "<posts count=\"$count\" offset=\"$start\">\n";
|
||||
foreach($results as $img)
|
||||
{
|
||||
// Sanity check to see if $img is really an image object
|
||||
|
|
Reference in a new issue