|
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_resend
|
|
indvdum@0
|
21 |
* Resending activation emails
|
|
indvdum@0
|
22 |
* @package ucp
|
|
indvdum@0
|
23 |
*/
|
|
indvdum@0
|
24 |
class ucp_resend
|
|
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, $phpbb_root_path, $phpEx;
|
|
indvdum@0
|
31 |
global $db, $user, $auth, $template;
|
|
indvdum@0
|
32 |
|
|
indvdum@0
|
33 |
$username = request_var('username', '', true);
|
|
indvdum@0
|
34 |
$email = strtolower(request_var('email', ''));
|
|
indvdum@0
|
35 |
$submit = (isset($_POST['submit'])) ? true : false;
|
|
indvdum@0
|
36 |
|
|
indvdum@0
|
37 |
add_form_key('ucp_resend');
|
|
indvdum@0
|
38 |
|
|
indvdum@0
|
39 |
if ($submit)
|
|
indvdum@0
|
40 |
{
|
|
indvdum@0
|
41 |
if (!check_form_key('ucp_resend'))
|
|
indvdum@0
|
42 |
{
|
|
indvdum@0
|
43 |
trigger_error('FORM_INVALID');
|
|
indvdum@0
|
44 |
}
|
|
indvdum@0
|
45 |
|
|
indvdum@0
|
46 |
$sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason
|
|
indvdum@0
|
47 |
FROM ' . USERS_TABLE . "
|
|
indvdum@0
|
48 |
WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
|
|
indvdum@0
|
49 |
AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
|
|
indvdum@0
|
50 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
51 |
$user_row = $db->sql_fetchrow($result);
|
|
indvdum@0
|
52 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
53 |
|
|
indvdum@0
|
54 |
if (!$user_row)
|
|
indvdum@0
|
55 |
{
|
|
indvdum@0
|
56 |
trigger_error('NO_EMAIL_USER');
|
|
indvdum@0
|
57 |
}
|
|
indvdum@0
|
58 |
|
|
indvdum@0
|
59 |
if ($user_row['user_type'] == USER_IGNORE)
|
|
indvdum@0
|
60 |
{
|
|
indvdum@0
|
61 |
trigger_error('NO_USER');
|
|
indvdum@0
|
62 |
}
|
|
indvdum@0
|
63 |
|
|
indvdum@0
|
64 |
if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE)
|
|
indvdum@0
|
65 |
{
|
|
indvdum@0
|
66 |
trigger_error('ACCOUNT_ALREADY_ACTIVATED');
|
|
indvdum@0
|
67 |
}
|
|
indvdum@0
|
68 |
|
|
indvdum@0
|
69 |
if (!$user_row['user_actkey'] || ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL))
|
|
indvdum@0
|
70 |
{
|
|
indvdum@0
|
71 |
trigger_error('ACCOUNT_DEACTIVATED');
|
|
indvdum@0
|
72 |
}
|
|
indvdum@0
|
73 |
|
|
indvdum@0
|
74 |
// Determine coppa status on group (REGISTERED(_COPPA))
|
|
indvdum@0
|
75 |
$sql = 'SELECT group_name, group_type
|
|
indvdum@0
|
76 |
FROM ' . GROUPS_TABLE . '
|
|
indvdum@0
|
77 |
WHERE group_id = ' . $user_row['group_id'];
|
|
indvdum@0
|
78 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
79 |
$row = $db->sql_fetchrow($result);
|
|
indvdum@0
|
80 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
81 |
|
|
indvdum@0
|
82 |
if (!$row)
|
|
indvdum@0
|
83 |
{
|
|
indvdum@0
|
84 |
trigger_error('NO_GROUP');
|
|
indvdum@0
|
85 |
}
|
|
indvdum@0
|
86 |
|
|
indvdum@0
|
87 |
$coppa = ($row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL) ? true : false;
|
|
indvdum@0
|
88 |
|
|
indvdum@0
|
89 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
indvdum@0
|
90 |
$messenger = new messenger(false);
|
|
indvdum@0
|
91 |
|
|
indvdum@0
|
92 |
if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa)
|
|
indvdum@0
|
93 |
{
|
|
indvdum@0
|
94 |
$messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']);
|
|
indvdum@0
|
95 |
$messenger->to($user_row['user_email'], $user_row['username']);
|
|
indvdum@0
|
96 |
|
|
indvdum@0
|
97 |
$messenger->anti_abuse_headers($config, $user);
|
|
indvdum@0
|
98 |
|
|
indvdum@0
|
99 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
100 |
'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
|
|
indvdum@0
|
101 |
'USERNAME' => htmlspecialchars_decode($user_row['username']),
|
|
indvdum@0
|
102 |
'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}")
|
|
indvdum@0
|
103 |
);
|
|
indvdum@0
|
104 |
|
|
indvdum@0
|
105 |
if ($coppa)
|
|
indvdum@0
|
106 |
{
|
|
indvdum@0
|
107 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
108 |
'FAX_INFO' => $config['coppa_fax'],
|
|
indvdum@0
|
109 |
'MAIL_INFO' => $config['coppa_mail'],
|
|
indvdum@0
|
110 |
'EMAIL_ADDRESS' => $user_row['user_email'])
|
|
indvdum@0
|
111 |
);
|
|
indvdum@0
|
112 |
}
|
|
indvdum@0
|
113 |
|
|
indvdum@0
|
114 |
$messenger->send(NOTIFY_EMAIL);
|
|
indvdum@0
|
115 |
}
|
|
indvdum@0
|
116 |
|
|
indvdum@0
|
117 |
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
|
|
indvdum@0
|
118 |
{
|
|
indvdum@0
|
119 |
// Grab an array of user_id's with a_user permissions ... these users can activate a user
|
|
indvdum@0
|
120 |
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
|
|
indvdum@0
|
121 |
|
|
indvdum@0
|
122 |
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
|
|
indvdum@0
|
123 |
FROM ' . USERS_TABLE . '
|
|
indvdum@0
|
124 |
WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']);
|
|
indvdum@0
|
125 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
126 |
|
|
indvdum@0
|
127 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
128 |
{
|
|
indvdum@0
|
129 |
$messenger->template('admin_activate', $row['user_lang']);
|
|
indvdum@0
|
130 |
$messenger->to($row['user_email'], $row['username']);
|
|
indvdum@0
|
131 |
$messenger->im($row['user_jabber'], $row['username']);
|
|
indvdum@0
|
132 |
|
|
indvdum@0
|
133 |
$messenger->anti_abuse_headers($config, $user);
|
|
indvdum@0
|
134 |
|
|
indvdum@0
|
135 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
136 |
'USERNAME' => htmlspecialchars_decode($user_row['username']),
|
|
indvdum@0
|
137 |
'U_USER_DETAILS' => generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}",
|
|
indvdum@0
|
138 |
'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}")
|
|
indvdum@0
|
139 |
);
|
|
indvdum@0
|
140 |
|
|
indvdum@0
|
141 |
$messenger->send($row['user_notify_type']);
|
|
indvdum@0
|
142 |
}
|
|
indvdum@0
|
143 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
144 |
}
|
|
indvdum@0
|
145 |
|
|
indvdum@0
|
146 |
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
|
|
indvdum@0
|
147 |
|
|
indvdum@0
|
148 |
$message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT'];
|
|
indvdum@0
|
149 |
$message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
|
|
indvdum@0
|
150 |
trigger_error($message);
|
|
indvdum@0
|
151 |
}
|
|
indvdum@0
|
152 |
|
|
indvdum@0
|
153 |
$template->assign_vars(array(
|
|
indvdum@0
|
154 |
'USERNAME' => $username,
|
|
indvdum@0
|
155 |
'EMAIL' => $email,
|
|
indvdum@0
|
156 |
'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act'))
|
|
indvdum@0
|
157 |
);
|
|
indvdum@0
|
158 |
|
|
indvdum@0
|
159 |
$this->tpl_name = 'ucp_resend';
|
|
indvdum@0
|
160 |
$this->page_title = 'UCP_RESEND';
|
|
indvdum@0
|
161 |
}
|
|
indvdum@0
|
162 |
}
|
|
indvdum@0
|
163 |
|
|
indvdum@0
|
164 |
?> |