2007-07-16 19:47:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class UserPageTheme extends Themelet {
|
2009-01-04 19:18:37 +00:00
|
|
|
public function display_login_page(Page $page) {
|
2007-07-17 02:23:24 +00:00
|
|
|
$page->set_title("Login");
|
|
|
|
$page->set_heading("Login");
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
$page->add_block(new Block("Login There",
|
|
|
|
"There should be a login box to the left"));
|
2007-07-16 19:47:25 +00:00
|
|
|
}
|
|
|
|
|
2009-05-30 13:47:57 +00:00
|
|
|
public function display_user_list(Page $page, $users, User $user) {
|
|
|
|
$page->set_title("User List");
|
|
|
|
$page->set_heading("User List");
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
$html = "<table>";
|
|
|
|
$html .= "<tr><td>Name</td></tr>";
|
|
|
|
foreach($users as $duser) {
|
|
|
|
$html .= "<tr>";
|
2012-01-19 15:43:20 +00:00
|
|
|
$html .= "<td><a href='".make_link("user/".$duser->name)."'>".html_escape($duser->name)."</a></td>";
|
2009-05-30 13:47:57 +00:00
|
|
|
$html .= "</tr>";
|
|
|
|
}
|
|
|
|
$html .= "</table>";
|
|
|
|
$page->add_block(new Block("Users", $html));
|
|
|
|
}
|
|
|
|
|
2009-01-04 19:18:37 +00:00
|
|
|
public function display_user_links(Page $page, User $user, $parts) {
|
2007-08-01 17:11:46 +00:00
|
|
|
# $page->add_block(new Block("User Links", join(", ", $parts), "main", 10));
|
|
|
|
}
|
|
|
|
|
2009-01-04 19:18:37 +00:00
|
|
|
public function display_user_block(Page $page, User $user, $parts) {
|
2007-07-19 14:32:25 +00:00
|
|
|
$h_name = html_escape($user->name);
|
2009-08-03 09:46:40 +00:00
|
|
|
$html = "Logged in as $h_name";
|
|
|
|
foreach($parts as $part) {
|
|
|
|
$html .= "<br><a href='{$part["link"]}'>{$part["name"]}</a>";
|
|
|
|
}
|
2007-07-19 14:32:25 +00:00
|
|
|
$page->add_block(new Block("User Links", $html, "left", 90));
|
|
|
|
}
|
|
|
|
|
2009-01-04 19:18:37 +00:00
|
|
|
public function display_signup_page(Page $page) {
|
2007-07-16 19:47:25 +00:00
|
|
|
global $config;
|
2007-08-01 15:08:40 +00:00
|
|
|
$tac = $config->get_string("login_tac", "");
|
2007-07-16 19:47:25 +00:00
|
|
|
|
2010-01-05 19:06:04 +00:00
|
|
|
if($config->get_bool("login_tac_bbcode")) {
|
|
|
|
$tfe = new TextFormattingEvent($tac);
|
|
|
|
send_event($tfe);
|
|
|
|
$tac = $tfe->formatted;
|
|
|
|
}
|
2007-08-01 15:02:05 +00:00
|
|
|
|
2007-07-16 19:47:25 +00:00
|
|
|
if(empty($tac)) {$html = "";}
|
|
|
|
else {$html = "<p>$tac</p>";}
|
|
|
|
|
2010-01-23 12:40:03 +00:00
|
|
|
$reca = "<tr><td colspan='2'>".captcha_get_html()."</td></tr>";
|
2009-11-10 03:21:02 +00:00
|
|
|
|
2007-07-16 19:47:25 +00:00
|
|
|
$html .= "
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("user_admin/create"))."
|
2009-01-22 13:42:44 +00:00
|
|
|
<table style='width: 300px;'>
|
2007-07-16 19:47:25 +00:00
|
|
|
<tr><td>Name</td><td><input type='text' name='name'></td></tr>
|
|
|
|
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
|
|
|
|
<tr><td>Repeat Password</td><td><input type='password' name='pass2'></td></tr>
|
|
|
|
<tr><td>Email (Optional)</td><td><input type='text' name='email'></td></tr>
|
2009-11-10 03:21:02 +00:00
|
|
|
$reca
|
2007-07-16 19:47:25 +00:00
|
|
|
<tr><td colspan='2'><input type='Submit' value='Create Account'></td></tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
|
|
|
|
$page->set_title("Create Account");
|
|
|
|
$page->set_heading("Create Account");
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
$page->add_block(new Block("Signup", $html));
|
|
|
|
}
|
|
|
|
|
2009-01-04 19:18:37 +00:00
|
|
|
public function display_signups_disabled(Page $page) {
|
2007-07-27 00:49:03 +00:00
|
|
|
$page->set_title("Signups Disabled");
|
|
|
|
$page->set_heading("Signups Disabled");
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
$page->add_block(new Block("Signups Disabled",
|
|
|
|
"The board admin has disabled the ability to create new accounts~"));
|
|
|
|
}
|
|
|
|
|
2009-01-04 19:18:37 +00:00
|
|
|
public function display_login_block(Page $page) {
|
2007-07-16 19:47:25 +00:00
|
|
|
global $config;
|
|
|
|
$html = "
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("user_admin/login"))."
|
2009-08-03 18:58:12 +00:00
|
|
|
<table summary='Login Form'>
|
|
|
|
<tr>
|
|
|
|
<td width='70'><label for='user'>Name</label></td>
|
|
|
|
<td width='70'><input id='user' type='text' name='user'></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><label for='pass'>Password</label></td>
|
|
|
|
<td><input id='pass' type='password' name='pass'></td>
|
|
|
|
</tr>
|
|
|
|
<tr><td colspan='2'><input type='submit' value='Log In'></td></tr>
|
|
|
|
</table>
|
2007-07-16 19:47:25 +00:00
|
|
|
</form>
|
|
|
|
";
|
|
|
|
if($config->get_bool("login_signup_enabled")) {
|
2007-07-27 13:05:48 +00:00
|
|
|
$html .= "<small><a href='".make_link("user_admin/create")."'>Create Account</a></small>";
|
2007-07-16 19:47:25 +00:00
|
|
|
}
|
|
|
|
$page->add_block(new Block("Login", $html, "left", 90));
|
|
|
|
}
|
2009-01-04 19:18:37 +00:00
|
|
|
|
|
|
|
public function display_ip_list(Page $page, $uploads, $comments) {
|
2007-07-19 14:32:25 +00:00
|
|
|
$html = "<table id='ip-history'>";
|
|
|
|
$html .= "<tr><td>Uploaded from: ";
|
2007-12-08 03:23:53 +00:00
|
|
|
$n = 0;
|
2007-07-19 14:32:25 +00:00
|
|
|
foreach($uploads as $ip => $count) {
|
|
|
|
$html .= "<br>$ip ($count)";
|
2007-12-08 03:23:53 +00:00
|
|
|
if(++$n >= 20) {
|
|
|
|
$html .= "<br>...";
|
|
|
|
break;
|
|
|
|
}
|
2007-07-19 14:32:25 +00:00
|
|
|
}
|
2007-12-08 03:23:53 +00:00
|
|
|
|
2007-07-19 14:32:25 +00:00
|
|
|
$html .= "</td><td>Commented from:";
|
2007-12-08 03:23:53 +00:00
|
|
|
$n = 0;
|
2007-07-19 14:32:25 +00:00
|
|
|
foreach($comments as $ip => $count) {
|
|
|
|
$html .= "<br>$ip ($count)";
|
2007-12-08 03:23:53 +00:00
|
|
|
if(++$n >= 20) {
|
|
|
|
$html .= "<br>...";
|
|
|
|
break;
|
|
|
|
}
|
2007-07-19 14:32:25 +00:00
|
|
|
}
|
2007-12-08 03:23:53 +00:00
|
|
|
|
2007-07-19 14:32:25 +00:00
|
|
|
$html .= "</td></tr>";
|
|
|
|
$html .= "<tr><td colspan='2'>(Most recent at top)</td></tr></table>";
|
|
|
|
|
|
|
|
$page->add_block(new Block("IPs", $html));
|
|
|
|
}
|
|
|
|
|
2009-08-18 21:30:52 +00:00
|
|
|
public function display_user_page(User $duser, $stats) {
|
|
|
|
global $page, $user;
|
|
|
|
assert(is_array($stats));
|
2010-03-05 03:46:29 +00:00
|
|
|
$stats[] = "User ID: {$duser->id}";
|
2009-08-18 21:30:52 +00:00
|
|
|
|
2007-07-26 11:49:52 +00:00
|
|
|
$page->set_title("{$duser->name}'s Page");
|
|
|
|
$page->set_heading("{$duser->name}'s Page");
|
|
|
|
$page->add_block(new NavBlock());
|
2009-08-18 21:30:52 +00:00
|
|
|
$page->add_block(new Block("Stats", join("<br>", $stats), "main", 0));
|
2007-07-19 14:32:25 +00:00
|
|
|
|
2007-07-26 11:49:52 +00:00
|
|
|
if(!$user->is_anonymous()) {
|
|
|
|
if($user->id == $duser->id || $user->is_admin()) {
|
2007-08-01 17:11:46 +00:00
|
|
|
$page->add_block(new Block("Options", $this->build_options($duser), "main", 20));
|
2007-07-26 11:49:52 +00:00
|
|
|
}
|
2007-07-19 14:32:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-04 19:41:03 +00:00
|
|
|
protected function build_options(User $duser) {
|
2009-08-11 16:07:03 +00:00
|
|
|
global $config, $database, $user;
|
2007-07-19 14:32:25 +00:00
|
|
|
|
2010-09-22 11:56:19 +00:00
|
|
|
$html = "
|
|
|
|
".make_form(make_link("user_admin/change_pass"))."
|
2007-07-19 14:32:25 +00:00
|
|
|
<input type='hidden' name='id' value='{$duser->id}'>
|
2009-01-22 13:42:44 +00:00
|
|
|
<table style='width: 300px;'>
|
|
|
|
<tr><th colspan='2'>Change Password</th></tr>
|
2007-07-19 14:32:25 +00:00
|
|
|
<tr><td>Password</td><td><input type='password' name='pass1'></td></tr>
|
|
|
|
<tr><td>Repeat Password</td><td><input type='password' name='pass2'></td></tr>
|
|
|
|
<tr><td colspan='2'><input type='Submit' value='Change Password'></td></tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
|
2010-09-22 11:56:19 +00:00
|
|
|
<p>".make_form(make_link("user_admin/change_email"))."
|
2009-08-11 16:07:03 +00:00
|
|
|
<input type='hidden' name='id' value='{$duser->id}'>
|
|
|
|
<table style='width: 300px;'>
|
|
|
|
<tr><th colspan='2'>Change Email</th></tr>
|
|
|
|
<tr><td>Address</td><td><input type='text' name='address' value='".html_escape($duser->email)."'></td></tr>
|
|
|
|
<tr><td colspan='2'><input type='Submit' value='Set'></td></tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
";
|
2007-07-19 14:32:25 +00:00
|
|
|
|
2009-08-11 16:07:03 +00:00
|
|
|
if($user->is_admin()) {
|
|
|
|
$i_user_id = int_escape($duser->id);
|
|
|
|
$h_is_admin = $duser->is_admin() ? " checked" : "";
|
|
|
|
$html .= "
|
2010-09-22 11:56:19 +00:00
|
|
|
<p>".make_form(make_link("user_admin/set_more"))."
|
|
|
|
<input type='hidden' name='id' value='$i_user_id'>
|
|
|
|
Admin: <input name='admin' type='checkbox'$h_is_admin>
|
|
|
|
<input type='submit' value='Set'>
|
2009-08-11 16:07:03 +00:00
|
|
|
</form>
|
2012-01-22 17:55:52 +00:00
|
|
|
|
|
|
|
".make_form(make_link("user_admin/delete_user"))."
|
2012-01-19 17:23:43 +00:00
|
|
|
<input type='hidden' name='id' value='$i_user_id'>
|
|
|
|
<input type='submit' value='Delete User' onclick='confirm(\"Delete the user?\");' />
|
2012-01-22 17:55:52 +00:00
|
|
|
</form>
|
|
|
|
|
|
|
|
".make_form(make_link("user_admin/delete_user_with_images"))."
|
|
|
|
<input type='hidden' name='id' value='$i_user_id'>
|
|
|
|
<input type='submit' value='Delete User with images' onclick='confirm(\"Delete the user with his uploaded images?\");' />
|
2012-01-19 17:23:43 +00:00
|
|
|
</form>";
|
2009-08-11 16:07:03 +00:00
|
|
|
}
|
2007-07-19 14:32:25 +00:00
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
// }}}
|
2007-07-16 19:47:25 +00:00
|
|
|
}
|
|
|
|
?>
|