443
by dcoles
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0 |
1 |
<?php
|
2 |
/**
|
|
3 |
*
|
|
4 |
* @package ucp
|
|
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
|
|
8 |
*
|
|
9 |
*/
|
|
10 |
||
11 |
/**
|
|
12 |
* @ignore
|
|
13 |
*/
|
|
14 |
if (!defined('IN_PHPBB')) |
|
15 |
{
|
|
16 |
exit; |
|
17 |
}
|
|
18 |
||
19 |
/**
|
|
20 |
* ucp_resend
|
|
21 |
* Resending activation emails
|
|
22 |
* @package ucp
|
|
23 |
*/
|
|
24 |
class ucp_resend |
|
25 |
{
|
|
26 |
var $u_action; |
|
27 |
||
28 |
function main($id, $mode) |
|
29 |
{
|
|
30 |
global $config, $phpbb_root_path, $phpEx; |
|
31 |
global $db, $user, $auth, $template; |
|
32 |
||
33 |
$username = request_var('username', '', true); |
|
34 |
$email = strtolower(request_var('email', '')); |
|
35 |
$submit = (isset($_POST['submit'])) ? true : false; |
|
36 |
||
37 |
add_form_key('ucp_resend'); |
|
38 |
||
39 |
if ($submit) |
|
40 |
{
|
|
41 |
if (!check_form_key('ucp_resend')) |
|
42 |
{
|
|
43 |
trigger_error('FORM_INVALID'); |
|
44 |
}
|
|
45 |
||
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); |
|
53 |
||
54 |
if (!$user_row) |
|
55 |
{
|
|
56 |
trigger_error('NO_EMAIL_USER'); |
|
57 |
}
|
|
58 |
||
59 |
if ($user_row['user_type'] == USER_IGNORE) |
|
60 |
{
|
|
61 |
trigger_error('NO_USER'); |
|
62 |
}
|
|
63 |
||
64 |
if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE) |
|
65 |
{
|
|
66 |
trigger_error('ACCOUNT_ALREADY_ACTIVATED'); |
|
67 |
}
|
|
68 |
||
69 |
if (!$user_row['user_actkey'] || ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL)) |
|
70 |
{
|
|
71 |
trigger_error('ACCOUNT_DEACTIVATED'); |
|
72 |
}
|
|
73 |
||
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); |
|
81 |
||
82 |
if (!$row) |
|
83 |
{
|
|
84 |
trigger_error('NO_GROUP'); |
|
85 |
}
|
|
86 |
||
87 |
$coppa = ($row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL) ? true : false; |
|
88 |
||
89 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); |
|
90 |
$messenger = new messenger(false); |
|
91 |
||
92 |
if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa) |
|
93 |
{
|
|
94 |
$messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']); |
|
95 |
$messenger->to($user_row['user_email'], $user_row['username']); |
|
96 |
||
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); |
|
101 |
||
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']}") |
|
106 |
);
|
|
107 |
||
108 |
if ($coppa) |
|
109 |
{
|
|
110 |
$messenger->assign_vars(array( |
|
111 |
'FAX_INFO' => $config['coppa_fax'], |
|
112 |
'MAIL_INFO' => $config['coppa_mail'], |
|
113 |
'EMAIL_ADDRESS' => $user_row['user_email']) |
|
114 |
);
|
|
115 |
}
|
|
116 |
||
117 |
$messenger->send(NOTIFY_EMAIL); |
|
118 |
}
|
|
119 |
||
120 |
if ($config['require_activation'] == USER_ACTIVATION_ADMIN) |
|
121 |
{
|
|
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); |
|
124 |
||
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); |
|
129 |
||
130 |
while ($row = $db->sql_fetchrow($result)) |
|
131 |
{
|
|
132 |
$messenger->template('admin_activate', $row['user_lang']); |
|
133 |
$messenger->to($row['user_email'], $row['username']); |
|
134 |
$messenger->im($row['user_jabber'], $row['username']); |
|
135 |
||
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']}") |
|
140 |
);
|
|
141 |
||
142 |
$messenger->send($row['user_notify_type']); |
|
143 |
}
|
|
144 |
$db->sql_freeresult($result); |
|
145 |
}
|
|
146 |
||
147 |
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); |
|
148 |
||
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); |
|
152 |
}
|
|
153 |
||
154 |
$template->assign_vars(array( |
|
155 |
'USERNAME' => $username, |
|
156 |
'EMAIL' => $email, |
|
157 |
'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act')) |
|
158 |
);
|
|
159 |
||
160 |
$this->tpl_name = 'ucp_resend'; |
|
161 |
$this->page_title = 'UCP_RESEND'; |
|
162 |
}
|
|
163 |
}
|
|
164 |
||
165 |
?>
|