From 2c2381d9652e929ad4174bc9dac66486f5fd373e Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 12 Jan 2020 15:26:29 +0000 Subject: [PATCH] microhtml for user page --- ext/user/theme.php | 114 ++++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 49 deletions(-) diff --git a/ext/user/theme.php b/ext/user/theme.php index e1a6b97e..437040cf 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -1,4 +1,5 @@ name); - $html = 'Logged in as '.$h_name; + $html = emptyHTML('Logged in as ', $user->name); foreach ($parts as $part) { - $html .= '
'.$part["name"].''; + $html->appendChild(BR()); + $html->appendChild(A(["href"=>$part["link"]], $part["name"])); } $page->add_block(new Block("User Links", $html, "left", 90)); } @@ -47,30 +48,41 @@ class UserPageTheme extends Themelet $tac = $tfe->formatted; } - if (empty($tac)) { - $html = ""; - } else { - $html = '

'.$tac.'

'; - } + $form = SHM_FORM(make_link("user_admin/create")); + $form->appendChild( + TABLE( + ["class"=>"form"], + TBODY( + TR( + TH("Name"), + TD(INPUT(["type"=>'text', "name"=>'name', "required"=>true])) + ), + TR( + TH("Password"), + TD(INPUT(["type"=>'password', "name"=>'pass1', "required"=>true])) + ), + TR( + TH(rawHTML("Repeat Password")), + TD(INPUT(["type"=>'password', "name"=>'pass2', "required"=>true])) + ), + TR( + TH(rawHTML("Email (Optional)")), + TD(INPUT(["type"=>'email', "name"=>'email'])) + ), + TR( + TD(["colspan"=>"2"], rawHTML(captcha_get_html())) + ), + ), + TFOOT( + TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>"Create Account"]))) + ) + ) + ); - $h_reca = "".captcha_get_html().""; - - $html .= ' - '.make_form(make_link("user_admin/create"))." - - - - - - - $h_reca - - - - -
Name
Password
Repeat Password
Email (Optional)
- - "; + $html = emptyHTML( + $tac ? P($tac) : null, + $form + ); $page->set_title("Create Account"); $page->set_heading("Create Account"); @@ -92,28 +104,32 @@ class UserPageTheme extends Themelet public function display_login_block(Page $page) { global $config, $user; - $html = ' - '.make_form(make_link("user_admin/login"))." - - - - - - - - - - - - - - -
- - "; + $form = SHM_FORM(make_link("user_admin/login")); + $form->appendChild( + TABLE( + ["style"=>"width: 100%", "class"=>"form"], + TBODY( + TR( + TH(LABEL(["for"=>"user"], "Name")), + TD(INPUT(["id"=>"user", "type"=>"text", "name"=>"user", "autocomplete"=>"username"])) + ), + TR( + TH(LABEL(["for"=>"pass"], "Password")), + TD(INPUT(["id"=>"pass", "type"=>"password", "name"=>"pass", "autocomplete"=>"current-password"])) + ) + ), + TFOOT( + TR(TD(["colspan"=>"2"], INPUT(["type"=>"submit", "value"=>"Log In"]))) + ) + ) + ); + + $html = emptyHTML(); + $html->appendChild($form); if ($config->get_bool("login_signup_enabled") && $user->can(Permissions::CREATE_USER)) { - $html .= "Create Account"; + $html->appendChild(SMALL(A(["href"=>make_link("user_admin/create")], "Create Account"))); } + $page->add_block(new Block("Login", $html, "left", 90)); } @@ -271,11 +287,11 @@ class UserPageTheme extends Themelet
poster=username

Returns images posted by "username".

-
+
poster_id=123

Returns images posted by user 123.

-
+ '; @@ -284,7 +300,7 @@ class UserPageTheme extends Themelet
poster_ip=127.0.0.1

Returns images posted from IP 127.0.0.1.

-
+ "; } return $output;