/4.8/components/com_registration/registration.html.php
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
- <?php
- /**
- * @package MiaCMS
- * @subpackage Users
- * @author MiaCMS see README.php
- * @copyright see README.php
- * See COPYRIGHT.php for copyright notices and details.
- * @license GNU/GPL Version 2, see LICENSE.php
- * MiaCMS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2 of the License.
- */
-
- /** ensure this file is being included by a parent file */
- defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
-
- class HTML_registration {
- function lostPassForm($option) {
- ?>
-
- <div class="componentheading">
- <?php echo T_('Lost your Password?'); ?>
- </div>
-
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane" id="lostpassword_table">
- <tr>
- <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>
- </tr>
- <tr>
- <td>
- <form action="index.php" method="post">
- <fieldset>
- <div class="formfield">
- <label for="checkusername"><?php echo T_('Username:'); ?></label>
- <input type="text" id="checkusername" name="checkusername" class="inputbox" size="25" maxlength="25" />
- </div>
-
- <div class="formfield">
- <label for="confirmEmail"><?php echo T_('E-mail Address:'); ?></label>
- <input type="text" id="confirmEmail" name="confirmEmail" class="inputbox" size="25" /><br/>
- </div>
-
- <div class="formfield">
- <label for="sendnewpassbutton"> </label>
- <input type="submit" id="sendnewpassbutton" class="button" value="<?php echo T_('Send Password'); ?>" /><br/>
- </div>
-
- <input type="hidden" id="option" name="option" value="<?php echo $option;?>" />
- <input type="hidden" name="task" value="sendNewPass" />
- </fieldset>
- </form>
- </td>
- </tr>
- </table>
-
- <?php
- }
-
- function registerForm($option, $useractivation) {
- global $mosConfig_enable_openid, $mainframe;
-
- $name = trim( mosGetParam( $_REQUEST, 'name', "" ) );
- $username = trim( mosGetParam( $_REQUEST, 'username', "" ) );
- $email = trim( mosGetParam( $_REQUEST, 'email', "" ) );
- $useractivation = trim( mosGetParam( $_REQUEST, 'useractivation', "" ) );
-
- $identity = trim( mosGetParam( $_REQUEST, 'identity', "" ) );
- $type = 'text';
- if (($identity !== '') && ($mosConfig_enable_openid === '1')) {
- $type = "hidden";
- $temppasswd = mosMakePassword();
- }
- ?>
- <div class="componentheading">
- <?php echo T_('Registration'); ?>
- </div>
-
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane" id="registration_table">
- <tr>
- <td><?php echo T_('Fields marked with an asterisk (*) are required.'); ?></td>
- </tr>
- <tr>
- <td>
- <form action="index.php" method="post" id="mosForm" name="mosForm">
- <fieldset>
- <div class="formfield">
- <label for="name"><?php echo T_('Name:'); ?> *</label>
- <input type="text" id="name" name="name" size="40" value="<?php echo $name; ?>" class="inputbox" />
- </div>
-
- <div class="formfield">
- <label for="regusername"><?php echo T_('Username:'); ?> *</label>
- <input type="text" id="regusername" name="username" size="40" value="<?php echo $username; ?>" class="inputbox" />
- </div>
-
- <div class="formfield">
- <label for="email"><?php echo T_('E-mail:'); ?> *</label>
- <input type="text" id="email" name="email" size="40" value="<?php echo $email; ?>" class="inputbox" />
- </div>
-
- <div class="formfield">
- <label for="email2"><?php echo T_('Verify E-mail:'); ?> *</label>
- <input type="text" name="email2" class="inputbox" id="email2" value="<?php echo $email; ?>" size="40" />
- </div>
-
- <?php
- if (($identity === '') || ($mosConfig_enable_openid !== '1')) {
- ?>
- <div class="formfield">
- <label for="password"><?php echo T_('Password:'); ?> *</label>
- <input class="inputbox" type="password" id="password" name="password" size="40" value="" />
- </div>
-
- <div class="formfield">
- <label for="password2"><?php echo T_('Verify Password:'); ?> *</label>
- <input class="inputbox" type="password" id="password2" name="password2" size="40" value="" />
- </div>
-
- <?php
- } else if (($mosConfig_enable_openid === '1') && ($identity !== '')){
- ?>
- <input class="inputbox" type="hidden" id="password" name="password" size="40" value="<?php echo $temppasswd; ?>" />
- <input class="inputbox" type="hidden" id="password2" name="password2" size="40" value="<?php echo $temppasswd; ?>" />
- <?php
- }
- ?>
- <div class="formfield">
- <label for="privacypolicy"><?php echo T_('Disclaimer and<br />Privacy Policy:'); ?> *</label>
- <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>
- </div>
-
- <div class="formfield">
- <label for="accept"> </label>
- <input id="accept" name="accept" type="checkbox" value="yes" />
- <label for="accept"><?php echo T_('Yes, I Accept'); ?></label>
- </div>
-
- <div class="formfield">
- <label for="send_registration"> </label>
- <input type="button" id="send_registration" value="<?php echo T_('Send Registration'); ?>" class="button" />
- </div>
-
- <?php
- if ($mosConfig_enable_openid === '1') {
- ?>
- <input type="hidden" name="identity" value="<?php echo $identity;?>" />
- <?php
- } //end of openid if
- ?>
- <input type="hidden" name="id" value="0" />
- <input type="hidden" name="gid" value="0" />
- <input type="hidden" name="useractivation" value="<?php echo $useractivation;?>" />
- <input type="hidden" name="option" value="<?php echo $option; ?>" />
- <input type="hidden" name="task" value="confirmRegistration" />
- </fieldset>
- </form>
- </td>
- </tr>
- <?php
- if (($mosConfig_enable_openid === '1') && ($identity)) {
- ?>
- <tr>
- <td>
- <?php
- if ($email === '') {
- echo '<br/>';
- echo T_('For communication purposes, this site requires you to enter your email address.');
- }
- ?>
- </td>
- </tr>
- <?php
- } //end of openid if
- ?>
-
- </table>
- <?php
- //Define heredoc vars
- $nameMsg = html_entity_decode(T_('Please enter your name'));
- $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"));
- $validEmailMsg = html_entity_decode(T_('Please enter a valid e-mail address.'));
- $validEmailMsg2 = html_entity_decode(T_('Please enter a valid e-mail address for the verification.'));
- $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'));
- $verifyPasswordMsg = html_entity_decode(T_('Please verify the verification password.'));
- $passwordMatchMsg = html_entity_decode(T_('Password and verification do not match, please try again.'));
- $emailMatchMsg = html_entity_decode(T_('Email and verification do not match, please try again.'));
- $acceptMsg = html_entity_decode(T_('You must accept the Privacy Policy and Disclaimer, to continue.'));
-
- $tag = <<<JSTAG
- <script type="text/javascript">
- YAHOO.util.Event.on(window, "load", function() {
- YAHOO.miacms.base.submitbutton = function() {
- var form = YAHOO.util.Dom.get("mosForm");
- var name = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("name").value);
- var regusername = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("regusername").value);
- var email = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("email").value);
- var email2 = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("email2").value);
- var password = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("password").value);
- var password2 = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("password2").value);
- var name = YAHOO.miacms.base.trim(YAHOO.util.Dom.get("name").value);
- var r = new RegExp("[^A-Za-z0-9]", "i");
-
- // do field validation
- if (name === "") {
- alert( "$nameMsg" );
- YAHOO.util.Dom.get("name").focus();
- } else if (regusername === "") {
- alert( "$validUsernameMsg" );
- YAHOO.util.Dom.get("regusername").focus();
- } else if (r.exec(regusername) || regusername.length < 3) {
- alert( "$validUsernameMsg" );
- YAHOO.util.Dom.get("regusername").focus();
- } else if (email === "" ) {
- alert( "$validEmailMsg" );
- YAHOO.util.Dom.get("email").focus();
- } else if (email2 === "" ) {
- alert( "$validEmailMsg2" );
- YAHOO.util.Dom.get("email2").focus();
- } else if (password.length < 6) {
- alert( "$validPasswordMsg" );
- YAHOO.util.Dom.get("password").focus();
- } else if (password2 === "") {
- alert( "$verifyPasswordMsg" );
- YAHOO.util.Dom.get("password2").focus();
- } else if ((password !== "") && (password !== password2)){
- alert( "$passwordMatchMsg" );
- password="";
- password2="";
- YAHOO.util.Dom.get("password").focus();
- } else if (r.exec(password)) {
- alert( "$validPasswordMsg" );
- YAHOO.util.Dom.get("password").focus();
- } else if ((password !== "") && (email !== email2)){
- alert( "$emailMatchMsg" );
- email="";
- email2="";
- YAHOO.util.Dom.get("email").focus();
- } else if ( form.accept.checked === false) {
- alert( "$acceptMsg" );
- YAHOO.util.Dom.get("accept").focus();
- } else {
- form.submit();
- }
- };
- });
-
- YAHOO.util.Event.addListener("send_registration", "click", function() {
- YAHOO.miacms.base.submitbutton();
- });
- </script>
- JSTAG;
- $mainframe->addCustomFootTag($tag);
- }
-
-
- function confirmForm($option, $name, $username, $password, $email, $useractivation) {
- global $mosConfig_enable_openid, $mainframe;
- ?>
- <div class="componentheading">
- <?php echo T_('Registration'); ?></div>
- <form action="index.php" method="post" id="mosForm" name="mosForm">
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
- <tr>
- <td colspan="2"><?php echo T_('Please verify that the following data is correct and click the button below to complete registration.'); ?> </td>
- </tr>
- <tr>
- <td colspan="2"> </td>
- </tr>
- <tr>
- <td width="15%"><?php echo T_('Name:'); ?> </td>
- <td><strong><?php echo $name;?></strong><input type="hidden" name="name" size="40" value="<?php echo $name;?>" /></td>
- </tr>
- <tr>
- <td><?php echo T_('Username:'); ?> </td>
- <td><strong><?php echo $username;?></strong><input type="hidden" name="username" size="40" value="<?php echo $username;?>" /></td>
- <tr>
- <td><?php echo T_('E-mail:'); ?> </td>
- <td><strong><?php echo $email;?></strong><input type="hidden" name="email" size="40" value="<?php echo $email;?>" /></td>
- </tr>
- <tr>
- <td colspan="2"> </td>
- </tr>
- <tr align="center">
- <td colspan="2"><table width="80%" border="0" cellspacing="0" cellpadding="0">
- <tr align="center" valign="top">
- <td width="45%" align="center" valign="top" style="background-color:#FFE9E6;"><?php echo T_('Go back and correct your data.'); ?></td>
- <td width="10%" valign="top"> </td>
- <td width="45%" align="center" style="background-color:#E8FFE8"><?php echo T_('The data is correct.'); ?></td>
- </tr>
- <tr align="center" valign="middle">
- <td height="32" align="center" valign="middle" style="background-color:#FFE9E6;">
- <input id="back" name="back" type="button" class="button" value="<?php echo T_('Correct Your Data'); ?>">
- </td>
- <td> </td>
- <td align="center" valign="middle" style="background-color:#E8FFE8">
- <input name="confirm" type="submit" class="button" id="confirm" value="<?php echo T_('Confirm Registration'); ?>"/>
- </td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td colspan="2"> </td>
- </tr>
- </table>
- <?php
- if ($mosConfig_enable_openid === '1') {
- $identity = trim( mosGetParam( $_REQUEST, 'identity', "" ) );
- ?>
- <input type="hidden" name="identity" value="<?php echo $identity;?>" />
- <?php
- }
- ?>
- <input type="hidden" name="id" value="0" />
- <input type="hidden" name="gid" value="0" />
- <input type="hidden" name="useractivation" value="<?php echo $useractivation;?>" />
- <input type="hidden" name="password" value="<?php echo $password;?>" />
- <input type="hidden" name="option" value="<?php echo $option; ?>" />
- <input type="hidden" name="task" value="saveRegistration" />
- </form>
- <?php
- $tag = <<<JSTAG
- <script type="text/javascript">
- YAHOO.util.Event.on(window, "load", function() {
- YAHOO.namespace("component.registration");
-
- YAHOO.component.registration.reviseData = function() {
- var form = YAHOO.util.Dom.get("mosForm");
- form.task.value='reviseRegistration';
- form.submit();
- };
-
- YAHOO.util.Event.addListener("back", "click", function() {
- YAHOO.component.registration.reviseData();
- });
- });
- </script>
- JSTAG;
- $mainframe->addCustomFootTag($tag);
- }
-
- }
- ?>