confirmregistration.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php
  2. /**
  3. * StatusNet - the distributed open-source microblogging tool
  4. * Copyright (C) 2011, StatusNet, Inc.
  5. *
  6. * Registration confirmation form
  7. *
  8. * PHP version 5
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. * @category Email registration
  24. * @package StatusNet
  25. * @author Evan Prodromou <evan@status.net>
  26. * @copyright 2011 StatusNet, Inc.
  27. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  28. * @link http://status.net/
  29. */
  30. if (!defined('STATUSNET')) {
  31. // This check helps protect against security problems;
  32. // your code file can't be executed directly from the web.
  33. exit(1);
  34. }
  35. /**
  36. * Registration confirmation form
  37. *
  38. * @category Email registration
  39. * @package StatusNet
  40. * @author Evan Prodromou <evan@status.net>
  41. * @copyright 2011 StatusNet, Inc.
  42. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  43. * @link http://status.net/
  44. */
  45. class ConfirmRegistrationForm extends Form
  46. {
  47. protected $code;
  48. protected $nickname;
  49. protected $email;
  50. function __construct($out, $nickname, $email, $code)
  51. {
  52. parent::__construct($out);
  53. $this->nickname = $nickname;
  54. $this->email = $email;
  55. $this->code = $code;
  56. }
  57. function formData()
  58. {
  59. $this->out->element('p', 'instructions',
  60. // TRANS: Form instructions.
  61. sprintf(_m('Enter a password to confirm your new account.')));
  62. $this->hidden('code', $this->code);
  63. $this->out->elementStart('ul', 'form_data');
  64. $this->elementStart('li');
  65. // TRANS: Field label in e-mail registration form.
  66. $this->element('label', array('for' => 'nickname-ignore'), _m('LABEL','User name'));
  67. $this->element('input', array('name' => 'nickname-ignore',
  68. 'type' => 'text',
  69. 'id' => 'nickname-ignore',
  70. 'disabled' => 'true',
  71. 'value' => $this->nickname));
  72. $this->elementEnd('li');
  73. $this->elementStart('li');
  74. // TRANS: Field label.
  75. $this->element('label', array('for' => 'email-ignore'), _m('Email address'));
  76. $this->element('input', array('name' => 'email-ignore',
  77. 'type' => 'text',
  78. 'id' => 'email-ignore',
  79. 'disabled' => 'true',
  80. 'value' => $this->email));
  81. $this->elementEnd('li');
  82. $this->elementStart('li');
  83. // TRANS: Field label on account registration page.
  84. $this->password('password1', _m('Password'),
  85. // TRANS: Field title on account registration page.
  86. _m('6 or more characters.'));
  87. $this->elementEnd('li');
  88. $this->elementStart('li');
  89. // TRANS: Field label on account registration page. In this field the password has to be entered a second time.
  90. $this->password('password2', _m('PASSWORD','Confirm'),
  91. // TRANS: Field title on account registration page.
  92. _m('Same as password above.'));
  93. $this->elementEnd('li');
  94. $this->elementStart('li');
  95. $this->element('input', array('name' => 'tos',
  96. 'type' => 'checkbox',
  97. 'class' => 'checkbox',
  98. 'id' => 'tos',
  99. 'value' => 'true'));
  100. $this->text(' ');
  101. $this->elementStart('label', array('class' => 'checkbox',
  102. 'for' => 'tos'));
  103. // TRANS: Checkbox title for terms of service and privacy policy.
  104. $this->raw(sprintf(_m('I agree to the <a href="%1$s">Terms of service</a> and '.
  105. '<a href="%1$s">Privacy policy</a> of this site.'),
  106. common_local_url('doc', array('title' => 'tos')),
  107. common_local_url('doc', array('title' => 'privacy'))));
  108. $this->elementEnd('label');
  109. $this->elementEnd('li');
  110. $this->out->elementEnd('ul');
  111. }
  112. function method()
  113. {
  114. return 'post';
  115. }
  116. /**
  117. * Buttons for form actions
  118. *
  119. * Submit and cancel buttons (or whatever)
  120. * Sub-classes should overload this to show their own buttons.
  121. *
  122. * @return void
  123. */
  124. function formActions()
  125. {
  126. // TRANS: Button text for action to register.
  127. $this->out->submit('submit', _m('BUTTON', 'Register'));
  128. }
  129. /**
  130. * ID of the form
  131. *
  132. * Should be unique on the page. Sub-classes should overload this
  133. * to show their own IDs.
  134. *
  135. * @return int ID of the form
  136. */
  137. function id()
  138. {
  139. return 'form_email_registration';
  140. }
  141. /**
  142. * Action of the form.
  143. *
  144. * URL to post to. Should be overloaded by subclasses to give
  145. * somewhere to post to.
  146. *
  147. * @return string URL to post to
  148. */
  149. function action()
  150. {
  151. return common_local_url('register');
  152. }
  153. function formClass()
  154. {
  155. return 'form_confirm_registration form_settings';
  156. }
  157. }