UserRegister.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace dokuwiki\Ui;
  3. use dokuwiki\Form\Form;
  4. /**
  5. * DokuWiki User Registration Interface (Register Form)
  6. *
  7. * @package dokuwiki\Ui
  8. */
  9. class UserRegister extends Ui
  10. {
  11. /**
  12. * Display the User Registration Form Panel
  13. *
  14. * @author Andreas Gohr <andi@splitbrain.org>
  15. *
  16. * @return void
  17. */
  18. public function show()
  19. {
  20. global $lang;
  21. global $conf;
  22. global $INPUT;
  23. $base_attrs = array('size' => '50', 'required' => 'required');
  24. $email_attrs = $base_attrs + array('type' => 'email');
  25. // print intro
  26. print p_locale_xhtml('register');
  27. print '<div class="centeralign">';
  28. // create the login form
  29. $form = new Form(['id' => 'dw__register']);
  30. $form->addTagOpen('div')->addClass('no');
  31. $form->addFieldsetOpen($lang['btn_register']);
  32. $form->setHiddenField('do', 'register');
  33. $form->setHiddenField('save', '1');
  34. $input = $form->addTextInput('login', $lang['user'])->attrs($base_attrs)->addClass('edit')
  35. ->val($INPUT->post->str('login'));
  36. $input->getLabel()->attr('class', 'block');
  37. $form->addHTML("<br>\n");
  38. if (!$conf['autopasswd']) {
  39. $input = $form->addPasswordInput('pass', $lang['pass'])->attrs($base_attrs)->addClass('edit');
  40. $input->getLabel()->attr('class', 'block');
  41. $form->addHTML("<br>\n");
  42. $input = $form->addPasswordInput('passchk', $lang['passchk'])->attrs($base_attrs)->addClass('edit');
  43. $input->getLabel()->attr('class', 'block');
  44. $form->addHTML("<br>\n");
  45. }
  46. $input = $form->addTextInput('fullname', $lang['fullname'])->attrs($base_attrs)->addClass('edit')
  47. ->val($INPUT->post->str('fullname'));
  48. $input->getLabel()->attr('class', 'block');
  49. $form->addHTML("<br>\n");
  50. $input = $form->addTextInput('email', $lang['email'])->attrs($email_attrs)->addClass('edit')
  51. ->val($INPUT->post->str('email'));
  52. $input->getLabel()->attr('class', 'block');
  53. $form->addHTML("<br>\n");
  54. $form->addButton('', $lang['btn_register'])->attr('type', 'submit');
  55. $form->addFieldsetClose();
  56. $form->addTagClose('div');
  57. print $form->toHTML('Register');
  58. print '</div>';
  59. }
  60. }