user admin things moved to user_admin, user/* is now usernames only

git-svn-id: file:///home/shish/svn/shimmie2/trunk@385 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-27 13:05:48 +00:00
parent 63777446bf
commit 6ceb65c49b
3 changed files with 22 additions and 24 deletions

View file

@ -34,7 +34,7 @@ class Downtime extends Extension {
}
private function is_safe_page($event) {
if($event->page_name == "user" && $event->get_arg(0) == "login") return true;
if($event->page_name == "user_admin" && $event->get_arg(0) == "login") return true;
else return false;
}
}

View file

@ -37,8 +37,7 @@ class UserPage extends Extension {
$config->set_default_int("login_memory", 365);
}
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "user")) {
global $page;
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "user_admin")) {
global $user;
global $database;
global $config;
@ -53,10 +52,10 @@ class UserPage extends Extension {
}
else if($event->get_arg(0) == "logout") {
setcookie("shm_session", "", time()+60*60*24*$config->get_int('login_memory'), "/");
$page->set_mode("redirect");
$page->set_redirect(make_link());
$event->page->set_mode("redirect");
$event->page->set_redirect(make_link());
}
else if($event->get_arg(0) == "changepass") {
else if($event->get_arg(0) == "change_pass") {
$this->change_password_wrapper($event->page);
}
else if($event->get_arg(0) == "create") {
@ -65,16 +64,17 @@ class UserPage extends Extension {
else if($event->get_arg(0) == "set_more") {
$this->set_more_wrapper($event->page);
}
else { // view
$duser = ($event->count_args() == 0) ? $user : $database->get_user_by_name($event->get_arg(0));
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...");
}
}
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "user")) {
global $user;
$duser = ($event->count_args() == 0) ? $user : $database->get_user_by_name($event->get_arg(0));
if(!is_null($duser)) {
send_event(new UserPageBuildingEvent($event->page, $duser));
}
else {
$this->theme->display_error($event->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...");
}
}
@ -111,7 +111,7 @@ class UserPage extends Extension {
if(is_a($event, 'UserBlockBuildingEvent')) {
$event->add_link("User Config", make_link("user"));
$event->add_link("Log Out", make_link("user/logout"), 99);
$event->add_link("Log Out", make_link("user_admin/logout"), 99);
}
}
// }}}

View file

@ -24,7 +24,7 @@ class UserPageTheme extends Themelet {
else {$html = "<p>$tac</p>";}
$html .= "
<form action='".make_link("user/create")."' method='POST'>
<form action='".make_link("user_admin/create")."' method='POST'>
<table style='width: 300px;' border='1'>
<tr><td>Name</td><td><input type='text' name='name'></td></tr>
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
@ -52,7 +52,7 @@ class UserPageTheme extends Themelet {
public function display_login_block($page) {
global $config;
$html = "
<form action='".make_link("user/login")."' method='POST'>
<form action='".make_link("user_admin/login")."' method='POST'>
<table border='1' summary='Login Form'>
<tr><td width='70'>Name</td><td width='70'><input type='text' name='user'></td></tr>
<tr><td>Password</td><td><input type='password' name='pass'></td></tr>
@ -61,7 +61,7 @@ class UserPageTheme extends Themelet {
</form>
";
if($config->get_bool("login_signup_enabled")) {
$html .= "<small><a href='".make_link("user/create")."'>Create Account</a></small>";
$html .= "<small><a href='".make_link("user_admin/create")."'>Create Account</a></small>";
}
$page->add_block(new Block("Login", $html, "left", 90));
}
@ -128,7 +128,7 @@ class UserPageTheme extends Themelet {
$html = "";
$html .= "
<form action='".make_link("user/changepass")."' method='POST'>
<form action='".make_link("user_admin/change_pass")."' method='POST'>
<input type='hidden' name='name' value='{$duser->name}'>
<input type='hidden' name='id' value='{$duser->id}'>
<table style='width: 300px;' border='1'>
@ -151,7 +151,7 @@ class UserPageTheme extends Themelet {
$h_is_enabled = $duser->is_enabled() ? " checked" : "";
$html = "
<form action='".make_link("user/set_more")."' method='POST'>
<form action='".make_link("user_admin/set_more")."' method='POST'>
<input type='hidden' name='id' value='$i_user_id'>
Admin: <input name='admin' type='checkbox'$h_is_admin>
<br>Enabled: <input name='enabled' type='checkbox'$h_is_enabled>
@ -160,8 +160,6 @@ class UserPageTheme extends Themelet {
";
return $html;
}
// }}}
}
?>