move user search to user extension, and search by ID
git-svn-id: file:///home/shish/svn/shimmie2/trunk@719 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
86f805a088
commit
c828ce5cfe
@ -98,17 +98,6 @@ class Index extends Extension {
|
|||||||
$val = parse_shorthand_int($matches[3]);
|
$val = parse_shorthand_int($matches[3]);
|
||||||
$event->set_querylet(new Querylet("AND (images.$col $cmp $val)"));
|
$event->set_querylet(new Querylet("AND (images.$col $cmp $val)"));
|
||||||
}
|
}
|
||||||
else if(preg_match("/(poster|user)=(.*)/i", $event->term, $matches)) {
|
|
||||||
global $database;
|
|
||||||
$user = $database->get_user_by_name($matches[2]);
|
|
||||||
if(!is_null($user)) {
|
|
||||||
$user_id = $user->id;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$user_id = -1;
|
|
||||||
}
|
|
||||||
$event->set_querylet(new Querylet("AND (images.owner_id = $user_id)"));
|
|
||||||
}
|
|
||||||
else if(preg_match("/hash=([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]);
|
$hash = strtolower($matches[2]);
|
||||||
$event->set_querylet(new Querylet("AND (images.hash = '$hash')"));
|
$event->set_querylet(new Querylet("AND (images.hash = '$hash')"));
|
||||||
|
@ -157,6 +157,25 @@ class UserPage extends Extension {
|
|||||||
if(is_a($event, 'UserCreationEvent')) {
|
if(is_a($event, 'UserCreationEvent')) {
|
||||||
if($this->check_user_creation($event)) $this->create_user($event);
|
if($this->check_user_creation($event)) $this->create_user($event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(is_a($event, 'SearchTermParseEvent')) {
|
||||||
|
$matches = array();
|
||||||
|
if(preg_match("/(poster|user)=(.*)/i", $event->term, $matches)) {
|
||||||
|
global $database;
|
||||||
|
$user = $database->get_user_by_name($matches[2]);
|
||||||
|
if(!is_null($user)) {
|
||||||
|
$user_id = $user->id;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$user_id = -1;
|
||||||
|
}
|
||||||
|
$event->set_querylet(new Querylet("AND (images.owner_id = $user_id)"));
|
||||||
|
}
|
||||||
|
else if(preg_match("/(poster|user)_id=([0-9]+)/i", $event->term, $matches)) {
|
||||||
|
$user_id = int_escape($matches[2]);
|
||||||
|
$event->set_querylet(new Querylet("AND (images.owner_id = $user_id)"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
// Things done *with* the user {{{
|
// Things done *with* the user {{{
|
||||||
|
@ -132,8 +132,8 @@ class UserPageTheme extends Themelet {
|
|||||||
$h_image_rate = sprintf("%3.1f", ($i_image_count / $i_days_old2));
|
$h_image_rate = sprintf("%3.1f", ($i_image_count / $i_days_old2));
|
||||||
$h_comment_rate = sprintf("%3.1f", ($i_comment_count / $i_days_old2));
|
$h_comment_rate = sprintf("%3.1f", ($i_comment_count / $i_days_old2));
|
||||||
|
|
||||||
$u_name = url_escape($duser->name);
|
$u_id = url_escape($duser->id);
|
||||||
$images_link = make_link("post/list/user=$u_name/1");
|
$images_link = make_link("post/list/user_id=$u_id/1");
|
||||||
|
|
||||||
return "
|
return "
|
||||||
Join date: $h_join_date ($i_days_old days old)
|
Join date: $h_join_date ($i_days_old days old)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user