[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/components/com_registration/ -> registration.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Users
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  /** ensure this file is being included by a parent file */
  18  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  19  
  20  class HTML_registration {
  21  	function lostPassForm($option) {
  22          ?>
  23  
  24  <div class="componentheading">
  25      <?php echo T_('Lost your Password?'); ?>
  26  </div>
  27  <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
  28    <form action="index.php" method="post">
  29      <tr>
  30        <td colspan="2"><?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>
  31      </tr>
  32      <tr>
  33        <td><?php echo T_('Username:'); ?></td>
  34        <td><input type="text" name="checkusername" class="inputbox" size="40" maxlength="25" /></td>
  35      </tr>
  36      <tr>
  37        <td><?php echo T_('E-mail Address:'); ?></td>
  38        <td><input type="text" name="confirmEmail" class="inputbox" size="40" /></td>
  39      </tr>
  40      <tr>
  41        <td colspan="2"> <input type="hidden" name="option" value="<?php echo $option;?>" />
  42          <input type="hidden" name="task" value="sendNewPass" /> <input type="submit" class="button" value="<?php echo T_('Send Password'); ?>" /></td>
  43      </tr>
  44    </form>
  45  </table>
  46  <?php
  47      }
  48  
  49  function registerForm($option, $useractivation) {
  50  $name = trim( mosGetParam( $_REQUEST, 'name', "" ) );
  51  $username = trim( mosGetParam( $_REQUEST, 'username', "" ) );
  52  $email = trim( mosGetParam( $_REQUEST, 'email', "" ) );
  53  $useractivation = trim( mosGetParam( $_REQUEST, 'useractivation', "" ) );
  54  ?>
  55      <script type="text/javascript">
  56  		function submitbutton() {
  57              var form = document.mosForm;
  58              //old method didn't really work, just excluded certain characters rather than limiting to a range of characters.
  59              //var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", "i");
  60              var r = new RegExp("[^A-Za-z0-9]", "i");
  61  
  62              // do field validation
  63              if (form.name.value == "") {
  64                  alert( "<?php echo html_entity_decode(T_('Please enter your name.'));?>" );
  65                  form.name.focus();
  66              } else if (form.username.value == "") {
  67                  alert( "<?php echo html_entity_decode(T_('Please enter a user name.'));?>" );
  68                  form.username.focus();
  69              } else if (r.exec(form.username.value) || form.username.value.length < 3) {
  70                  alert( "<?php printf( html_entity_decode(T_("Please enter a valid %s.  No spaces, more than %d characters and containing only the characters 0-9,a-z, or A-Z")), html_entity_decode(T_('Please enter a user name.')), 2 );?>" );
  71                  form.username.focus();
  72              } else if (form.email.value == "" || !form.email.value.match(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i)) {
  73                  alert( "<?php echo html_entity_decode(T_('Please enter a valid e-mail address.'));?>" );
  74                  form.email.focus();
  75              } else if (form.email2.value == "" ) {
  76                  alert( "<?php echo html_entity_decode(T_('Please enter a valid e-mail address for the verification.'));?>" );
  77                  form.email2.focus();
  78              } else if (form.password.value.length < 6) {
  79                  alert( "<?php echo 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'));?>" );
  80                  form.password.focus();
  81              } else if (form.password2.value == "") {
  82                  alert( "<?php echo html_entity_decode(T_('Please verify the verification password.'));?>" );
  83                  form.password2.focus();
  84              } else if ((form.password.value != "") && (form.password.value != form.password2.value)){
  85                  alert( "<?php echo html_entity_decode(T_('Password and verification do not match, please try again.'));?>" );
  86                  form.password.value="";
  87                  form.password2.value="";
  88                  form.password.focus();
  89              } else if (r.exec(form.password.value)) {
  90                  alert( "<?php printf( html_entity_decode(T_("Please enter a valid %s.  No spaces, more than %d characters and containing only the characters 0-9,a-z, or A-Z")), html_entity_decode(T_('Password:')), 6 );?>" );
  91                  form.password.focus();
  92              } else if ((form.password.value != "") && (form.email.value != form.email2.value)){
  93                  alert( "<?php printf( html_entity_decode(T_('Email and verification do not match, please try again.')));?>" );
  94                  form.email.value="";
  95                  form.email2.value="";
  96                  form.email.focus();
  97              } else if ( form.accept.checked == false) {
  98                  alert( "<?php printf( html_entity_decode(T_('You must accept the Privacy Policy and Disclaimer, to continue.')));?>" );
  99                  form.accept.focus();
 100              } else {
 101                  form.submit();
 102              }
 103          }
 104      </script>
 105  
 106  <div class="componentheading">
 107      <?php echo T_('Registration'); ?>
 108  </div>
 109  <form action="index.php" method="post" name="mosForm">
 110  <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
 111  <tr>
 112  <td colspan="2"><?php echo T_('Fields marked with an asterisk (*) are required.'); ?></td>
 113  </tr>
 114      <tr>
 115        <td width="30%"><?php echo T_('Name:'); ?> *</td>
 116        <td><input type="text" name="name" size="40" value="<?php echo $name; ?>" class="inputbox" /></td>
 117      </tr>
 118  
 119      <tr>
 120  
 121        <td><?php echo T_('Username:'); ?> *</td>
 122        <td><input type="text" name="username" size="40" value="<?php echo $username; ?>" class="inputbox" /></td>
 123      <tr>
 124  
 125        <td><?php echo T_('E-mail:'); ?> *</td>
 126        <td><input type="text" name="email" size="40" value="<?php echo $email; ?>" class="inputbox" /></td>
 127      </tr>
 128  
 129      <tr>
 130        <td><?php echo T_('Verify E-mail:'); ?> *</td>
 131        <td><input type="text" name="email2" class="inputbox" id="email2" value="<?php echo $email; ?>" size="40" /></td>
 132      </tr>
 133      <tr>
 134        <td><?php echo T_('Password:'); ?> *</td>
 135        <td><input class="inputbox" type="password" name="password" size="40" value="" /></td>
 136      </tr>
 137      <tr>
 138        <td><?php echo T_('Verify Password:'); ?> *</td>
 139        <td><input class="inputbox" type="password" name="password2" size="40" value="" /></td>
 140      </tr>
 141        <td valign="top"><?php echo T_('Disclaimer and<br />Privacy Policy:'); ?> *</td>
 142        <td>
 143       <textarea name="privacypolicy" cols="48" rows="4" id="privacypolicy" class="inputbox" style="font-size:0.85em;" readonly><?php echo T_('put your disclaimer here..'); ?></textarea>
 144       </td>
 145      </tr>
 146      <tr>
 147        <td align="right">&nbsp;</td>
 148        <td><input name="accept" type="checkbox" id="accept" value="yes">        
 149          <?php echo T_('Yes, I Accept'); ?></td>
 150      </tr>
 151      <tr>
 152        <td colspan="2">&nbsp;</td>
 153      </tr>
 154  
 155      <tr>
 156        <td colspan=2>
 157    </td>
 158      </tr>
 159  </table>
 160  <input type="hidden" name="id" value="0" />
 161  <input type="hidden" name="gid" value="0" />
 162  <input type="hidden" name="useractivation" value="<?php echo $useractivation;?>" />
 163  <input type="hidden" name="option" value="<?php echo $option; ?>" />
 164  <input type="hidden" name="task" value="confirmRegistration" />
 165  <input type="button" value="<?php echo T_('Send Registration'); ?>" class="button" onclick="submitbutton()" />
 166  </form>
 167  <?php
 168      }
 169  
 170  
 171  function confirmForm($option, $name, $username, $password, $email, $useractivation) {
 172  ?>
 173  <script type="text/javascript">
 174  function reviseData()
 175  {
 176   var form = document.mosForm;
 177   form.task.value='reviseRegistration';
 178   form.submit();
 179  }
 180  </script>
 181  <div class="componentheading">
 182  <?php echo T_('Registration'); ?></div>
 183  <form action="index.php" method="post" name="mosForm">
 184  <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
 185      <tr>
 186        <td colspan="2"><?php echo T_('Please verify that the following data is correct and click the button below to complete registration.'); ?> </td>
 187      </tr>
 188      <tr>
 189        <td colspan="2">&nbsp;</td>
 190      </tr>
 191      <tr>
 192        <td width="15%"><?php echo T_('Name:'); ?> </td>
 193        <td><strong><?php echo $name;?></strong><input type="hidden" name="name" size="40" value="<?php echo $name;?>" /></td>
 194      </tr>
 195      <tr>
 196        <td><?php echo T_('Username:'); ?> </td>
 197        <td><strong><?php echo $username;?></strong><input type="hidden" name="username" size="40" value="<?php echo $username;?>" /></td>
 198      <tr>
 199        <td><?php echo T_('E-mail:'); ?> </td>
 200        <td><strong><?php echo $email;?></strong><input type="hidden" name="email" size="40" value="<?php echo $email;?>" /></td>
 201      </tr>
 202      <tr>
 203        <td colspan="2">&nbsp;</td>
 204      </tr>
 205      <tr align="center">
 206        <td colspan="2"><table width="80%" border="0" cellspacing="0" cellpadding="0">
 207          <tr align="center" valign="top">
 208            <td width="45%" align="center" valign="top" style="background-color:#FFE9E6;"><?php echo T_('Go back and correct your data.'); ?></td>
 209            <td width="10%" valign="top">&nbsp;</td>
 210            <td width="45%" align="center" style="background-color:#E8FFE8"><?php echo T_('The data is correct.'); ?></td>
 211          </tr>
 212          <tr align="center" valign="middle">
 213            <td height="32" align="center" valign="middle" style="background-color:#FFE9E6;"><input name="back" type="button" class="button" id="back" value="<?php echo T_('Correct Your Data'); ?>" onclick="reviseData()"></td>
 214            <td>&nbsp;</td>
 215            <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>
 216          </tr>
 217        </table></td>
 218      </tr>
 219      <tr>
 220        <td colspan=2>
 221    </td>
 222      </tr>
 223  </table>
 224  <input type="hidden" name="id" value="0" />
 225  <input type="hidden" name="gid" value="0" />
 226  <input type="hidden" name="useractivation" value="<?php echo $useractivation;?>" />
 227  <input type="hidden" name="password" value="<?php echo $password;?>" />
 228  <input type="hidden" name="option" value="<?php echo $option; ?>" />
 229  <input type="hidden" name="task" value="saveRegistration" />
 230  </form>
 231  <?php
 232  }
 233  
 234  }
 235  ?>