Fix returned url on successful add_post

Maybe fixed error response on failure


git-svn-id: file:///home/shish/svn/shimmie2/trunk@362 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
jjs 2007-07-23 23:08:40 +00:00
parent 9464d9b2ee
commit e06a63c955

View file

@ -7,7 +7,7 @@ simple HTTP GET/POST requests.
Author: JJS <jsutinen@gmail.com> Author: JJS <jsutinen@gmail.com>
Notes: Notes:
danbooru API based on documentation from danbooru 1.0 - http://attachr.com/7569 danbooru API based on documentation from danbooru 1.0 - http://attachr.com/7569
I've only been able to test add_post and find_tags beacuse I use the old danbooru firefox extension for firefox 1.5 I've only been able to test add_post and find_tags because I use the old danbooru firefox extension for firefox 1.5
Functions currently implemented: Functions currently implemented:
add_comment - NOT DONE YET, waiting on some backend shimmie code :) add_comment - NOT DONE YET, waiting on some backend shimmie code :)
@ -221,11 +221,10 @@ class DanbooruApi extends Extension
} else } else
{ // If it went ok, grab the id for the newly uploaded image and pass it in the header { // If it went ok, grab the id for the newly uploaded image and pass it in the header
$newimg = $database->get_image_by_hash($image->hash); $newimg = $database->get_image_by_hash($image->hash);
$newid = "http://" . $_SERVER['HTTP_HOST'] . make_link("post/view/" . $newimg->id); $newid = make_link("post/view/" . $newimg->id);
// Did we POST or GET this call? // Did we POST or GET this call?
if($_SERVER['REQUEST_METHOD'] == 'POST') if($_SERVER['REQUEST_METHOD'] == 'POST')
{ {
header("X-You-Win: yes");
header("X-Danbooru-Location: $newid"); header("X-Danbooru-Location: $newid");
} }
else else