remove EOL whitespace

This commit is contained in:
Shish 2009-01-04 11:18:37 -08:00
parent 966180aef5
commit 11873e9601
78 changed files with 360 additions and 358 deletions

View file

@ -58,57 +58,59 @@ class UserPage implements Extension {
if($event->get_arg(0) == "login") {
if(isset($_POST['user']) && isset($_POST['pass'])) {
$this->login($event->page);
$this->login($page);
}
else {
$this->theme->display_login_page($event->page);
$this->theme->display_login_page($page);
}
}
else if($event->get_arg(0) == "logout") {
setcookie("shm_session", "", time()+60*60*24*$config->get_int('login_memory'), "/");
$event->page->set_mode("redirect");
$event->page->set_redirect(make_link());
$page->set_mode("redirect");
$page->set_redirect(make_link());
}
else if($event->get_arg(0) == "change_pass") {
$this->change_password_wrapper($event->page);
$this->change_password_wrapper($page);
}
else if($event->get_arg(0) == "create") {
if(!$config->get_bool("login_signup_enabled")) {
$this->theme->display_signups_disabled($page);
}
else if(!isset($_POST['name'])) {
$this->theme->display_signup_page($event->page);
$this->theme->display_signup_page($page);
}
else if($_POST['pass1'] != $_POST['pass2']) {
$this->theme->display_error($event->page, "Password Mismatch", "Passwords don't match");
$this->theme->display_error($page, "Password Mismatch", "Passwords don't match");
}
else {
try {
$uce = new UserCreationEvent($event->context, $_POST['name'], $_POST['pass1'], $_POST['email']);
send_event($uce);
$this->set_login_cookie($uce->username, $uce->password);
$event->page->set_mode("redirect");
$event->page->set_redirect(make_link("user"));
$page->set_mode("redirect");
$page->set_redirect(make_link("user"));
}
catch(UserCreationException $ex) {
$this->theme->display_error($event->page, "User Creation Error", $ex->getMessage());
$this->theme->display_error($page, "User Creation Error", $ex->getMessage());
}
}
}
else if($event->get_arg(0) == "set_more") {
$this->set_more_wrapper($event->page);
$this->set_more_wrapper($page);
}
}
if(($event instanceof PageRequestEvent) && $event->page_matches("user")) {
global $user;
global $config;
global $database;
$duser = ($event->count_args() == 0) ? $user : User::by_name($config, $database, $event->get_arg(0));
if(!is_null($duser)) {
send_event(new UserPageBuildingEvent($event->context, $duser));
$user = $event->context->user;
$config = $event->context->config;
$database = $event->context->database;
$page = $event->context->page;
$display_user = ($event->count_args() == 0) ? $user : User::by_name($config, $database, $event->get_arg(0));
if(!is_null($display_user)) {
send_event(new UserPageBuildingEvent($event->context, $display_user));
}
else {
$this->theme->display_error($event->page, "No Such User",
$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

@ -1,7 +1,7 @@
<?php
class UserPageTheme extends Themelet {
public function display_login_page($page) {
public function display_login_page(Page $page) {
$page->set_title("Login");
$page->set_heading("Login");
$page->add_block(new NavBlock());
@ -9,18 +9,18 @@ class UserPageTheme extends Themelet {
"There should be a login box to the left"));
}
public function display_user_links($page, $user, $parts) {
public function display_user_links(Page $page, User $user, $parts) {
# $page->add_block(new Block("User Links", join(", ", $parts), "main", 10));
}
public function display_user_block($page, $user, $parts) {
public function display_user_block(Page $page, User $user, $parts) {
$h_name = html_escape($user->name);
$html = "Logged in as $h_name<br>";
$html .= join("\n<br/>", $parts);
$page->add_block(new Block("User Links", $html, "left", 90));
}
public function display_signup_page($page) {
public function display_signup_page(Page $page) {
global $config;
$tac = $config->get_string("login_tac", "");
@ -49,7 +49,7 @@ class UserPageTheme extends Themelet {
$page->add_block(new Block("Signup", $html));
}
public function display_signups_disabled($page) {
public function display_signups_disabled(Page $page) {
$page->set_title("Signups Disabled");
$page->set_heading("Signups Disabled");
$page->add_block(new NavBlock());
@ -57,7 +57,7 @@ class UserPageTheme extends Themelet {
"The board admin has disabled the ability to create new accounts~"));
}
public function display_login_block($page) {
public function display_login_block(Page $page) {
global $config;
$html = "
<form action='".make_link("user_admin/login")."' method='POST'>
@ -74,7 +74,7 @@ class UserPageTheme extends Themelet {
$page->add_block(new Block("Login", $html, "left", 90));
}
public function display_ip_list($page, $uploads, $comments) {
public function display_ip_list(Page $page, $uploads, $comments) {
$html = "<table id='ip-history'>";
$html .= "<tr><td>Uploaded from: ";
$n = 0;
@ -102,7 +102,7 @@ class UserPageTheme extends Themelet {
$page->add_block(new Block("IPs", $html));
}
public function display_user_page($page, $duser, $user) {
public function display_user_page(Page $page, User $duser, User $user) {
$page->set_title("{$duser->name}'s Page");
$page->set_heading("{$duser->name}'s Page");
$page->add_block(new NavBlock());