2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
14 * Called by "register.php" and "user/user_create_edit.php
18 * show_user_group: true/false. Indicates whether show section "User Group"
19 * Set to true when admin creates/edits user; set to false at new registration.
20 * The new user registered via registration form is automatically set into group "User"
21 * show_password: true/false. Indicates whether show section "Password" & "Password Again"
22 * Set to true when admin creates new user or new user registration;
23 * Set to false when admin edits existing user.
24 * show_status: true/false. Indicates whether show section "status"
25 * Set to true when admin creates/edits user; set to false at new registration.
26 * user_row: only need when edit existing user.
27 * all_user_groups: display selections in dropdown list box "User Group"
29 * submit_button_text: button text for submit button. "Register" at registration, "Save" at admin creating/editing user
31 $default_user_group_id = TR_USER_GROUP_USER;
33 // show or hide the author information based on the status of the checkbox "author content"
36 document.form.login.focus();
38 if (jQuery('#is_author').attr('checked')) jQuery('#table_is_author').show();
39 else jQuery('#table_is_author').hide();
42 require(TR_INCLUDE_PATH.'header.inc.php');
45 <script language="JavaScript" src="include/jscripts/sha-1factory.js" type="text/javascript"></script>
47 <script type="text/javascript">
48 function encrypt_password()
50 document.form.password_error.value = "";
52 err = verify_password(document.form.form_password1.value, document.form.form_password2.value);
56 document.form.password_error.value = err;
60 document.form.form_password_hidden.value = hex_sha1(document.form.form_password1.value);
61 document.form.form_password1.value = "";
62 document.form.form_password2.value = "";
67 <form method="post" action="<?php $id_str = ''; if (isset($_GET['id'])) $id_str='?id='.$_GET['id']; echo $_SERVER['PHP_SELF'].$id_str; ?>" name="form">
68 <input name="password_error" type="hidden" />
69 <input type="hidden" name="form_password_hidden" value="" />
71 <div class="input-form">
72 <fieldset class="group_form"><legend class="group_form"><?php echo $this->title; ?></legend>
73 <div style="width:75%; margin-left:auto; margin-right:auto;">
74 <p><?php echo _AT('required_field_text') ;?></p>
76 <dl class="form_layout">
77 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="login"><?php echo _AT('login_name'); ?></label>:</dt>
78 <dd><input id="login" name="login" type="text" maxlength="20" size="30" value="<?php if (isset($_POST['login'])) echo stripslashes(htmlspecialchars($_POST['login'])); else echo stripslashes(htmlspecialchars($this->user_row['login'])); ?>" /></dd>
79 <p><small>· <?php echo _AT('contain_only'); ?><br />
80 · <?php echo _AT('20_max_chars'); ?></small></p>
82 <?php if ($this->show_user_group) { ?>
83 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="user_group_id"><?php echo _AT('user_group'); ?>:</label>:</dt>
84 <dd><select name="user_group_id" id="user_group_id">
85 <option value="-1">- <?php echo _AT('select'); ?> -</option>
86 <?php foreach ($this->all_user_groups as $user_group) {?>
87 <option value="<?php echo $user_group['user_group_id']; ?>" <?php if ((isset($_POST['user_group_id']) && $_POST['user_group_id']==$user_group['user_group_id']) || (!isset($_POST['user_group_id']) && !isset($this->user_row['user_group_id']) && $user_group['user_group_id'] == $default_user_group_id) || (!isset($_POST['user_group_id']) && isset($this->user_row['user_group_id']) && $this->user_row['user_group_id'] == $user_group['user_group_id'] )) echo 'selected="selected"'; ?>><?php echo $user_group['title']; ?></option>
92 <?php if ($this->show_password) { ?>
93 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="form_password1"><?php echo _AT('password'); ?></label>:</dt>
94 <dd><input id="form_password1" name="form_password1" type="password" size="15" maxlength="15" /></dd>
95 <p><small>· <?php echo _AT('combination'); ?><br />
96 · <?php echo _AT('15_max_chars'); ?></small></p>
97 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="form_password2"><?php echo _AT('password_again'); ?></label>:</dt>
98 <dd><input id="form_password2" name="form_password2" type="password" size="15" maxlength="15" /></dd>
101 <?php if ($this->use_captcha) { ?>
103 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="secret"><?php echo _AT('captcha'); ?></label></dt>
104 <dd><input id="secret" name="secret" type="text" size="6" maxlength="6" value="" /></dd>
105 <p><img src="<?php echo TR_INCLUDE_PATH; ?>securimage/securimage_show.php?sid=<?php echo md5(uniqid(time())); ?>" id="simage" align="left" />
106 <a href="<?php echo TR_INCLUDE_PATH; ?>securimage/securimage_play.php" title="<?php echo _AT('audible_captcha'); ?>"><img src="<?php echo TR_INCLUDE_PATH; ?>securimage/images/audio_icon.gif" alt="<?php echo _AT('audible_captcha'); ?>" onclick="this.blur()" align="top" border="0"></a>
107 <a href="#" title="<?php echo _AT('refresh_image'); ?>" onclick="document.getElementById('simage').src = '<?php echo TR_INCLUDE_PATH; ?>securimage/securimage_show.php?sid=' + Math.random(); return false"><img src="<?php echo TR_INCLUDE_PATH; ?>securimage/images/refresh.gif" alt="<?php echo _AT('refresh_image'); ?>" onclick="this.blur()" align="bottom" border="0"></a></p>
108 <p><br /><small><?php echo _AT('image_validation_text'); ?> <?php echo _AT('image_validation_text2'); ?></small></p>
112 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="email"><?php echo _AT('email_address'); ?></label>:</dt>
113 <dd><input id="email" name="email" type="text" size="50" maxlength="50" value="<?php if (isset($_POST['email'])) echo stripslashes(htmlspecialchars($_POST['email'])); else echo stripslashes(htmlspecialchars($this->user_row['email'])); ?>" /></dt>
114 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="first_name"><?php echo _AT('first_name'); ?></label>:</dt>
115 <dd><input id="first_name" name="first_name" type="text" value="<?php if (isset($_POST['first_name'])) echo stripslashes(htmlspecialchars($_POST['first_name'])); else echo stripslashes(htmlspecialchars($this->user_row['first_name'])); ?>" /></dd>
116 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="last_name"><?php echo _AT('last_name'); ?></label>:</dt>
117 <dd><input id="last_name" name="last_name" type="text" value="<?php if (isset($_POST['last_name'])) echo stripslashes(htmlspecialchars($_POST['last_name'])); else echo stripslashes(htmlspecialchars($this->user_row['last_name'])); ?>" /></dt>
121 <?php if ($this->show_status) {?>
122 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><?php echo _AT('status'); ?>:</td>
124 <input type="radio" name="status" id="statusD" value="<?php echo TR_STATUS_DISABLED; ?>" <?php if ((isset($_POST['status']) && $_POST['status']==0) || (!isset($_POST['status']) && $this->user_row['status']==TR_STATUS_DISABLED)) echo 'checked="checked"'; ?> /><label for="statusD"><?php echo _AT('disabled'); ?></label>
125 <input type="radio" name="status" id="statusE" value="<?php echo TR_STATUS_ENABLED; ?>" <?php if ((isset($_POST['status']) && $_POST['status']==1) || (!isset($_POST['status']) && $this->user_row['status']==TR_STATUS_ENABLED)) echo 'checked="checked"'; ?> /><label for="statusE"><?php echo _AT('enabled'); ?></label>
126 <?php if (defined('TR_EMAIL_CONFIRMATION') && TR_EMAIL_CONFIRMATION) {?>
127 <input type="radio" name="status" id="statusU" value="<?php echo TR_STATUS_UNCONFIRMED; ?>" <?php if ((isset($_POST['status']) && $_POST['status']==1) || (!isset($_POST['status']) && $this->user_row['status']==TR_STATUS_UNCONFIRMED)) echo 'checked="checked"'; ?> /><label for="statusU"><?php echo _AT('enabled'); ?></label>
133 <?php if (isset($this->user_row['web_service_id'])) {?>
134 <dt align="left"><?php echo _AT('web_service_id'); ?>:</dt>
135 <dd><?php echo $this->user_row['web_service_id']; ?></dd><br />
138 <p style="margin-left:5em;"><input type="checkbox" name="is_author" id="is_author" <?php if (isset($_POST['is_author']) || (!isset($_POST['is_author']) && $this->user_row['is_author']==1)) echo 'checked="checked"'; ?> onclick="if (this.checked) jQuery('#table_is_author').show('slow'); else jQuery('#table_is_author').hide('slow');" />
139 <label for="is_author"><?php echo _AT('is_author'); ?></label></p>
142 <dl id="table_is_author" class="form_layout">
143 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="organization"><?php echo _AT('organization'); ?></label>:</dt>
144 <dd><input id="organization" name="organization" type="text" size="50" maxlength="100" value="<?php if (isset($_POST['organization'])) echo stripslashes(htmlspecialchars($_POST['organization'])); else echo stripslashes(htmlspecialchars($this->user_row['organization'])); ?>" /></dd>
146 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="phone"><?php echo _AT('phone'); ?></label>:</dt>
147 <dd><input id="phone" name="phone" type="text" size="30" maxlength="30" value="<?php if (isset($_POST['phone'])) echo stripslashes(htmlspecialchars($_POST['phone'])); else echo stripslashes(htmlspecialchars($this->user_row['phone'])); ?>" /></dd>
151 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="address"><?php echo _AT('address'); ?></label>:</dt>
152 <dd><input id="address" name="address" type="text" size="50" maxlength="100" value="<?php if (isset($_POST['address'])) echo stripslashes(htmlspecialchars($_POST['address'])); else echo stripslashes(htmlspecialchars($this->user_row['address'])); ?>" /></dd>
156 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="city"><?php echo _AT('city'); ?></label>:</dt>
157 <dd><input id="city" name="city" type="text" size="30" maxlength="30" value="<?php if (isset($_POST['city'])) echo stripslashes(htmlspecialchars($_POST['city'])); else echo stripslashes(htmlspecialchars($this->user_row['city'])); ?>" /></dd>
161 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="province"><?php echo _AT('province'); ?></label>:</dt>
162 <dd><input id="province" name="province" type="text" size="30" maxlength="30" value="<?php if (isset($_POST['province'])) echo stripslashes(htmlspecialchars($_POST['province'])); else echo stripslashes(htmlspecialchars($this->user_row['province'])); ?>" /></dd>
166 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="country"><?php echo _AT('country'); ?></label>:</dt>
167 <dd><input id="country" name="country" type="text" size="30" maxlength="30" value="<?php if (isset($_POST['country'])) echo stripslashes(htmlspecialchars($_POST['country'])); else echo stripslashes(htmlspecialchars($this->user_row['country'])); ?>" /></dd>
171 <dt><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="postal_code"><?php echo _AT('postal_code'); ?></label>:</dt>
172 <dd><input id="postal_code" name="postal_code" type="text" size="10" maxlength="10" value="<?php if (isset($_POST['postal_code'])) echo stripslashes(htmlspecialchars($_POST['postal_code'])); else echo stripslashes(htmlspecialchars($this->user_row['postal_code'])); ?>" /></dd>
174 <p class="submit_buttons">
175 <input type="submit" name="submit" value="<?php echo $this->submit_button_text; ?>" class="submit" onclick="return encrypt_password();" />
176 <input type="submit" name="cancel" value=" <?php echo _AT('cancel'); ?> " class="submit" />
183 <?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>