move md5: to danbooru api
git-svn-id: file:///home/shish/svn/shimmie2/trunk@714 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
2948a4435e
commit
fb62229634
2 changed files with 10 additions and 1 deletions
|
@ -42,6 +42,15 @@ class DanbooruApi extends Extension
|
|||
// execute the danbooru processing code
|
||||
$this->api_danbooru($event);
|
||||
}
|
||||
if(is_a($event, 'SearchTermParseEvent'))
|
||||
{
|
||||
$matches = array();
|
||||
if(preg_match("/md5:([0-9a-fA-F]*)/i", $event->term, $matches))
|
||||
{
|
||||
$hash = strtolower($matches[2]);
|
||||
$event->set_querylet(new Querylet("AND (images.hash = '$hash')"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Danbooru API
|
||||
|
|
|
@ -109,7 +109,7 @@ class Index extends Extension {
|
|||
}
|
||||
$event->set_querylet(new Querylet("AND (images.owner_id = $user_id)"));
|
||||
}
|
||||
else if(preg_match("/(hash=|md5:)([0-9a-fA-F]*)/i", $event->term, $matches)) {
|
||||
else if(preg_match("/hash=([0-9a-fA-F]*)/i", $event->term, $matches)) {
|
||||
$hash = strtolower($matches[2]);
|
||||
$event->set_querylet(new Querylet("AND (images.hash = '$hash')"));
|
||||
}
|
||||
|
|
Reference in a new issue