don't send UPBE for null user

git-svn-id: file:///home/shish/svn/shimmie2/trunk@367 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-26 11:49:52 +00:00
parent 25a355a51a
commit 446c3a3579
2 changed files with 18 additions and 18 deletions

View File

@ -67,7 +67,14 @@ class UserPage extends Extension {
}
else { // view
$duser = ($event->count_args() == 0) ? $user : $database->get_user_by_name($event->get_arg(0));
send_event(new UserPageBuildingEvent($event->page, $duser));
if(!is_null($duser)) {
send_event(new UserPageBuildingEvent($event->page, $duser));
}
else {
$this->theme->display_error($page, "No Such User",
"If you typed the ID by hand, try again; if you came from a link on this ".
"site, it might be bug report time...");
}
}
}

View File

@ -75,25 +75,18 @@ class UserPageTheme extends Themelet {
}
public function display_user_page($page, $duser, $user) {
if(!is_null($duser)) {
$page->set_title("{$duser->name}'s Page");
$page->set_heading("{$duser->name}'s Page");
$page->add_block(new NavBlock());
$page->add_block(new Block("Stats", $this->build_stats($duser)));
$page->set_title("{$duser->name}'s Page");
$page->set_heading("{$duser->name}'s Page");
$page->add_block(new NavBlock());
$page->add_block(new Block("Stats", $this->build_stats($duser)));
if(!$user->is_anonymous()) {
if($user->id == $duser->id || $user->is_admin()) {
$page->add_block(new Block("Options", $this->build_options($duser), "main", 0));
}
if($user->is_admin()) {
$page->add_block(new Block("More Options", $this->build_more_options($duser)));
}
if(!$user->is_anonymous()) {
if($user->id == $duser->id || $user->is_admin()) {
$page->add_block(new Block("Options", $this->build_options($duser), "main", 0));
}
if($user->is_admin()) {
$page->add_block(new Block("More Options", $this->build_more_options($duser)));
}
}
else {
$this->display_error($page, "No Such User",
"If you typed the ID by hand, try again; if you came from a link on this ".
"site, it might be bug report time...");
}
}