25 header(
'location: userinfo.php?uid= ' .
$GLOBALS[
'xoopsUser']->getVar(
'uid'));
29 if (!empty(
$_GET[
'op']) && in_array(
$_GET[
'op'], array(
'actv',
'activate'))) {
30 header(
"location: ./activate.php" . (empty(
$_SERVER[
'QUERY_STRING']) ?
"" :
"?" .
$_SERVER[
'QUERY_STRING']));
39 if (empty(
$GLOBALS[
'xoopsConfigUser'][
'allow_register'])) {
65 foreach (array_keys($steps) as $key) {
66 $steps[$key][
'step_no'] = $key + 1;
70 include
$GLOBALS[
'xoops']->path(
'header.php');
72 $GLOBALS[
'xoopsTpl']->assign(
'steps', $steps);
77 $xoBreadcrumbs[] = array(
'title' => $steps[$current_step][
'step_name']);
92 $fieldname =
$fields[
$i]->getVar(
'field_name');
94 $default =
$fields[
$i]->getVar(
'field_default');
95 if ($default ===
'' || $default === null) {
98 $newuser->setVar($fieldname, $default);
120 if (isset(
$_POST[$fieldname])) {
125 if ($current_step == 0) {
128 $_SESSION[
'profile_register_uid'] = null;
136 foreach (array_keys(
$fields) as $field) {
137 if (!isset(
$_POST[$field])) {
143 $newuser->setVar($field, $value);
161 if ($current_step == 1) {
169 if (
$GLOBALS[
'xoopsConfigUser'][
'reg_dispdsclmr'] != 0 &&
$GLOBALS[
'xoopsConfigUser'][
'reg_disclaimer'] !=
'') {
175 $newuser->setVar(
'uname',
$uname);
176 $newuser->setVar(
'email',
$email);
177 $newuser->setVar(
'pass',
$pass ? md5(
$pass) :
'');
182 if (!$xoopsCaptcha->verify()) {
183 $stop .= $xoopsCaptcha->getMessage();
188 if ($current_step > 0 && empty(
$stop) && (!empty($steps[$current_step - 1][
'step_save']) || !isset($steps[$current_step]))) {
190 $isNew = $newuser->isNew();
198 $newuser->setVar(
'uname',
$uname);
199 $newuser->setVar(
'email',
$email);
200 $newuser->setVar(
'pass',
$pass ? md5(
$pass) :
'');
201 $actkey = substr(md5(uniqid(mt_rand(), 1) ), 0, 8);
202 $newuser->setVar(
'actkey', $actkey,
true);
203 $newuser->setVar(
'user_regdate', time(),
true);
204 $newuser->setVar(
'uorder',
$GLOBALS[
'xoopsConfig'][
'com_order'],
true);
205 $newuser->setVar(
'umode',
$GLOBALS[
'xoopsConfig'][
'com_mode'],
true);
206 $newuser->setVar(
'theme',
$GLOBALS[
'xoopsConfig'][
'theme_set'],
true);
207 $newuser->setVar(
'user_avatar',
'avatars/blank.gif',
true);
208 if (
$GLOBALS[
'xoopsConfigUser'][
'activation_type'] == 1) {
209 $newuser->setVar(
'level', 1,
true);
211 $newuser->setVar(
'level', 0,
true);
218 $stop .= implode(
'<br />', $newuser->getErrors() );
221 $profile->setVar(
'profile_id', $newuser->getVar(
'uid') );
226 if (
$GLOBALS[
'xoopsConfigUser'][
'new_user_notify'] == 1 && !empty(
$GLOBALS[
'xoopsConfigUser'][
'new_user_notify_group'])) {
228 $xoopsMailer->reset();
229 $xoopsMailer->useMail();
231 $xoopsMailer->setFromEmail(
$GLOBALS[
'xoopsConfig'][
'adminmail']);
232 $xoopsMailer->setFromName(
$GLOBALS[
'xoopsConfig'][
'sitename']);
234 $xoopsMailer->setBody(sprintf(
_US_HASJUSTREG, $newuser->getVar(
'uname')));
235 $xoopsMailer->send(
true);
239 if (!
$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newuser->getVar(
'uid'))) {
241 }
else if (
$GLOBALS[
'xoopsConfigUser'][
'activation_type'] == 1) {
243 }
else if (
$GLOBALS[
'xoopsConfigUser'][
'activation_type'] == 0) {
245 $xoopsMailer->reset();
246 $xoopsMailer->useMail();
247 $xoopsMailer->setTemplate(
'register.tpl');
248 $xoopsMailer->assign(
'SITENAME',
$GLOBALS[
'xoopsConfig'][
'sitename']);
249 $xoopsMailer->assign(
'ADMINMAIL',
$GLOBALS[
'xoopsConfig'][
'adminmail']);
250 $xoopsMailer->assign(
'SITEURL', XOOPS_URL.
"/");
251 $xoopsMailer->assign(
'X_UPASS',
$_POST[
'vpass']);
252 $xoopsMailer->setToUsers($newuser);
253 $xoopsMailer->setFromEmail(
$GLOBALS[
'xoopsConfig'][
'adminmail']);
254 $xoopsMailer->setFromName(
$GLOBALS[
'xoopsConfig'][
'sitename']);
255 $xoopsMailer->setSubject(sprintf(
_US_USERKEYFOR, $newuser->getVar(
'uname')));
256 if (!$xoopsMailer->send(
true)) {
257 $_SESSION[
'profile_post'][
'_message_'] = 0;
259 $_SESSION[
'profile_post'][
'_message_'] = 1;
261 }
else if (
$GLOBALS[
'xoopsConfigUser'][
'activation_type'] == 2) {
263 $xoopsMailer->reset();
264 $xoopsMailer->useMail();
265 $xoopsMailer->setTemplate(
'adminactivate.tpl');
266 $xoopsMailer->assign(
'USERNAME', $newuser->getVar(
'uname'));
267 $xoopsMailer->assign(
'USEREMAIL', $newuser->getVar(
'email'));
268 $xoopsMailer->assign(
'USERACTLINK', XOOPS_URL .
"/modules/" .
$GLOBALS[
'xoopsModule']->getVar(
'dirname',
'n') .
'/activate.php?id=' . $newuser->getVar(
'uid') .
'&actkey=' . $newuser->getVar(
'actkey',
'n'));
269 $xoopsMailer->assign(
'SITENAME',
$GLOBALS[
'xoopsConfig'][
'sitename']);
270 $xoopsMailer->assign(
'ADMINMAIL',
$GLOBALS[
'xoopsConfig'][
'adminmail']);
271 $xoopsMailer->assign(
'SITEURL', XOOPS_URL .
"/");
273 $xoopsMailer->setFromEmail(
$GLOBALS[
'xoopsConfig'][
'adminmail']);
274 $xoopsMailer->setFromName(
$GLOBALS[
'xoopsConfig'][
'sitename']);
275 $xoopsMailer->setSubject(sprintf(
_US_USERKEYFOR, $newuser->getVar(
'uname')));
276 if (!$xoopsMailer->send()) {
277 $_SESSION[
'profile_post'][
'_message_'] = 2;
279 $_SESSION[
'profile_post'][
'_message_'] = 3;
283 $GLOBALS[
'xoopsTpl']->append(
'confirm', $message);
285 $_SESSION[
'profile_register_uid'] = $newuser->getVar(
'uid');
290 if (!empty(
$stop) || isset($steps[$current_step])) {
291 include_once dirname(__FILE__) .
'/include/forms.php';
292 $current_step = empty(
$stop) ? $current_step : $current_step - 1;
295 $GLOBALS[
'xoopsTpl']->assign(
'current_step', $current_step);
300 $GLOBALS[
'xoopsTpl']->assign(
'current_step', -1);
301 if (
$GLOBALS[
'xoopsConfigUser'][
'activation_type'] == 1 && !empty(
$_SESSION[
'profile_post'][
'pass'])) {
303 $GLOBALS[
'xoopsTpl']->assign(
'finish_uname', $newuser->getVar(
'uname'));
304 $GLOBALS[
'xoopsTpl']->assign(
'finish_pass', htmlspecialchars(
$_SESSION[
'profile_post'][
'pass']));
306 if (isset(
$_SESSION[
'profile_post'][
'_message_'])) {