requestcontext stuff is messy, go back to globals :(

This commit is contained in:
Shish
2009-05-11 07:04:33 -07:00
parent e592ee4c59
commit bb84a735a2
57 changed files with 407 additions and 477 deletions

View File

@ -208,7 +208,7 @@ class DanbooruApi implements Extension
// It is also currently broken due to some confusion over file variable ($tmp_filename?)
// Does it exist already?
$existing = Image::by_hash($config, $database, $hash);
$existing = Image::by_hash($hash);
if(!is_null($existing)) {
header("HTTP/1.0 409 Conflict");
header("X-Danbooru-Errors: duplicate");
@ -227,7 +227,7 @@ class DanbooruApi implements Extension
$nevent = new DataUploadEvent($user, $file, $metadata);
send_event($nevent);
// If it went ok, grab the id for the newly uploaded image and pass it in the header
$newimg = Image::by_hash($config, $database, $hash);
$newimg = Image::by_hash($hash);
$newid = make_link("post/view/" . $newimg->id);
// Did we POST or GET this call?
if($_SERVER['REQUEST_METHOD'] == 'POST')
@ -269,21 +269,21 @@ class DanbooruApi implements Extension
$md5list = explode(",",$_GET['md5']);
foreach($md5list as $md5)
{
$results[] = Image::by_hash($config, $database, $md5);
$results[] = Image::by_hash($md5);
}
} elseif(isset($_GET['id']))
{
$idlist = explode(",",$_GET['id']);
foreach($idlist as $id)
{
$results[] = Image::by_id($config, $database, $id);
$results[] = Image::by_id($id);
}
} else
{
$limit = isset($_GET['limit']) ? int_escape($_GET['limit']) : 100;
$start = isset($_GET['offset']) ? int_escape($_GET['offset']) : 0;
$tags = isset($_GET['tags']) ? Tag::explode($_GET['tags']) : array();
$results = Image::find_images($config,$database,$start,$limit,$tags);
$results = Image::find_images($start, $limit, $tags);
}
// Now we have the array $results filled with Image objects
@ -392,12 +392,12 @@ class DanbooruApi implements Extension
$name = $_REQUEST['login'];
$pass = $_REQUEST['password'];
$hash = md5( strtolower($name) . $pass );
$duser = User::by_name_and_hash($config, $database, $name, $hash);
$duser = User::by_name_and_hash($name, $hash);
if(!is_null($duser)) {
$user = $duser;
} else
{
$user = User::by_id($config, $database, $config->get_int("anon_id", 0));
$user = User::by_id($config->get_int("anon_id", 0));
}
}
}