PageRenderTime 26ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/4.8/components/com_registration/registration.html.php

http://miacms.googlecode.com/
PHP | 342 lines | 298 code | 30 blank | 14 comment | 37 complexity | 5f9ca7bb066935835594ab2de1653b3a MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, LGPL-2.0
  1. <?php
  2. /**
  3. * @package MiaCMS
  4. * @subpackage Users
  5. * @author MiaCMS see README.php
  6. * @copyright see README.php
  7. * See COPYRIGHT.php for copyright notices and details.
  8. * @license GNU/GPL Version 2, see LICENSE.php
  9. * MiaCMS is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; version 2 of the License.
  12. */
  13. /** ensure this file is being included by a parent file */
  14. defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  15. class HTML_registration {
  16. function lostPassForm($option) {
  17. ?>
  18. <div class="componentheading">
  19. <?php echo T_('Lost your Password?'); ?>
  20. </div>
  21. <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane" id="lostpassword_table">
  22. <tr>
  23. <td><?php printf(T_('Please enter your Username and e-mail address then click on the Send Password button.%s You will receive a new password shortly. Use the new password to access the site.'), '<br />'); ?></td>
  24. </tr>
  25. <tr>
  26. <td>
  27. <form action="index.php" method="post">
  28. <fieldset>
  29. <div class="formfield">
  30. <label for="checkusername"><?php echo T_('Username:'); ?></label>
  31. <input type="text" id="checkusername" name="checkusername" class="inputbox" size="25" maxlength="25" />
  32. </div>
  33. <div class="formfield">
  34. <label for="confirmEmail"><?php echo T_('E-mail Address:'); ?></label>
  35. <input type="text" id="confirmEmail" name="confirmEmail" class="inputbox" size="25" /><br/>
  36. </div>
  37. <div class="formfield">
  38. <label for="sendnewpassbutton">&nbsp;</label>
  39. <input type="submit" id="sendnewpassbutton" class="button" value="<?php echo T_('Send Password'); ?>" /><br/>
  40. </div>
  41. <input type="hidden" id="option" name="option" value="<?php echo $option;?>" />
  42. <input type="hidden" name="task" value="sendNewPass" />
  43. </fieldset>
  44. </form>
  45. </td>
  46. </tr>
  47. </table>
  48. <?php
  49. }
  50. function registerForm($option, $useractivation) {
  51. global $mosConfig_enable_openid, $mainframe;
  52. $name = trim( mosGetParam( $_REQUEST, 'name', "" ) );
  53. $username = trim( mosGetParam( $_REQUEST, 'username', "" ) );
  54. $email = trim( mosGetParam( $_REQUEST, 'email', "" ) );
  55. $useractivation = trim( mosGetParam( $_REQUEST, 'useractivation', "" ) );
  56. $identity = trim( mosGetParam( $_REQUEST, 'identity', "" ) );
  57. $type = 'text';
  58. if (($identity !== '') && ($mosConfig_enable_openid === '1')) {
  59. $type = "hidden";
  60. $temppasswd = mosMakePassword();
  61. }
  62. ?>
  63. <div class="componentheading">
  64. <?php echo T_('Registration'); ?>
  65. </div>
  66. <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane" id="registration_table">
  67. <tr>
  68. <td><?php echo T_('Fields marked with an asterisk (*) are required.'); ?></td>
  69. </tr>
  70. <tr>
  71. <td>
  72. <form action="index.php" method="post" id="mosForm" name="mosForm">
  73. <fieldset>
  74. <div class="formfield">
  75. <label for="name"><?php echo T_('Name:'); ?> *</label>
  76. <input type="text" id="name" name="name" size="40" value="<?php echo $name; ?>" class="inputbox" />
  77. </div>
  78. <div class="formfield">
  79. <label for="regusername"><?php echo T_('Username:'); ?> *</label>
  80. <input type="text" id="regusername" name="username" size="40" value="<?php echo $username; ?>" class="inputbox" />
  81. </div>
  82. <div class="formfield">
  83. <label for="email"><?php echo T_('E-mail:'); ?> *</label>
  84. <input type="text" id="email" name="email" size="40" value="<?php echo $email; ?>" class="inputbox" />
  85. </div>
  86. <div class="formfield">
  87. <label for="email2"><?php echo T_('Verify E-mail:'); ?> *</label>
  88. <input type="text" name="email2" class="inputbox" id="email2" value="<?php echo $email; ?>" size="40" />
  89. </div>
  90. <?php
  91. if (($identity === '') || ($mosConfig_enable_openid !== '1')) {
  92. ?>
  93. <div class="formfield">
  94. <label for="password"><?php echo T_('Password:'); ?> *</label>
  95. <input class="inputbox" type="password" id="password" name="password" size="40" value="" />
  96. </div>
  97. <div class="formfield">
  98. <label for="password2"><?php echo T_('Verify Password:'); ?> *</label>
  99. <input class="inputbox" type="password" id="password2" name="password2" size="40" value="" />
  100. </div>
  101. <?php
  102. } else if (($mosConfig_enable_openid === '1') && ($identity !== '')){
  103. ?>
  104. <input class="inputbox" type="hidden" id="password" name="password" size="40" value="<?php echo $temppasswd; ?>" />
  105. <input class="inputbox" type="hidden" id="password2" name="password2" size="40" value="<?php echo $temppasswd; ?>" />
  106. <?php
  107. }
  108. ?>
  109. <div class="formfield">
  110. <label for="privacypolicy"><?php echo T_('Disclaimer and<br />Privacy Policy:'); ?> *</label>
  111. <textarea id="privacypolicy" name="privacypolicy" cols="48" rows="4" class="inputbox" style="font-size:0.85em;" readonly="readonly"><?php echo T_('put your disclaimer here..'); ?></textarea>
  112. </div>
  113. <div class="formfield">
  114. <label for="accept">&nbsp;</label>
  115. <input id="accept" name="accept" type="checkbox" value="yes" />
  116. <label for="accept"><?php echo T_('Yes, I Accept'); ?></label>
  117. </div>
  118. <div class="formfield">
  119. <label for="send_registration">&nbsp;</label>
  120. <input type="button" id="send_registration" value="<?php echo T_('Send Registration'); ?>" class="button" />
  121. </div>
  122. <?php
  123. if ($mosConfig_enable_openid === '1') {
  124. ?>
  125. <input type="hidden" name="identity" value="<?php echo $identity;?>" />
  126. <?php
  127. } //end of openid if
  128. ?>
  129. <input type="hidden" name="id" value="0" />
  130. <input type="hidden" name="gid" value="0" />
  131. <input type="hidden" name="useractivation" value="<?php echo $useractivation;?>" />
  132. <input type="hidden" name="option" value="<?php echo $option; ?>" />
  133. <input type="hidden" name="task" value="confirmRegistration" />
  134. </fieldset>
  135. </form>
  136. </td>
  137. </tr>
  138. <?php
  139. if (($mosConfig_enable_openid === '1') && ($identity)) {
  140. ?>
  141. <tr>
  142. <td>
  143. <?php
  144. if ($email === '') {
  145. echo '<br/>';
  146. echo T_('For communication purposes, this site requires you to enter your email address.');
  147. }
  148. ?>
  149. </td>
  150. </tr>
  151. <?php
  152. } //end of openid if
  153. ?>
  154. </table>
  155. <?php
  156. //Define heredoc vars
  157. $nameMsg = html_entity_decode(T_('Please enter your name'));
  158. $validUsernameMsg = html_entity_decode(T_("Please enter a valid user name. No spaces, more than 2 characters and containing only the characters 0-9,a-z, or A-Z"));
  159. $validEmailMsg = html_entity_decode(T_('Please enter a valid e-mail address.'));
  160. $validEmailMsg2 = html_entity_decode(T_('Please enter a valid e-mail address for the verification.'));
  161. $validPasswordMsg = html_entity_decode(T_('Please enter a valid password -- more than 6 characters with no spaces and containing only the characters 0-9, a-z, or A-Z'));
  162. $verifyPasswordMsg = html_entity_decode(T_('Please verify the verification password.'));
  163. $passwordMatchMsg = html_entity_decode(T_('Password and verification do not match, please try again.'));
  164. $emailMatchMsg = html_entity_decode(T_('Email and verification do not match, please try again.'));
  165. $acceptMsg = html_entity_decode(T_('You must accept the Privacy Policy and Disclaimer, to continue.'));
  166. $tag = <<<JSTAG
  167. <script type="text/javascript">
  168. YAHOO.util.Event.on(window, "load", function() {
  169. YAHOO.miacms.base.submitbutton = function() {
  170. var form = YAHOO.util.Dom.get("mosForm");
  171. var name = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("name").value);
  172. var regusername = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("regusername").value);
  173. var email = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("email").value);
  174. var email2 = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("email2").value);
  175. var password = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("password").value);
  176. var password2 = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("password2").value);
  177. var name = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("name").value);
  178. var r = new RegExp("[^A-Za-z0-9]", "i");
  179. // do field validation
  180. if (name === "") {
  181. alert( "$nameMsg" );
  182. YAHOO.util.Dom.get("name").focus();
  183. } else if (regusername === "") {
  184. alert( "$validUsernameMsg" );
  185. YAHOO.util.Dom.get("regusername").focus();
  186. } else if (r.exec(regusername) || regusername.length < 3) {
  187. alert( "$validUsernameMsg" );
  188. YAHOO.util.Dom.get("regusername").focus();
  189. } else if (email === "" ) {
  190. alert( "$validEmailMsg" );
  191. YAHOO.util.Dom.get("email").focus();
  192. } else if (email2 === "" ) {
  193. alert( "$validEmailMsg2" );
  194. YAHOO.util.Dom.get("email2").focus();
  195. } else if (password.length < 6) {
  196. alert( "$validPasswordMsg" );
  197. YAHOO.util.Dom.get("password").focus();
  198. } else if (password2 === "") {
  199. alert( "$verifyPasswordMsg" );
  200. YAHOO.util.Dom.get("password2").focus();
  201. } else if ((password !== "") && (password !== password2)){
  202. alert( "$passwordMatchMsg" );
  203. password="";
  204. password2="";
  205. YAHOO.util.Dom.get("password").focus();
  206. } else if (r.exec(password)) {
  207. alert( "$validPasswordMsg" );
  208. YAHOO.util.Dom.get("password").focus();
  209. } else if ((password !== "") && (email !== email2)){
  210. alert( "$emailMatchMsg" );
  211. email="";
  212. email2="";
  213. YAHOO.util.Dom.get("email").focus();
  214. } else if ( form.accept.checked === false) {
  215. alert( "$acceptMsg" );
  216. YAHOO.util.Dom.get("accept").focus();
  217. } else {
  218. form.submit();
  219. }
  220. };
  221. });
  222. YAHOO.util.Event.addListener("send_registration", "click", function() {
  223. YAHOO.miacms.base.submitbutton();
  224. });
  225. </script>
  226. JSTAG;
  227. $mainframe->addCustomFootTag($tag);
  228. }
  229. function confirmForm($option, $name, $username, $password, $email, $useractivation) {
  230. global $mosConfig_enable_openid, $mainframe;
  231. ?>
  232. <div class="componentheading">
  233. <?php echo T_('Registration'); ?></div>
  234. <form action="index.php" method="post" id="mosForm" name="mosForm">
  235. <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
  236. <tr>
  237. <td colspan="2"><?php echo T_('Please verify that the following data is correct and click the button below to complete registration.'); ?> </td>
  238. </tr>
  239. <tr>
  240. <td colspan="2">&nbsp;</td>
  241. </tr>
  242. <tr>
  243. <td width="15%"><?php echo T_('Name:'); ?> </td>
  244. <td><strong><?php echo $name;?></strong><input type="hidden" name="name" size="40" value="<?php echo $name;?>" /></td>
  245. </tr>
  246. <tr>
  247. <td><?php echo T_('Username:'); ?> </td>
  248. <td><strong><?php echo $username;?></strong><input type="hidden" name="username" size="40" value="<?php echo $username;?>" /></td>
  249. <tr>
  250. <td><?php echo T_('E-mail:'); ?> </td>
  251. <td><strong><?php echo $email;?></strong><input type="hidden" name="email" size="40" value="<?php echo $email;?>" /></td>
  252. </tr>
  253. <tr>
  254. <td colspan="2">&nbsp;</td>
  255. </tr>
  256. <tr align="center">
  257. <td colspan="2"><table width="80%" border="0" cellspacing="0" cellpadding="0">
  258. <tr align="center" valign="top">
  259. <td width="45%" align="center" valign="top" style="background-color:#FFE9E6;"><?php echo T_('Go back and correct your data.'); ?></td>
  260. <td width="10%" valign="top">&nbsp;</td>
  261. <td width="45%" align="center" style="background-color:#E8FFE8"><?php echo T_('The data is correct.'); ?></td>
  262. </tr>
  263. <tr align="center" valign="middle">
  264. <td height="32" align="center" valign="middle" style="background-color:#FFE9E6;">
  265. <input id="back" name="back" type="button" class="button" value="<?php echo T_('Correct Your Data'); ?>">
  266. </td>
  267. <td>&nbsp;</td>
  268. <td align="center" valign="middle" style="background-color:#E8FFE8">
  269. <input name="confirm" type="submit" class="button" id="confirm" value="<?php echo T_('Confirm Registration'); ?>"/>
  270. </td>
  271. </tr>
  272. </table></td>
  273. </tr>
  274. <tr>
  275. <td colspan="2">&nbsp;</td>
  276. </tr>
  277. </table>
  278. <?php
  279. if ($mosConfig_enable_openid === '1') {
  280. $identity = trim( mosGetParam( $_REQUEST, 'identity', "" ) );
  281. ?>
  282. <input type="hidden" name="identity" value="<?php echo $identity;?>" />
  283. <?php
  284. }
  285. ?>
  286. <input type="hidden" name="id" value="0" />
  287. <input type="hidden" name="gid" value="0" />
  288. <input type="hidden" name="useractivation" value="<?php echo $useractivation;?>" />
  289. <input type="hidden" name="password" value="<?php echo $password;?>" />
  290. <input type="hidden" name="option" value="<?php echo $option; ?>" />
  291. <input type="hidden" name="task" value="saveRegistration" />
  292. </form>
  293. <?php
  294. $tag = <<<JSTAG
  295. <script type="text/javascript">
  296. YAHOO.util.Event.on(window, "load", function() {
  297. YAHOO.namespace("component.registration");
  298. YAHOO.component.registration.reviseData = function() {
  299. var form = YAHOO.util.Dom.get("mosForm");
  300. form.task.value='reviseRegistration';
  301. form.submit();
  302. };
  303. YAHOO.util.Event.addListener("back", "click", function() {
  304. YAHOO.component.registration.reviseData();
  305. });
  306. });
  307. </script>
  308. JSTAG;
  309. $mainframe->addCustomFootTag($tag);
  310. }
  311. }
  312. ?>