2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 $fetchtemplates = array(
26 define('SVN', '$Id$');
28 $focus['user
'] = 'focus
';
30 require_once('./global.php
');
31 require_once('./includes
/api_user
.php
');
33 // ###################################################################
35 if ($_POST['do'] == 'insert
')
37 if ($bugsys->userinfo['userid
'])
39 $message->error($lang->string('Sorry
, you are already registered
.'));
42 if (!$bugsys->options['allownewreg
'])
44 $message->error($lang->string('Sorry
, we don\'t allow
new registrations
.'));
47 if ($bugsys->in['email
'] != $bugsys->in['confirmemail
'])
49 $message->add_error($lang->string('The emails you entered
do not match
.'));
52 if ($bugsys->in['password
'] != $bugsys->in['confirmpassword
'])
54 $message->add_error($lang->string('The passwords you entered did not match
.'));
59 $salt = $funct->rand(15);
61 if ($bugsys->options['verifyemail
'])
67 if ($bugsys->options['moderatenewusers
'])
77 $user = new UserAPI($bugsys);
78 $user->set('email
', $bugsys->in['email
']);
79 $user->set('displayname
', $bugsys->in['displayname
']);
80 $user->set('password
', $bugsys->in['password
']);
81 $user->set('showemail
', $bugsys->in['showemail
']);
82 $user->set('showcolours
', 1);
83 $user->set('languageid
', $bugsys->in['languageid
']);
84 $user->set('usergroupid
', $usergroupid);
87 $userid = $user->insertid;
89 // Verify email address
90 if ($usergroupid == 3)
92 $activationid = $funct->rand(25);
94 $db->query("INSERT INTO " . TABLE_PREFIX . "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . TIMENOW . ", 2)");
96 $mail->to = $bugsys->in['email'];
97 $mail->subject = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']);
98 $mail->body = sprintf($lang->string('Hi %1$s,
100 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:
102 %3$s/register.php?do=activate&userid=%4$s&activator=%5$s'),
104 $bugsys->in['displayname'],
105 $bugsys->options['trackertitle'],
106 $bugsys->options['trackerurl'],
113 $message->message($lang->string('You now need to activate your account via email.'));
115 else if ($usergroupid == 4 OR $usergroupid == 2)
117 if ($bugsys->options['sendwelcomemail'])
119 $mail->to = $bugsys->in['email'];
120 $mail->subject = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']);
121 $mail->body = sprintf($lang->string('Hi %1$s,
123 Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better.
125 If you have any questions, please don\'t hesitate to contact the webmaster.'),
126 $bugsys->in['displayname'],
127 $bugsys->options['trackertitle']
133 if ($usergroupid == 4)
135 $message->message($lang->string('Your account is pending approval.'));
139 $message->message($lang->string('Thank you for registering. You may now use your account.'));
145 $_REQUEST['do'] = '';
146 $show['errors'] = true;
147 $message->error_list_process();
151 // ###################################################################
153 if (empty($_REQUEST['do']))
155 if ($bugsys->userinfo['userid'])
157 $message->error($lang->string('Sorry, you are already registered.'));
160 if (!$bugsys->options['allownewreg'])
162 $message->error($lang->string('Sorry, we don\'t allow new registrations.'));
165 foreach ($bugsys->datastore['language'] AS $value => $temp)
167 $label = $temp['title'];
168 $selected = ($value == $bugsys->in['languageid']);
169 eval('$opts .= "' . $template->fetch('selectoption
') . '";');
172 eval('$template->flush("' . $template->fetch('register
') . '");');
175 // ###################################################################
177 if ($_REQUEST['do'] == 'activate')
179 if ($useractivation = $db->query_first("SELECT
* FROM
" . TABLE_PREFIX . "useractivation WHERE userid
= " . intval($bugsys->in['userid']) . " AND activator
= '" . $bugsys->in['activator
'] . "'"))
181 $user = $db->query_first("SELECT
* FROM
" . TABLE_PREFIX . "user WHERE userid
= " . intval($bugsys->in['userid']));
182 $db->query("UPDATE
" . TABLE_PREFIX . "user SET usergroupid
= $useractivation[usergroupid
] WHERE userid
= " . intval($bugsys->in['userid']));
183 $db->query("DELETE FROM
" . TABLE_PREFIX . "useractivation WHERE userid
= " . intval($bugsys->in['userid']));
185 if ($bugsys->options['sendwelcomemail'])
187 $mail->to = $user['email'];
188 $mail->subject = sprintf($lang->string('Welcome to %1$s'), $bugsys->options['trackertitle']);
189 $mail->body = sprintf($lang->string('Hi %1$s,
191 Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better.
193 If you have any questions, please don\'t hesitate to contact the webmaster.'),
194 $user['displayname'],
195 $bugsys->options['trackertitle']
200 $message->message($lang->string('Your account is now activated and you can now login.'));
204 $message->error($lang->string('Sorry, we could not match your registration string. Please make sure you entered the correct URL.'));
208 /*=====================================================================*\
209 || ###################################################################
212 || ###################################################################
213 \*=====================================================================*/