5
* @version $Id: ucp_resend.php,v 1.27 2007/10/08 14:38:08 acydburn Exp $
6
* @copyright (c) 2005 phpBB Group
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
14
if (!defined('IN_PHPBB'))
21
* Resending activation emails
28
function main($id, $mode)
30
global $config, $phpbb_root_path, $phpEx;
31
global $db, $user, $auth, $template;
33
$username = request_var('username', '', true);
34
$email = strtolower(request_var('email', ''));
35
$submit = (isset($_POST['submit'])) ? true : false;
37
add_form_key('ucp_resend');
41
if (!check_form_key('ucp_resend'))
43
trigger_error('FORM_INVALID');
46
$sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason
47
FROM ' . USERS_TABLE . "
48
WHERE user_email = '" . $db->sql_escape($email) . "'
49
AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
50
$result = $db->sql_query($sql);
51
$user_row = $db->sql_fetchrow($result);
52
$db->sql_freeresult($result);
56
trigger_error('NO_EMAIL_USER');
59
if ($user_row['user_type'] == USER_IGNORE)
61
trigger_error('NO_USER');
64
if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE)
66
trigger_error('ACCOUNT_ALREADY_ACTIVATED');
69
if (!$user_row['user_actkey'] || ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL))
71
trigger_error('ACCOUNT_DEACTIVATED');
74
// Determine coppa status on group (REGISTERED(_COPPA))
75
$sql = 'SELECT group_name, group_type
76
FROM ' . GROUPS_TABLE . '
77
WHERE group_id = ' . $user_row['group_id'];
78
$result = $db->sql_query($sql);
79
$row = $db->sql_fetchrow($result);
80
$db->sql_freeresult($result);
84
trigger_error('NO_GROUP');
87
$coppa = ($row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL) ? true : false;
89
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
90
$messenger = new messenger(false);
92
if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa)
94
$messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']);
95
$messenger->to($user_row['user_email'], $user_row['username']);
97
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
98
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
99
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
100
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
102
$messenger->assign_vars(array(
103
'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
104
'USERNAME' => htmlspecialchars_decode($user_row['username']),
105
'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}")
110
$messenger->assign_vars(array(
111
'FAX_INFO' => $config['coppa_fax'],
112
'MAIL_INFO' => $config['coppa_mail'],
113
'EMAIL_ADDRESS' => $user_row['user_email'])
117
$messenger->send(NOTIFY_EMAIL);
120
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
122
// Grab an array of user_id's with a_user permissions ... these users can activate a user
123
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
125
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
126
FROM ' . USERS_TABLE . '
127
WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']);
128
$result = $db->sql_query($sql);
130
while ($row = $db->sql_fetchrow($result))
132
$messenger->template('admin_activate', $row['user_lang']);
133
$messenger->to($row['user_email'], $row['username']);
134
$messenger->im($row['user_jabber'], $row['username']);
136
$messenger->assign_vars(array(
137
'USERNAME' => htmlspecialchars_decode($user_row['username']),
138
'U_USER_DETAILS' => generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}",
139
'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}")
142
$messenger->send($row['user_notify_type']);
144
$db->sql_freeresult($result);
147
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
149
$message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT'];
150
$message .= '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
151
trigger_error($message);
154
$template->assign_vars(array(
155
'USERNAME' => $username,
157
'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act'))
160
$this->tpl_name = 'ucp_resend';
161
$this->page_title = 'UCP_RESEND';
b'\\ No newline at end of file'