This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/themes/danbooru/user.theme.php

145 lines
4.5 KiB
PHP
Raw Normal View History

<?php
class CustomUserPageTheme extends UserPageTheme {
public function display_login_page($page) {
2010-01-03 09:36:53 +00:00
global $config;
$page->set_title("Login");
$page->set_heading("Login");
2010-01-03 09:36:53 +00:00
$page->disable_left();
$html = "
<form action='".make_link("user_admin/login")."' method='POST'>
<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>
</form>
";
if($config->get_bool("login_signup_enabled")) {
$html .= "<small><a href='".make_link("user_admin/create")."'>Create Account</a></small>";
}
$page->add_block(new Block("Login", $html, "main", 90));
}
public function display_user_links($page, $user, $parts) {
2010-01-03 09:36:53 +00:00
// no block in this theme
}
public function display_login_block(Page $page) {
// no block in this theme
}
public function display_user_block($page, $user, $parts) {
2009-07-28 22:07:21 +00:00
$h_name = html_escape($user->name);
2009-08-03 09:46:40 +00:00
$html = "";
$blocked = array("Pools", "Pool Changes", "Alias Editor", "My Profile");
2009-08-03 09:46:40 +00:00
foreach($parts as $part) {
if(in_array($part["name"], $blocked)) continue;
2009-08-03 09:46:40 +00:00
$html .= "<li><a href='{$part["link"]}'>{$part["name"]}</a>";
}
2009-07-28 22:07:21 +00:00
$page->add_block(new Block("User Links", $html, "user", 90));
}
public function display_signup_page($page) {
global $config;
$tac = $config->get_string("login_tac", "");
$tfe = new TextFormattingEvent($tac);
send_event($tfe);
$tac = $tfe->formatted;
2010-01-28 05:57:44 +00:00
$reca = "<tr><td colspan='2'>".captcha_get_html()."</td></tr>";
if(empty($tac)) {$html = "";}
else {$html = "<p>$tac</p>";}
$html .= "
<form action='".make_link("user_admin/create")."' method='POST'>
<table style='width: 300px;'>
<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>
2010-01-28 05:57:44 +00:00
$reca;
<tr><td colspan='2'><input type='Submit' value='Create Account'></td></tr>
</table>
</form>
";
$page->set_title("Create Account");
$page->set_heading("Create Account");
2010-01-03 09:36:53 +00:00
$page->disable_left();
$page->add_block(new Block("Signup", $html));
}
public function display_ip_list($page, $uploads, $comments) {
$html = "<table id='ip-history' style='width: 400px;'>";
$html .= "<tr><td>Uploaded from: ";
foreach($uploads as $ip => $count) {
$html .= "<br>$ip ($count)";
}
$html .= "</td><td>Commented from:";
foreach($comments as $ip => $count) {
$html .= "<br>$ip ($count)";
}
$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:33:24 +00:00
public function display_user_page(User $duser, $stats) {
global $page;
$page->disable_left();
2009-08-18 21:33:24 +00:00
parent::display_user_page($duser, $stats);
}
protected function build_options($duser) {
global $database;
global $config;
2011-03-05 00:43:34 +00:00
global $user;
$html = "";
$html .= "
<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;'>
<tr><td colspan='2'>Change Password</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 colspan='2'><input type='Submit' value='Change Password'></td></tr>
</table>
</form>
<p><form action='".make_link("user_admin/change_email")."' method='POST'>
<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></p>
";
if($user->is_admin()) {
$i_user_id = int_escape($duser->id);
$h_is_admin = $duser->is_admin() ? " checked" : "";
$html .= "
<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'>
</form>
";
}
return $html;
}
}
?>