// ###################################################################
-if (empty($_REQUEST['do']))
-{
- if ($bugsys->userinfo['userid'])
- {
- $message->error($lang->string('Sorry, you are already registered.'));
- }
-
- if (!$bugsys->options['allownewreg'])
- {
- $message->error($lang->string('Sorry, we don\'t allow new registrations.'));
- }
-
- foreach ($bugsys->datastore['language'] AS $value => $temp)
- {
- $label = $temp['title'];
- eval('$opts .= "' . $template->fetch('selectoption') . '";');
- }
-
- eval('$template->flush("' . $template->fetch('register') . '");');
-}
-
-// ###################################################################
-
if ($_POST['do'] == 'insert')
{
if ($bugsys->userinfo['userid'])
$message->items[] = $lang->string('That display name is already in use by another user.');
}
- if ($message->items)
- {
- $message->error_list_process();
- $message->error();
- }
-
- $salt = $funct->rand(15);
-
- if ($bugsys->options['verifyemail'])
+ if (!$message->items)
{
- $usergroupid = 3;
- }
- else
- {
- if ($bugsys->options['moderatenewusers'])
+ $salt = $funct->rand(15);
+
+ if ($bugsys->options['verifyemail'])
{
- $usergroupid = 4;
+ $usergroupid = 3;
}
else
{
- $usergroupid = 2;
+ if ($bugsys->options['moderatenewusers'])
+ {
+ $usergroupid = 4;
+ }
+ else
+ {
+ $usergroupid = 2;
+ }
}
- }
-
- $db->query("
- INSERT INTO " . TABLE_PREFIX . "user
- (email, displayname, password, salt, authkey, showemail, showcolours, languageid, usergroupid)
- VALUES
- ('" . $bugsys->in['email'] . "',
- '" . $bugsys->in['displayname'] . "',
- '" . md5(md5($bugsys->in['password']) . md5($salt)) . "',
- '$salt',
- '" . $funct->rand() . "',
- " . intval($bugsys->in['showemail']) . ",
- 1,
- " . intval($bugsys->in['languageid']) . ",
- $usergroupid
- )"
- );
-
- $userid = $db->insert_id();
-
- // Verify email address
- if ($usergroupid == 3)
- {
- $activationid = $funct->rand(25);
-
- $db->query("INSERT INTO " . TABLE_PREFIX . "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . TIMENOW . ", 2)");
- $mail->to = $bugsys->in['email'];
- $mail->subject = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']);
- $mail->body = sprintf($lang->string('Hi %1$s,
-
-Welcome to the %2$s tracker. Before you can begin posting bug reports, you\'ll need to activae your account. To do this, please click this link:
-
-%3$s/register.php?do=activate&userid=%4$s&activator=%5$s'),
-
- $bugsys->in['displayname'],
- $bugsys->options['trackertitle'],
- $bugsys->options['trackerurl'],
- $userid,
- $activationid
+ $db->query("
+ INSERT INTO " . TABLE_PREFIX . "user
+ (email, displayname, password, salt, authkey, showemail, showcolours, languageid, usergroupid)
+ VALUES
+ ('" . $bugsys->in['email'] . "',
+ '" . $bugsys->in['displayname'] . "',
+ '" . md5(md5($bugsys->in['password']) . md5($salt)) . "',
+ '$salt',
+ '" . $funct->rand() . "',
+ " . intval($bugsys->in['showemail']) . ",
+ 1,
+ " . intval($bugsys->in['languageid']) . ",
+ $usergroupid
+ )"
);
- $mail->send();
-
- $message->message($lang->string('You now need to activate your account via email.'));
- }
- else if ($usergroupid == 4 OR $usergroupid == 2)
- {
- if ($bugsys->options['sendwelcomemail'])
+ $userid = $db->insert_id();
+
+ // Verify email address
+ if ($usergroupid == 3)
{
+ $activationid = $funct->rand(25);
+
+ $db->query("INSERT INTO " . TABLE_PREFIX . "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . TIMENOW . ", 2)");
+
$mail->to = $bugsys->in['email'];
- $mail->subject = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']);
+ $mail->subject = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']);
$mail->body = sprintf($lang->string('Hi %1$s,
-
-Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better.
-
-If you have any questions, please don\'t hesitate to contact the webmaster.'),
- $bugsys->in['displayname'],
- $bugsys->options['trackertitle']
+
+ Welcome to the %2$s tracker. Before you can begin posting bug reports, you\'ll need to activae your account. To do this, please click this link:
+
+ %3$s/register.php?do=activate&userid=%4$s&activator=%5$s'),
+
+ $bugsys->in['displayname'],
+ $bugsys->options['trackertitle'],
+ $bugsys->options['trackerurl'],
+ $userid,
+ $activationid
);
$mail->send();
- }
- if ($usergroupid == 4)
- {
- $message->message($lang->string('Your account is pending approval.'));
+ $message->message($lang->string('You now need to activate your account via email.'));
}
- else
+ else if ($usergroupid == 4 OR $usergroupid == 2)
{
- $message->message($lang->string('Thank you for registering. You may now use your account.'));
+ if ($bugsys->options['sendwelcomemail'])
+ {
+ $mail->to = $bugsys->in['email'];
+ $mail->subject = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']);
+ $mail->body = sprintf($lang->string('Hi %1$s,
+
+ Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better.
+
+ If you have any questions, please don\'t hesitate to contact the webmaster.'),
+ $bugsys->in['displayname'],
+ $bugsys->options['trackertitle']
+ );
+
+ $mail->send();
+ }
+
+ if ($usergroupid == 4)
+ {
+ $message->message($lang->string('Your account is pending approval.'));
+ }
+ else
+ {
+ $message->message($lang->string('Thank you for registering. You may now use your account.'));
+ }
}
}
+ else
+ {
+ $_REQUEST['do'] = '';
+ $show['errors'] = true;
+ $message->error_list_process();
+ }
+}
+
+// ###################################################################
+
+if (empty($_REQUEST['do']))
+{
+ if ($bugsys->userinfo['userid'])
+ {
+ $message->error($lang->string('Sorry, you are already registered.'));
+ }
+
+ if (!$bugsys->options['allownewreg'])
+ {
+ $message->error($lang->string('Sorry, we don\'t allow new registrations.'));
+ }
+
+ foreach ($bugsys->datastore['language'] AS $value => $temp)
+ {
+ $label = $temp['title'];
+ $selected = ($value == $bugsys->in['languageid']);
+ eval('$opts .= "' . $template->fetch('selectoption') . '";');
+ }
+
+ eval('$template->flush("' . $template->fetch('register') . '");');
}
// ###################################################################