|
indvdum@0
|
1 |
<?php
|
|
indvdum@0
|
2 |
/**
|
|
indvdum@0
|
3 |
*
|
|
indvdum@0
|
4 |
* @package ucp
|
|
indvdum@0
|
5 |
* @version $Id$
|
|
indvdum@0
|
6 |
* @copyright (c) 2005 phpBB Group
|
|
indvdum@0
|
7 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
indvdum@0
|
8 |
*
|
|
indvdum@0
|
9 |
*/
|
|
indvdum@0
|
10 |
|
|
indvdum@0
|
11 |
/**
|
|
indvdum@0
|
12 |
* @ignore
|
|
indvdum@0
|
13 |
*/
|
|
indvdum@0
|
14 |
if (!defined('IN_PHPBB'))
|
|
indvdum@0
|
15 |
{
|
|
indvdum@0
|
16 |
exit;
|
|
indvdum@0
|
17 |
}
|
|
indvdum@0
|
18 |
|
|
indvdum@0
|
19 |
/**
|
|
indvdum@0
|
20 |
* ucp_register
|
|
indvdum@0
|
21 |
* Board registration
|
|
indvdum@0
|
22 |
* @package ucp
|
|
indvdum@0
|
23 |
*/
|
|
indvdum@0
|
24 |
class ucp_register
|
|
indvdum@0
|
25 |
{
|
|
indvdum@0
|
26 |
var $u_action;
|
|
indvdum@0
|
27 |
|
|
indvdum@0
|
28 |
function main($id, $mode)
|
|
indvdum@0
|
29 |
{
|
|
indvdum@0
|
30 |
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
|
indvdum@0
|
31 |
|
|
indvdum@0
|
32 |
//
|
|
indvdum@0
|
33 |
if ($config['require_activation'] == USER_ACTIVATION_DISABLE)
|
|
indvdum@0
|
34 |
{
|
|
indvdum@0
|
35 |
trigger_error('UCP_REGISTER_DISABLE');
|
|
indvdum@0
|
36 |
}
|
|
indvdum@0
|
37 |
|
|
indvdum@0
|
38 |
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
|
indvdum@0
|
39 |
|
|
indvdum@0
|
40 |
$coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
|
|
indvdum@0
|
41 |
$agreed = (!empty($_POST['agreed'])) ? 1 : 0;
|
|
indvdum@0
|
42 |
$submit = (isset($_POST['submit'])) ? true : false;
|
|
indvdum@0
|
43 |
$change_lang = request_var('change_lang', '');
|
|
indvdum@0
|
44 |
$user_lang = request_var('lang', $user->lang_name);
|
|
indvdum@0
|
45 |
|
|
indvdum@0
|
46 |
if ($agreed)
|
|
indvdum@0
|
47 |
{
|
|
indvdum@0
|
48 |
add_form_key('ucp_register');
|
|
indvdum@0
|
49 |
}
|
|
indvdum@0
|
50 |
else
|
|
indvdum@0
|
51 |
{
|
|
indvdum@0
|
52 |
add_form_key('ucp_register_terms');
|
|
indvdum@0
|
53 |
}
|
|
indvdum@0
|
54 |
|
|
indvdum@0
|
55 |
if ($change_lang || $user_lang != $config['default_lang'])
|
|
indvdum@0
|
56 |
{
|
|
indvdum@0
|
57 |
$use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang);
|
|
indvdum@0
|
58 |
|
|
indvdum@0
|
59 |
if (!validate_language_iso_name($use_lang))
|
|
indvdum@0
|
60 |
{
|
|
indvdum@0
|
61 |
if ($change_lang)
|
|
indvdum@0
|
62 |
{
|
|
indvdum@0
|
63 |
$submit = false;
|
|
indvdum@0
|
64 |
|
|
indvdum@0
|
65 |
// Setting back agreed to let the user view the agreement in his/her language
|
|
indvdum@0
|
66 |
$agreed = (empty($_GET['change_lang'])) ? 0 : $agreed;
|
|
indvdum@0
|
67 |
}
|
|
indvdum@0
|
68 |
|
|
indvdum@0
|
69 |
$user->lang_name = $user_lang = $use_lang;
|
|
indvdum@0
|
70 |
$user->lang = array();
|
|
indvdum@0
|
71 |
$user->data['user_lang'] = $user->lang_name;
|
|
indvdum@0
|
72 |
$user->add_lang(array('common', 'ucp'));
|
|
indvdum@0
|
73 |
}
|
|
indvdum@0
|
74 |
else
|
|
indvdum@0
|
75 |
{
|
|
indvdum@0
|
76 |
$change_lang = '';
|
|
indvdum@0
|
77 |
$user_lang = $user->lang_name;
|
|
indvdum@0
|
78 |
}
|
|
indvdum@0
|
79 |
}
|
|
indvdum@0
|
80 |
|
|
indvdum@0
|
81 |
|
|
indvdum@0
|
82 |
$cp = new custom_profile();
|
|
indvdum@0
|
83 |
|
|
indvdum@0
|
84 |
$error = $cp_data = $cp_error = array();
|
|
indvdum@0
|
85 |
|
|
indvdum@0
|
86 |
if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable']))
|
|
indvdum@0
|
87 |
{
|
|
indvdum@0
|
88 |
$add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : '';
|
|
indvdum@0
|
89 |
$add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : '';
|
|
indvdum@0
|
90 |
|
|
indvdum@0
|
91 |
$s_hidden_fields = array(
|
|
indvdum@0
|
92 |
'change_lang' => $change_lang,
|
|
indvdum@0
|
93 |
);
|
|
indvdum@0
|
94 |
|
|
indvdum@0
|
95 |
// If we change the language, we want to pass on some more possible parameter.
|
|
indvdum@0
|
96 |
if ($change_lang)
|
|
indvdum@0
|
97 |
{
|
|
indvdum@0
|
98 |
// We do not include the password
|
|
indvdum@0
|
99 |
$s_hidden_fields = array_merge($s_hidden_fields, array(
|
|
indvdum@0
|
100 |
'username' => utf8_normalize_nfc(request_var('username', '', true)),
|
|
indvdum@0
|
101 |
'email' => strtolower(request_var('email', '')),
|
|
indvdum@0
|
102 |
'email_confirm' => strtolower(request_var('email_confirm', '')),
|
|
indvdum@0
|
103 |
'lang' => $user->lang_name,
|
|
indvdum@0
|
104 |
'tz' => request_var('tz', (float) $config['board_timezone']),
|
|
indvdum@0
|
105 |
));
|
|
indvdum@0
|
106 |
|
|
indvdum@0
|
107 |
}
|
|
indvdum@0
|
108 |
|
|
indvdum@0
|
109 |
// Checking amount of available languages
|
|
indvdum@0
|
110 |
$sql = 'SELECT lang_id
|
|
indvdum@0
|
111 |
FROM ' . LANG_TABLE;
|
|
indvdum@0
|
112 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
113 |
|
|
indvdum@0
|
114 |
$lang_row = array();
|
|
indvdum@0
|
115 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
116 |
{
|
|
indvdum@0
|
117 |
$lang_row[] = $row;
|
|
indvdum@0
|
118 |
}
|
|
indvdum@0
|
119 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
120 |
|
|
indvdum@0
|
121 |
if ($coppa === false && $config['coppa_enable'])
|
|
indvdum@0
|
122 |
{
|
|
indvdum@0
|
123 |
$now = getdate();
|
|
indvdum@0
|
124 |
$coppa_birthday = $user->format_date(mktime($now['hours'] + $user->data['user_dst'], $now['minutes'], $now['seconds'], $now['mon'], $now['mday'] - 1, $now['year'] - 13), $user->lang['DATE_FORMAT']);
|
|
indvdum@0
|
125 |
unset($now);
|
|
indvdum@0
|
126 |
|
|
indvdum@0
|
127 |
$template->assign_vars(array(
|
|
indvdum@0
|
128 |
'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '',
|
|
indvdum@0
|
129 |
'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday),
|
|
indvdum@0
|
130 |
'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday),
|
|
indvdum@0
|
131 |
|
|
indvdum@0
|
132 |
'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0' . $add_lang),
|
|
indvdum@0
|
133 |
'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1' . $add_lang),
|
|
indvdum@0
|
134 |
|
|
indvdum@0
|
135 |
'S_SHOW_COPPA' => true,
|
|
indvdum@0
|
136 |
'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields),
|
|
indvdum@0
|
137 |
'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang),
|
|
indvdum@0
|
138 |
));
|
|
indvdum@0
|
139 |
}
|
|
indvdum@0
|
140 |
else
|
|
indvdum@0
|
141 |
{
|
|
indvdum@0
|
142 |
$template->assign_vars(array(
|
|
indvdum@0
|
143 |
'S_LANG_OPTIONS' => (sizeof($lang_row) > 1) ? language_select($user_lang) : '',
|
|
indvdum@0
|
144 |
'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()),
|
|
indvdum@0
|
145 |
|
|
indvdum@0
|
146 |
'S_SHOW_COPPA' => false,
|
|
indvdum@0
|
147 |
'S_REGISTRATION' => true,
|
|
indvdum@0
|
148 |
'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields),
|
|
indvdum@0
|
149 |
'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang . $add_coppa),
|
|
indvdum@0
|
150 |
)
|
|
indvdum@0
|
151 |
);
|
|
indvdum@0
|
152 |
}
|
|
indvdum@0
|
153 |
unset($lang_row);
|
|
indvdum@0
|
154 |
|
|
indvdum@0
|
155 |
$this->tpl_name = 'ucp_agreement';
|
|
indvdum@0
|
156 |
return;
|
|
indvdum@0
|
157 |
}
|
|
indvdum@0
|
158 |
|
|
indvdum@0
|
159 |
|
|
indvdum@0
|
160 |
// The CAPTCHA kicks in here. We can't help that the information gets lost on language change.
|
|
indvdum@0
|
161 |
if ($config['enable_confirm'])
|
|
indvdum@0
|
162 |
{
|
|
indvdum@0
|
163 |
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
|
indvdum@0
|
164 |
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
|
|
indvdum@0
|
165 |
$captcha->init(CONFIRM_REG);
|
|
indvdum@0
|
166 |
}
|
|
indvdum@0
|
167 |
|
|
indvdum@0
|
168 |
// Try to manually determine the timezone and adjust the dst if the server date/time complies with the default setting +/- 1
|
|
indvdum@0
|
169 |
$timezone = date('Z') / 3600;
|
|
indvdum@0
|
170 |
$is_dst = date('I');
|
|
indvdum@0
|
171 |
|
|
indvdum@0
|
172 |
if ($config['board_timezone'] == $timezone || $config['board_timezone'] == ($timezone - 1))
|
|
indvdum@0
|
173 |
{
|
|
indvdum@0
|
174 |
$timezone = ($is_dst) ? $timezone - 1 : $timezone;
|
|
indvdum@0
|
175 |
|
|
indvdum@0
|
176 |
if (!isset($user->lang['tz_zones'][(string) $timezone]))
|
|
indvdum@0
|
177 |
{
|
|
indvdum@0
|
178 |
$timezone = $config['board_timezone'];
|
|
indvdum@0
|
179 |
}
|
|
indvdum@0
|
180 |
}
|
|
indvdum@0
|
181 |
else
|
|
indvdum@0
|
182 |
{
|
|
indvdum@0
|
183 |
$is_dst = $config['board_dst'];
|
|
indvdum@0
|
184 |
$timezone = $config['board_timezone'];
|
|
indvdum@0
|
185 |
}
|
|
indvdum@0
|
186 |
|
|
indvdum@0
|
187 |
$data = array(
|
|
indvdum@0
|
188 |
'username' => utf8_normalize_nfc(request_var('username', '', true)),
|
|
indvdum@0
|
189 |
'new_password' => request_var('new_password', '', true),
|
|
indvdum@0
|
190 |
'password_confirm' => request_var('password_confirm', '', true),
|
|
indvdum@0
|
191 |
'email' => strtolower(request_var('email', '')),
|
|
indvdum@0
|
192 |
'email_confirm' => strtolower(request_var('email_confirm', '')),
|
|
indvdum@0
|
193 |
'lang' => basename(request_var('lang', $user->lang_name)),
|
|
indvdum@0
|
194 |
'tz' => request_var('tz', (float) $timezone),
|
|
indvdum@0
|
195 |
);
|
|
indvdum@0
|
196 |
|
|
indvdum@0
|
197 |
// Check and initialize some variables if needed
|
|
indvdum@0
|
198 |
if ($submit)
|
|
indvdum@0
|
199 |
{
|
|
indvdum@0
|
200 |
$error = validate_data($data, array(
|
|
indvdum@0
|
201 |
'username' => array(
|
|
indvdum@0
|
202 |
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
|
|
indvdum@0
|
203 |
array('username', '')),
|
|
indvdum@0
|
204 |
'new_password' => array(
|
|
indvdum@0
|
205 |
array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
|
|
indvdum@0
|
206 |
array('password')),
|
|
indvdum@0
|
207 |
'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
|
|
indvdum@0
|
208 |
'email' => array(
|
|
indvdum@0
|
209 |
array('string', false, 6, 60),
|
|
indvdum@0
|
210 |
array('email')),
|
|
indvdum@0
|
211 |
'email_confirm' => array('string', false, 6, 60),
|
|
indvdum@0
|
212 |
'tz' => array('num', false, -14, 14),
|
|
indvdum@0
|
213 |
'lang' => array('language_iso_name'),
|
|
indvdum@0
|
214 |
));
|
|
indvdum@0
|
215 |
|
|
indvdum@0
|
216 |
if (!check_form_key('ucp_register'))
|
|
indvdum@0
|
217 |
{
|
|
indvdum@0
|
218 |
$error[] = $user->lang['FORM_INVALID'];
|
|
indvdum@0
|
219 |
}
|
|
indvdum@0
|
220 |
|
|
indvdum@0
|
221 |
// Replace "error" strings with their real, localised form
|
|
indvdum@0
|
222 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
indvdum@0
|
223 |
|
|
indvdum@0
|
224 |
if ($config['enable_confirm'])
|
|
indvdum@0
|
225 |
{
|
|
indvdum@0
|
226 |
$vc_response = $captcha->validate($data);
|
|
indvdum@0
|
227 |
if ($vc_response !== false)
|
|
indvdum@0
|
228 |
{
|
|
indvdum@0
|
229 |
$error[] = $vc_response;
|
|
indvdum@0
|
230 |
}
|
|
indvdum@0
|
231 |
|
|
indvdum@0
|
232 |
if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts'])
|
|
indvdum@0
|
233 |
{
|
|
indvdum@0
|
234 |
$error[] = $user->lang['TOO_MANY_REGISTERS'];
|
|
indvdum@0
|
235 |
}
|
|
indvdum@0
|
236 |
}
|
|
indvdum@0
|
237 |
|
|
indvdum@0
|
238 |
// DNSBL check
|
|
indvdum@0
|
239 |
if ($config['check_dnsbl'])
|
|
indvdum@0
|
240 |
{
|
|
indvdum@0
|
241 |
if (($dnsbl = $user->check_dnsbl('register')) !== false)
|
|
indvdum@0
|
242 |
{
|
|
indvdum@0
|
243 |
$error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]);
|
|
indvdum@0
|
244 |
}
|
|
indvdum@0
|
245 |
}
|
|
indvdum@0
|
246 |
|
|
indvdum@0
|
247 |
// validate custom profile fields
|
|
indvdum@0
|
248 |
$cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error);
|
|
indvdum@0
|
249 |
|
|
indvdum@0
|
250 |
if (!sizeof($error))
|
|
indvdum@0
|
251 |
{
|
|
indvdum@0
|
252 |
if ($data['new_password'] != $data['password_confirm'])
|
|
indvdum@0
|
253 |
{
|
|
indvdum@0
|
254 |
$error[] = $user->lang['NEW_PASSWORD_ERROR'];
|
|
indvdum@0
|
255 |
}
|
|
indvdum@0
|
256 |
|
|
indvdum@0
|
257 |
if ($data['email'] != $data['email_confirm'])
|
|
indvdum@0
|
258 |
{
|
|
indvdum@0
|
259 |
$error[] = $user->lang['NEW_EMAIL_ERROR'];
|
|
indvdum@0
|
260 |
}
|
|
indvdum@0
|
261 |
}
|
|
indvdum@0
|
262 |
|
|
indvdum@0
|
263 |
if (!sizeof($error))
|
|
indvdum@0
|
264 |
{
|
|
indvdum@0
|
265 |
$server_url = generate_board_url();
|
|
indvdum@0
|
266 |
|
|
indvdum@0
|
267 |
// Which group by default?
|
|
indvdum@0
|
268 |
$group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';
|
|
indvdum@0
|
269 |
|
|
indvdum@0
|
270 |
$sql = 'SELECT group_id
|
|
indvdum@0
|
271 |
FROM ' . GROUPS_TABLE . "
|
|
indvdum@0
|
272 |
WHERE group_name = '" . $db->sql_escape($group_name) . "'
|
|
indvdum@0
|
273 |
AND group_type = " . GROUP_SPECIAL;
|
|
indvdum@0
|
274 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
275 |
$row = $db->sql_fetchrow($result);
|
|
indvdum@0
|
276 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
277 |
|
|
indvdum@0
|
278 |
if (!$row)
|
|
indvdum@0
|
279 |
{
|
|
indvdum@0
|
280 |
trigger_error('NO_GROUP');
|
|
indvdum@0
|
281 |
}
|
|
indvdum@0
|
282 |
|
|
indvdum@0
|
283 |
$group_id = $row['group_id'];
|
|
indvdum@0
|
284 |
|
|
indvdum@0
|
285 |
if (($coppa ||
|
|
indvdum@0
|
286 |
$config['require_activation'] == USER_ACTIVATION_SELF ||
|
|
indvdum@0
|
287 |
$config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable'])
|
|
indvdum@0
|
288 |
{
|
|
indvdum@0
|
289 |
$user_actkey = gen_rand_string(mt_rand(6, 10));
|
|
indvdum@0
|
290 |
$user_type = USER_INACTIVE;
|
|
indvdum@0
|
291 |
$user_inactive_reason = INACTIVE_REGISTER;
|
|
indvdum@0
|
292 |
$user_inactive_time = time();
|
|
indvdum@0
|
293 |
}
|
|
indvdum@0
|
294 |
else
|
|
indvdum@0
|
295 |
{
|
|
indvdum@0
|
296 |
$user_type = USER_NORMAL;
|
|
indvdum@0
|
297 |
$user_actkey = '';
|
|
indvdum@0
|
298 |
$user_inactive_reason = 0;
|
|
indvdum@0
|
299 |
$user_inactive_time = 0;
|
|
indvdum@0
|
300 |
}
|
|
indvdum@0
|
301 |
|
|
indvdum@0
|
302 |
$user_row = array(
|
|
indvdum@0
|
303 |
'username' => $data['username'],
|
|
indvdum@0
|
304 |
'user_password' => phpbb_hash($data['new_password']),
|
|
indvdum@0
|
305 |
'user_email' => $data['email'],
|
|
indvdum@0
|
306 |
'group_id' => (int) $group_id,
|
|
indvdum@0
|
307 |
'user_timezone' => (float) $data['tz'],
|
|
indvdum@0
|
308 |
'user_dst' => $is_dst,
|
|
indvdum@0
|
309 |
'user_lang' => $data['lang'],
|
|
indvdum@0
|
310 |
'user_type' => $user_type,
|
|
indvdum@0
|
311 |
'user_actkey' => $user_actkey,
|
|
indvdum@0
|
312 |
'user_ip' => $user->ip,
|
|
indvdum@0
|
313 |
'user_regdate' => time(),
|
|
indvdum@0
|
314 |
'user_inactive_reason' => $user_inactive_reason,
|
|
indvdum@0
|
315 |
'user_inactive_time' => $user_inactive_time,
|
|
indvdum@0
|
316 |
);
|
|
indvdum@0
|
317 |
|
|
indvdum@0
|
318 |
if ($config['new_member_post_limit'])
|
|
indvdum@0
|
319 |
{
|
|
indvdum@0
|
320 |
$user_row['user_new'] = 1;
|
|
indvdum@0
|
321 |
}
|
|
indvdum@0
|
322 |
|
|
indvdum@0
|
323 |
// Register user...
|
|
indvdum@0
|
324 |
$user_id = user_add($user_row, $cp_data);
|
|
indvdum@0
|
325 |
|
|
indvdum@0
|
326 |
// This should not happen, because the required variables are listed above...
|
|
indvdum@0
|
327 |
if ($user_id === false)
|
|
indvdum@0
|
328 |
{
|
|
indvdum@0
|
329 |
trigger_error('NO_USER', E_USER_ERROR);
|
|
indvdum@0
|
330 |
}
|
|
indvdum@0
|
331 |
|
|
indvdum@0
|
332 |
// Okay, captcha, your job is done.
|
|
indvdum@0
|
333 |
if ($config['enable_confirm'] && isset($captcha))
|
|
indvdum@0
|
334 |
{
|
|
indvdum@0
|
335 |
$captcha->reset();
|
|
indvdum@0
|
336 |
}
|
|
indvdum@0
|
337 |
|
|
indvdum@0
|
338 |
if ($coppa && $config['email_enable'])
|
|
indvdum@0
|
339 |
{
|
|
indvdum@0
|
340 |
$message = $user->lang['ACCOUNT_COPPA'];
|
|
indvdum@0
|
341 |
$email_template = 'coppa_welcome_inactive';
|
|
indvdum@0
|
342 |
}
|
|
indvdum@0
|
343 |
else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable'])
|
|
indvdum@0
|
344 |
{
|
|
indvdum@0
|
345 |
$message = $user->lang['ACCOUNT_INACTIVE'];
|
|
indvdum@0
|
346 |
$email_template = 'user_welcome_inactive';
|
|
indvdum@0
|
347 |
}
|
|
indvdum@0
|
348 |
else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable'])
|
|
indvdum@0
|
349 |
{
|
|
indvdum@0
|
350 |
$message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
|
|
indvdum@0
|
351 |
$email_template = 'admin_welcome_inactive';
|
|
indvdum@0
|
352 |
}
|
|
indvdum@0
|
353 |
else
|
|
indvdum@0
|
354 |
{
|
|
indvdum@0
|
355 |
$message = $user->lang['ACCOUNT_ADDED'];
|
|
indvdum@0
|
356 |
$email_template = 'user_welcome';
|
|
indvdum@0
|
357 |
}
|
|
indvdum@0
|
358 |
|
|
indvdum@0
|
359 |
if ($config['email_enable'])
|
|
indvdum@0
|
360 |
{
|
|
indvdum@0
|
361 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
indvdum@0
|
362 |
|
|
indvdum@0
|
363 |
$messenger = new messenger(false);
|
|
indvdum@0
|
364 |
|
|
indvdum@0
|
365 |
$messenger->template($email_template, $data['lang']);
|
|
indvdum@0
|
366 |
|
|
indvdum@0
|
367 |
$messenger->to($data['email'], $data['username']);
|
|
indvdum@0
|
368 |
|
|
indvdum@0
|
369 |
$messenger->anti_abuse_headers($config, $user);
|
|
indvdum@0
|
370 |
|
|
indvdum@0
|
371 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
372 |
'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
|
|
indvdum@0
|
373 |
'USERNAME' => htmlspecialchars_decode($data['username']),
|
|
indvdum@0
|
374 |
'PASSWORD' => htmlspecialchars_decode($data['new_password']),
|
|
indvdum@0
|
375 |
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
|
|
indvdum@0
|
376 |
);
|
|
indvdum@0
|
377 |
|
|
indvdum@0
|
378 |
if ($coppa)
|
|
indvdum@0
|
379 |
{
|
|
indvdum@0
|
380 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
381 |
'FAX_INFO' => $config['coppa_fax'],
|
|
indvdum@0
|
382 |
'MAIL_INFO' => $config['coppa_mail'],
|
|
indvdum@0
|
383 |
'EMAIL_ADDRESS' => $data['email'])
|
|
indvdum@0
|
384 |
);
|
|
indvdum@0
|
385 |
}
|
|
indvdum@0
|
386 |
|
|
indvdum@0
|
387 |
$messenger->send(NOTIFY_EMAIL);
|
|
indvdum@0
|
388 |
|
|
indvdum@0
|
389 |
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
|
|
indvdum@0
|
390 |
{
|
|
indvdum@0
|
391 |
// Grab an array of user_id's with a_user permissions ... these users can activate a user
|
|
indvdum@0
|
392 |
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
|
|
indvdum@0
|
393 |
$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
|
|
indvdum@0
|
394 |
|
|
indvdum@0
|
395 |
// Also include founders
|
|
indvdum@0
|
396 |
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
|
|
indvdum@0
|
397 |
|
|
indvdum@0
|
398 |
if (sizeof($admin_ary))
|
|
indvdum@0
|
399 |
{
|
|
indvdum@0
|
400 |
$where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
|
|
indvdum@0
|
401 |
}
|
|
indvdum@0
|
402 |
|
|
indvdum@0
|
403 |
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
|
|
indvdum@0
|
404 |
FROM ' . USERS_TABLE . ' ' .
|
|
indvdum@0
|
405 |
$where_sql;
|
|
indvdum@0
|
406 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
407 |
|
|
indvdum@0
|
408 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
409 |
{
|
|
indvdum@0
|
410 |
$messenger->template('admin_activate', $row['user_lang']);
|
|
indvdum@0
|
411 |
$messenger->to($row['user_email'], $row['username']);
|
|
indvdum@0
|
412 |
$messenger->im($row['user_jabber'], $row['username']);
|
|
indvdum@0
|
413 |
|
|
indvdum@0
|
414 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
415 |
'USERNAME' => htmlspecialchars_decode($data['username']),
|
|
indvdum@0
|
416 |
'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
|
|
indvdum@0
|
417 |
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
|
|
indvdum@0
|
418 |
);
|
|
indvdum@0
|
419 |
|
|
indvdum@0
|
420 |
$messenger->send($row['user_notify_type']);
|
|
indvdum@0
|
421 |
}
|
|
indvdum@0
|
422 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
423 |
}
|
|
indvdum@0
|
424 |
}
|
|
indvdum@0
|
425 |
|
|
indvdum@0
|
426 |
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
|
|
indvdum@0
|
427 |
trigger_error($message);
|
|
indvdum@0
|
428 |
}
|
|
indvdum@0
|
429 |
}
|
|
indvdum@0
|
430 |
|
|
indvdum@0
|
431 |
$s_hidden_fields = array(
|
|
indvdum@0
|
432 |
'agreed' => 'true',
|
|
indvdum@0
|
433 |
'change_lang' => 0,
|
|
indvdum@0
|
434 |
);
|
|
indvdum@0
|
435 |
|
|
indvdum@0
|
436 |
if ($config['coppa_enable'])
|
|
indvdum@0
|
437 |
{
|
|
indvdum@0
|
438 |
$s_hidden_fields['coppa'] = $coppa;
|
|
indvdum@0
|
439 |
}
|
|
indvdum@0
|
440 |
|
|
indvdum@0
|
441 |
if ($config['enable_confirm'])
|
|
indvdum@0
|
442 |
{
|
|
indvdum@0
|
443 |
$s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields());
|
|
indvdum@0
|
444 |
}
|
|
indvdum@0
|
445 |
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
|
|
indvdum@0
|
446 |
$confirm_image = '';
|
|
indvdum@0
|
447 |
|
|
indvdum@0
|
448 |
// Visual Confirmation - Show images
|
|
indvdum@0
|
449 |
if ($config['enable_confirm'])
|
|
indvdum@0
|
450 |
{
|
|
indvdum@0
|
451 |
$template->assign_vars(array(
|
|
indvdum@0
|
452 |
'CAPTCHA_TEMPLATE' => $captcha->get_template(),
|
|
indvdum@0
|
453 |
));
|
|
indvdum@0
|
454 |
}
|
|
indvdum@0
|
455 |
|
|
indvdum@0
|
456 |
//
|
|
indvdum@0
|
457 |
$l_reg_cond = '';
|
|
indvdum@0
|
458 |
switch ($config['require_activation'])
|
|
indvdum@0
|
459 |
{
|
|
indvdum@0
|
460 |
case USER_ACTIVATION_SELF:
|
|
indvdum@0
|
461 |
$l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE'];
|
|
indvdum@0
|
462 |
break;
|
|
indvdum@0
|
463 |
|
|
indvdum@0
|
464 |
case USER_ACTIVATION_ADMIN:
|
|
indvdum@0
|
465 |
$l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE'];
|
|
indvdum@0
|
466 |
break;
|
|
indvdum@0
|
467 |
}
|
|
indvdum@0
|
468 |
|
|
indvdum@0
|
469 |
$template->assign_vars(array(
|
|
indvdum@0
|
470 |
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
indvdum@0
|
471 |
'USERNAME' => $data['username'],
|
|
indvdum@0
|
472 |
'PASSWORD' => $data['new_password'],
|
|
indvdum@0
|
473 |
'PASSWORD_CONFIRM' => $data['password_confirm'],
|
|
indvdum@0
|
474 |
'EMAIL' => $data['email'],
|
|
indvdum@0
|
475 |
'EMAIL_CONFIRM' => $data['email_confirm'],
|
|
indvdum@0
|
476 |
|
|
indvdum@0
|
477 |
'L_REG_COND' => $l_reg_cond,
|
|
indvdum@0
|
478 |
'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
|
|
indvdum@0
|
479 |
'L_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
|
|
indvdum@0
|
480 |
|
|
indvdum@0
|
481 |
'S_LANG_OPTIONS' => language_select($data['lang']),
|
|
indvdum@0
|
482 |
'S_TZ_OPTIONS' => tz_select($data['tz']),
|
|
indvdum@0
|
483 |
'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false,
|
|
indvdum@0
|
484 |
'S_REGISTRATION' => true,
|
|
indvdum@0
|
485 |
'S_COPPA' => $coppa,
|
|
indvdum@0
|
486 |
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
|
indvdum@0
|
487 |
'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
|
|
indvdum@0
|
488 |
));
|
|
indvdum@0
|
489 |
|
|
indvdum@0
|
490 |
//
|
|
indvdum@0
|
491 |
$user->profile_fields = array();
|
|
indvdum@0
|
492 |
|
|
indvdum@0
|
493 |
// Generate profile fields -> Template Block Variable profile_fields
|
|
indvdum@0
|
494 |
$cp->generate_profile_fields('register', $user->get_iso_lang_id());
|
|
indvdum@0
|
495 |
|
|
indvdum@0
|
496 |
//
|
|
indvdum@0
|
497 |
$this->tpl_name = 'ucp_register';
|
|
indvdum@0
|
498 |
$this->page_title = 'UCP_REGISTRATION';
|
|
indvdum@0
|
499 |
}
|
|
indvdum@0
|
500 |
}
|
|
indvdum@0
|
501 |
|
|
indvdum@0
|
502 |
?> |