|
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_profile
|
|
indvdum@0
|
21 |
* Changing profile settings
|
|
indvdum@0
|
22 |
*
|
|
indvdum@0
|
23 |
* @todo what about pertaining user_sig_options?
|
|
indvdum@0
|
24 |
* @package ucp
|
|
indvdum@0
|
25 |
*/
|
|
indvdum@0
|
26 |
class ucp_profile
|
|
indvdum@0
|
27 |
{
|
|
indvdum@0
|
28 |
var $u_action;
|
|
indvdum@0
|
29 |
|
|
indvdum@0
|
30 |
function main($id, $mode)
|
|
indvdum@0
|
31 |
{
|
|
indvdum@0
|
32 |
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
|
indvdum@0
|
33 |
|
|
indvdum@0
|
34 |
$user->add_lang('posting');
|
|
indvdum@0
|
35 |
|
|
indvdum@0
|
36 |
$preview = (!empty($_POST['preview'])) ? true : false;
|
|
indvdum@0
|
37 |
$submit = (!empty($_POST['submit'])) ? true : false;
|
|
indvdum@0
|
38 |
$delete = (!empty($_POST['delete'])) ? true : false;
|
|
indvdum@0
|
39 |
$error = $data = array();
|
|
indvdum@0
|
40 |
$s_hidden_fields = '';
|
|
indvdum@0
|
41 |
|
|
indvdum@0
|
42 |
switch ($mode)
|
|
indvdum@0
|
43 |
{
|
|
indvdum@0
|
44 |
case 'reg_details':
|
|
indvdum@0
|
45 |
|
|
indvdum@0
|
46 |
$data = array(
|
|
indvdum@0
|
47 |
'username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)),
|
|
indvdum@0
|
48 |
'email' => strtolower(request_var('email', $user->data['user_email'])),
|
|
indvdum@0
|
49 |
'email_confirm' => strtolower(request_var('email_confirm', '')),
|
|
indvdum@0
|
50 |
'new_password' => request_var('new_password', '', true),
|
|
indvdum@0
|
51 |
'cur_password' => request_var('cur_password', '', true),
|
|
indvdum@0
|
52 |
'password_confirm' => request_var('password_confirm', '', true),
|
|
indvdum@0
|
53 |
);
|
|
indvdum@0
|
54 |
|
|
indvdum@0
|
55 |
add_form_key('ucp_reg_details');
|
|
indvdum@0
|
56 |
|
|
indvdum@0
|
57 |
if ($submit)
|
|
indvdum@0
|
58 |
{
|
|
indvdum@0
|
59 |
// Do not check cur_password, it is the old one.
|
|
indvdum@0
|
60 |
$check_ary = array(
|
|
indvdum@0
|
61 |
'new_password' => array(
|
|
indvdum@0
|
62 |
array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
|
indvdum@0
|
63 |
array('password')),
|
|
indvdum@0
|
64 |
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
|
indvdum@0
|
65 |
'email' => array(
|
|
indvdum@0
|
66 |
array('string', false, 6, 60),
|
|
indvdum@0
|
67 |
array('email')),
|
|
indvdum@0
|
68 |
'email_confirm' => array('string', true, 6, 60),
|
|
indvdum@0
|
69 |
);
|
|
indvdum@0
|
70 |
|
|
indvdum@0
|
71 |
if ($auth->acl_get('u_chgname') && $config['allow_namechange'])
|
|
indvdum@0
|
72 |
{
|
|
indvdum@0
|
73 |
$check_ary['username'] = array(
|
|
indvdum@0
|
74 |
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
|
|
indvdum@0
|
75 |
array('username'),
|
|
indvdum@0
|
76 |
);
|
|
indvdum@0
|
77 |
}
|
|
indvdum@0
|
78 |
|
|
indvdum@0
|
79 |
$error = validate_data($data, $check_ary);
|
|
indvdum@0
|
80 |
|
|
indvdum@0
|
81 |
if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email'])
|
|
indvdum@0
|
82 |
{
|
|
indvdum@0
|
83 |
$error[] = ($data['email_confirm']) ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY';
|
|
indvdum@0
|
84 |
}
|
|
indvdum@0
|
85 |
|
|
indvdum@0
|
86 |
if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password'])
|
|
indvdum@0
|
87 |
{
|
|
indvdum@0
|
88 |
$error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY';
|
|
indvdum@0
|
89 |
}
|
|
indvdum@0
|
90 |
|
|
indvdum@0
|
91 |
// Only check the new password against the previous password if there have been no errors
|
|
indvdum@0
|
92 |
if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && phpbb_check_hash($data['new_password'], $user->data['user_password']))
|
|
indvdum@0
|
93 |
{
|
|
indvdum@0
|
94 |
$error[] = 'SAME_PASSWORD_ERROR';
|
|
indvdum@0
|
95 |
}
|
|
indvdum@0
|
96 |
|
|
indvdum@0
|
97 |
if (!phpbb_check_hash($data['cur_password'], $user->data['user_password']))
|
|
indvdum@0
|
98 |
{
|
|
indvdum@0
|
99 |
$error[] = ($data['cur_password']) ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY';
|
|
indvdum@0
|
100 |
}
|
|
indvdum@0
|
101 |
|
|
indvdum@0
|
102 |
if (!check_form_key('ucp_reg_details'))
|
|
indvdum@0
|
103 |
{
|
|
indvdum@0
|
104 |
$error[] = 'FORM_INVALID';
|
|
indvdum@0
|
105 |
}
|
|
indvdum@0
|
106 |
|
|
indvdum@0
|
107 |
if (!sizeof($error))
|
|
indvdum@0
|
108 |
{
|
|
indvdum@0
|
109 |
$sql_ary = array(
|
|
indvdum@0
|
110 |
'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'],
|
|
indvdum@0
|
111 |
'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'],
|
|
indvdum@0
|
112 |
'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'],
|
|
indvdum@0
|
113 |
'user_email_hash' => ($auth->acl_get('u_chgemail')) ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'],
|
|
indvdum@0
|
114 |
'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : $user->data['user_password'],
|
|
indvdum@0
|
115 |
'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0,
|
|
indvdum@0
|
116 |
);
|
|
indvdum@0
|
117 |
|
|
indvdum@0
|
118 |
if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username'])
|
|
indvdum@0
|
119 |
{
|
|
indvdum@0
|
120 |
add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $data['username']);
|
|
indvdum@0
|
121 |
}
|
|
indvdum@0
|
122 |
|
|
indvdum@0
|
123 |
if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !phpbb_check_hash($data['new_password'], $user->data['user_password']))
|
|
indvdum@0
|
124 |
{
|
|
indvdum@0
|
125 |
$user->reset_login_keys();
|
|
indvdum@0
|
126 |
add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $data['username']);
|
|
indvdum@0
|
127 |
}
|
|
indvdum@0
|
128 |
|
|
indvdum@0
|
129 |
if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'])
|
|
indvdum@0
|
130 |
{
|
|
indvdum@0
|
131 |
add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $data['username'], $user->data['user_email'], $data['email']);
|
|
indvdum@0
|
132 |
}
|
|
indvdum@0
|
133 |
|
|
indvdum@0
|
134 |
$message = 'PROFILE_UPDATED';
|
|
indvdum@0
|
135 |
|
|
indvdum@0
|
136 |
if ($auth->acl_get('u_chgemail') && $config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))
|
|
indvdum@0
|
137 |
{
|
|
indvdum@0
|
138 |
$message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';
|
|
indvdum@0
|
139 |
|
|
indvdum@0
|
140 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
indvdum@0
|
141 |
|
|
indvdum@0
|
142 |
$server_url = generate_board_url();
|
|
indvdum@0
|
143 |
|
|
indvdum@0
|
144 |
$user_actkey = gen_rand_string(mt_rand(6, 10));
|
|
indvdum@0
|
145 |
|
|
indvdum@0
|
146 |
$messenger = new messenger(false);
|
|
indvdum@0
|
147 |
|
|
indvdum@0
|
148 |
$template_file = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate';
|
|
indvdum@0
|
149 |
$messenger->template($template_file, $user->data['user_lang']);
|
|
indvdum@0
|
150 |
|
|
indvdum@0
|
151 |
$messenger->to($data['email'], $data['username']);
|
|
indvdum@0
|
152 |
|
|
indvdum@0
|
153 |
$messenger->anti_abuse_headers($config, $user);
|
|
indvdum@0
|
154 |
|
|
indvdum@0
|
155 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
156 |
'USERNAME' => htmlspecialchars_decode($data['username']),
|
|
indvdum@0
|
157 |
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
|
|
indvdum@0
|
158 |
);
|
|
indvdum@0
|
159 |
|
|
indvdum@0
|
160 |
$messenger->send(NOTIFY_EMAIL);
|
|
indvdum@0
|
161 |
|
|
indvdum@0
|
162 |
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
|
|
indvdum@0
|
163 |
{
|
|
indvdum@0
|
164 |
// Grab an array of user_id's with a_user permissions ... these users can activate a user
|
|
indvdum@0
|
165 |
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
|
|
indvdum@0
|
166 |
$admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
|
|
indvdum@0
|
167 |
|
|
indvdum@0
|
168 |
// Also include founders
|
|
indvdum@0
|
169 |
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
|
|
indvdum@0
|
170 |
|
|
indvdum@0
|
171 |
if (sizeof($admin_ary))
|
|
indvdum@0
|
172 |
{
|
|
indvdum@0
|
173 |
$where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
|
|
indvdum@0
|
174 |
}
|
|
indvdum@0
|
175 |
|
|
indvdum@0
|
176 |
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
|
|
indvdum@0
|
177 |
FROM ' . USERS_TABLE . ' ' .
|
|
indvdum@0
|
178 |
$where_sql;
|
|
indvdum@0
|
179 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
180 |
|
|
indvdum@0
|
181 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
182 |
{
|
|
indvdum@0
|
183 |
$messenger->template('admin_activate', $row['user_lang']);
|
|
indvdum@0
|
184 |
$messenger->to($row['user_email'], $row['username']);
|
|
indvdum@0
|
185 |
$messenger->im($row['user_jabber'], $row['username']);
|
|
indvdum@0
|
186 |
|
|
indvdum@0
|
187 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
188 |
'USERNAME' => htmlspecialchars_decode($data['username']),
|
|
indvdum@0
|
189 |
'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u={$user->data['user_id']}",
|
|
indvdum@0
|
190 |
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
|
|
indvdum@0
|
191 |
);
|
|
indvdum@0
|
192 |
|
|
indvdum@0
|
193 |
$messenger->send($row['user_notify_type']);
|
|
indvdum@0
|
194 |
}
|
|
indvdum@0
|
195 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
196 |
}
|
|
indvdum@0
|
197 |
|
|
indvdum@0
|
198 |
user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE);
|
|
indvdum@0
|
199 |
|
|
indvdum@0
|
200 |
// Because we want the profile to be reactivated we set user_newpasswd to empty (else the reactivation will fail)
|
|
indvdum@0
|
201 |
$sql_ary['user_actkey'] = $user_actkey;
|
|
indvdum@0
|
202 |
$sql_ary['user_newpasswd'] = '';
|
|
indvdum@0
|
203 |
}
|
|
indvdum@0
|
204 |
|
|
indvdum@0
|
205 |
if (sizeof($sql_ary))
|
|
indvdum@0
|
206 |
{
|
|
indvdum@0
|
207 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
indvdum@0
|
208 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
indvdum@0
|
209 |
WHERE user_id = ' . $user->data['user_id'];
|
|
indvdum@0
|
210 |
$db->sql_query($sql);
|
|
indvdum@0
|
211 |
}
|
|
indvdum@0
|
212 |
|
|
indvdum@0
|
213 |
// Need to update config, forum, topic, posting, messages, etc.
|
|
indvdum@0
|
214 |
if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])
|
|
indvdum@0
|
215 |
{
|
|
indvdum@0
|
216 |
user_update_name($user->data['username'], $data['username']);
|
|
indvdum@0
|
217 |
}
|
|
indvdum@0
|
218 |
|
|
indvdum@0
|
219 |
// Now, we can remove the user completely (kill the session) - NOT BEFORE!!!
|
|
indvdum@0
|
220 |
if (!empty($sql_ary['user_actkey']))
|
|
indvdum@0
|
221 |
{
|
|
indvdum@0
|
222 |
meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx));
|
|
indvdum@0
|
223 |
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid($phpbb_root_path . 'index.' . $phpEx) . '">', '</a>');
|
|
indvdum@0
|
224 |
|
|
indvdum@0
|
225 |
// Because the user gets deactivated we log him out too, killing his session
|
|
indvdum@0
|
226 |
$user->session_kill();
|
|
indvdum@0
|
227 |
}
|
|
indvdum@0
|
228 |
else
|
|
indvdum@0
|
229 |
{
|
|
indvdum@0
|
230 |
meta_refresh(3, $this->u_action);
|
|
indvdum@0
|
231 |
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
|
indvdum@0
|
232 |
}
|
|
indvdum@0
|
233 |
|
|
indvdum@0
|
234 |
trigger_error($message);
|
|
indvdum@0
|
235 |
}
|
|
indvdum@0
|
236 |
|
|
indvdum@0
|
237 |
// Replace "error" strings with their real, localised form
|
|
indvdum@0
|
238 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
indvdum@0
|
239 |
}
|
|
indvdum@0
|
240 |
|
|
indvdum@0
|
241 |
$template->assign_vars(array(
|
|
indvdum@0
|
242 |
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
indvdum@0
|
243 |
|
|
indvdum@0
|
244 |
'USERNAME' => $data['username'],
|
|
indvdum@0
|
245 |
'EMAIL' => $data['email'],
|
|
indvdum@0
|
246 |
'PASSWORD_CONFIRM' => $data['password_confirm'],
|
|
indvdum@0
|
247 |
'NEW_PASSWORD' => $data['new_password'],
|
|
indvdum@0
|
248 |
'CUR_PASSWORD' => '',
|
|
indvdum@0
|
249 |
|
|
indvdum@0
|
250 |
'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
|
|
indvdum@0
|
251 |
'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
|
|
indvdum@0
|
252 |
|
|
indvdum@0
|
253 |
'S_FORCE_PASSWORD' => ($auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) ? true : false,
|
|
indvdum@0
|
254 |
'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false,
|
|
indvdum@0
|
255 |
'S_CHANGE_EMAIL' => ($auth->acl_get('u_chgemail')) ? true : false,
|
|
indvdum@0
|
256 |
'S_CHANGE_PASSWORD' => ($auth->acl_get('u_chgpasswd')) ? true : false)
|
|
indvdum@0
|
257 |
);
|
|
indvdum@0
|
258 |
break;
|
|
indvdum@0
|
259 |
|
|
indvdum@0
|
260 |
case 'profile_info':
|
|
indvdum@0
|
261 |
|
|
indvdum@0
|
262 |
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
|
indvdum@0
|
263 |
|
|
indvdum@0
|
264 |
$cp = new custom_profile();
|
|
indvdum@0
|
265 |
|
|
indvdum@0
|
266 |
$cp_data = $cp_error = array();
|
|
indvdum@0
|
267 |
|
|
indvdum@0
|
268 |
$data = array(
|
|
indvdum@0
|
269 |
'icq' => request_var('icq', $user->data['user_icq']),
|
|
indvdum@0
|
270 |
'aim' => request_var('aim', $user->data['user_aim']),
|
|
indvdum@0
|
271 |
'msn' => request_var('msn', $user->data['user_msnm']),
|
|
indvdum@0
|
272 |
'yim' => request_var('yim', $user->data['user_yim']),
|
|
indvdum@0
|
273 |
'jabber' => utf8_normalize_nfc(request_var('jabber', $user->data['user_jabber'], true)),
|
|
indvdum@0
|
274 |
'website' => request_var('website', $user->data['user_website']),
|
|
indvdum@0
|
275 |
'location' => utf8_normalize_nfc(request_var('location', $user->data['user_from'], true)),
|
|
indvdum@0
|
276 |
'occupation' => utf8_normalize_nfc(request_var('occupation', $user->data['user_occ'], true)),
|
|
indvdum@0
|
277 |
'interests' => utf8_normalize_nfc(request_var('interests', $user->data['user_interests'], true)),
|
|
indvdum@0
|
278 |
);
|
|
indvdum@0
|
279 |
|
|
indvdum@0
|
280 |
if ($config['allow_birthdays'])
|
|
indvdum@0
|
281 |
{
|
|
indvdum@0
|
282 |
$data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0;
|
|
indvdum@0
|
283 |
|
|
indvdum@0
|
284 |
if ($user->data['user_birthday'])
|
|
indvdum@0
|
285 |
{
|
|
indvdum@0
|
286 |
list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']);
|
|
indvdum@0
|
287 |
}
|
|
indvdum@0
|
288 |
|
|
indvdum@0
|
289 |
$data['bday_day'] = request_var('bday_day', $data['bday_day']);
|
|
indvdum@0
|
290 |
$data['bday_month'] = request_var('bday_month', $data['bday_month']);
|
|
indvdum@0
|
291 |
$data['bday_year'] = request_var('bday_year', $data['bday_year']);
|
|
indvdum@0
|
292 |
$data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);
|
|
indvdum@0
|
293 |
}
|
|
indvdum@0
|
294 |
|
|
indvdum@0
|
295 |
add_form_key('ucp_profile_info');
|
|
indvdum@0
|
296 |
|
|
indvdum@0
|
297 |
if ($submit)
|
|
indvdum@0
|
298 |
{
|
|
indvdum@0
|
299 |
$validate_array = array(
|
|
indvdum@0
|
300 |
'icq' => array(
|
|
indvdum@0
|
301 |
array('string', true, 3, 15),
|
|
indvdum@0
|
302 |
array('match', true, '#^[0-9]+$#i')),
|
|
indvdum@0
|
303 |
'aim' => array('string', true, 3, 255),
|
|
indvdum@0
|
304 |
'msn' => array('string', true, 5, 255),
|
|
indvdum@0
|
305 |
'jabber' => array(
|
|
indvdum@0
|
306 |
array('string', true, 5, 255),
|
|
indvdum@0
|
307 |
array('jabber')),
|
|
indvdum@0
|
308 |
'yim' => array('string', true, 5, 255),
|
|
indvdum@0
|
309 |
'website' => array(
|
|
indvdum@0
|
310 |
array('string', true, 12, 255),
|
|
indvdum@0
|
311 |
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
|
|
indvdum@0
|
312 |
'location' => array('string', true, 2, 100),
|
|
indvdum@0
|
313 |
'occupation' => array('string', true, 2, 500),
|
|
indvdum@0
|
314 |
'interests' => array('string', true, 2, 500),
|
|
indvdum@0
|
315 |
);
|
|
indvdum@0
|
316 |
|
|
indvdum@0
|
317 |
if ($config['allow_birthdays'])
|
|
indvdum@0
|
318 |
{
|
|
indvdum@0
|
319 |
$validate_array = array_merge($validate_array, array(
|
|
indvdum@0
|
320 |
'bday_day' => array('num', true, 1, 31),
|
|
indvdum@0
|
321 |
'bday_month' => array('num', true, 1, 12),
|
|
indvdum@0
|
322 |
'bday_year' => array('num', true, 1901, gmdate('Y', time()) + 50),
|
|
indvdum@0
|
323 |
'user_birthday' => array('date', true),
|
|
indvdum@0
|
324 |
));
|
|
indvdum@0
|
325 |
}
|
|
indvdum@0
|
326 |
|
|
indvdum@0
|
327 |
$error = validate_data($data, $validate_array);
|
|
indvdum@0
|
328 |
|
|
indvdum@0
|
329 |
// validate custom profile fields
|
|
indvdum@0
|
330 |
$cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error);
|
|
indvdum@0
|
331 |
|
|
indvdum@0
|
332 |
if (sizeof($cp_error))
|
|
indvdum@0
|
333 |
{
|
|
indvdum@0
|
334 |
$error = array_merge($error, $cp_error);
|
|
indvdum@0
|
335 |
}
|
|
indvdum@0
|
336 |
|
|
indvdum@0
|
337 |
if (!check_form_key('ucp_profile_info'))
|
|
indvdum@0
|
338 |
{
|
|
indvdum@0
|
339 |
$error[] = 'FORM_INVALID';
|
|
indvdum@0
|
340 |
}
|
|
indvdum@0
|
341 |
|
|
indvdum@0
|
342 |
if (!sizeof($error))
|
|
indvdum@0
|
343 |
{
|
|
indvdum@0
|
344 |
$data['notify'] = $user->data['user_notify_type'];
|
|
indvdum@0
|
345 |
|
|
indvdum@0
|
346 |
if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')))
|
|
indvdum@0
|
347 |
{
|
|
indvdum@0
|
348 |
// User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled)
|
|
indvdum@0
|
349 |
// Disable notify by Jabber now for this user.
|
|
indvdum@0
|
350 |
$data['notify'] = NOTIFY_EMAIL;
|
|
indvdum@0
|
351 |
}
|
|
indvdum@0
|
352 |
|
|
indvdum@0
|
353 |
$sql_ary = array(
|
|
indvdum@0
|
354 |
'user_icq' => $data['icq'],
|
|
indvdum@0
|
355 |
'user_aim' => $data['aim'],
|
|
indvdum@0
|
356 |
'user_msnm' => $data['msn'],
|
|
indvdum@0
|
357 |
'user_yim' => $data['yim'],
|
|
indvdum@0
|
358 |
'user_jabber' => $data['jabber'],
|
|
indvdum@0
|
359 |
'user_website' => $data['website'],
|
|
indvdum@0
|
360 |
'user_from' => $data['location'],
|
|
indvdum@0
|
361 |
'user_occ' => $data['occupation'],
|
|
indvdum@0
|
362 |
'user_interests'=> $data['interests'],
|
|
indvdum@0
|
363 |
'user_notify_type' => $data['notify'],
|
|
indvdum@0
|
364 |
);
|
|
indvdum@0
|
365 |
|
|
indvdum@0
|
366 |
if ($config['allow_birthdays'])
|
|
indvdum@0
|
367 |
{
|
|
indvdum@0
|
368 |
$sql_ary['user_birthday'] = $data['user_birthday'];
|
|
indvdum@0
|
369 |
}
|
|
indvdum@0
|
370 |
|
|
indvdum@0
|
371 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
indvdum@0
|
372 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
indvdum@0
|
373 |
WHERE user_id = ' . $user->data['user_id'];
|
|
indvdum@0
|
374 |
$db->sql_query($sql);
|
|
indvdum@0
|
375 |
|
|
indvdum@0
|
376 |
// Update Custom Fields
|
|
indvdum@0
|
377 |
$cp->update_profile_field_data($user->data['user_id'], $cp_data);
|
|
indvdum@0
|
378 |
|
|
indvdum@0
|
379 |
meta_refresh(3, $this->u_action);
|
|
indvdum@0
|
380 |
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
|
indvdum@0
|
381 |
trigger_error($message);
|
|
indvdum@0
|
382 |
}
|
|
indvdum@0
|
383 |
|
|
indvdum@0
|
384 |
// Replace "error" strings with their real, localised form
|
|
indvdum@0
|
385 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
indvdum@0
|
386 |
}
|
|
indvdum@0
|
387 |
|
|
indvdum@0
|
388 |
if ($config['allow_birthdays'])
|
|
indvdum@0
|
389 |
{
|
|
indvdum@0
|
390 |
$s_birthday_day_options = '<option value="0"' . ((!$data['bday_day']) ? ' selected="selected"' : '') . '>--</option>';
|
|
indvdum@0
|
391 |
for ($i = 1; $i < 32; $i++)
|
|
indvdum@0
|
392 |
{
|
|
indvdum@0
|
393 |
$selected = ($i == $data['bday_day']) ? ' selected="selected"' : '';
|
|
indvdum@0
|
394 |
$s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>";
|
|
indvdum@0
|
395 |
}
|
|
indvdum@0
|
396 |
|
|
indvdum@0
|
397 |
$s_birthday_month_options = '<option value="0"' . ((!$data['bday_month']) ? ' selected="selected"' : '') . '>--</option>';
|
|
indvdum@0
|
398 |
for ($i = 1; $i < 13; $i++)
|
|
indvdum@0
|
399 |
{
|
|
indvdum@0
|
400 |
$selected = ($i == $data['bday_month']) ? ' selected="selected"' : '';
|
|
indvdum@0
|
401 |
$s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";
|
|
indvdum@0
|
402 |
}
|
|
indvdum@0
|
403 |
$s_birthday_year_options = '';
|
|
indvdum@0
|
404 |
|
|
indvdum@0
|
405 |
$now = getdate();
|
|
indvdum@0
|
406 |
$s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';
|
|
indvdum@0
|
407 |
for ($i = $now['year'] - 100; $i <= $now['year']; $i++)
|
|
indvdum@0
|
408 |
{
|
|
indvdum@0
|
409 |
$selected = ($i == $data['bday_year']) ? ' selected="selected"' : '';
|
|
indvdum@0
|
410 |
$s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";
|
|
indvdum@0
|
411 |
}
|
|
indvdum@0
|
412 |
unset($now);
|
|
indvdum@0
|
413 |
|
|
indvdum@0
|
414 |
$template->assign_vars(array(
|
|
indvdum@0
|
415 |
'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
|
|
indvdum@0
|
416 |
'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options,
|
|
indvdum@0
|
417 |
'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options,
|
|
indvdum@0
|
418 |
'S_BIRTHDAYS_ENABLED' => true,
|
|
indvdum@0
|
419 |
));
|
|
indvdum@0
|
420 |
}
|
|
indvdum@0
|
421 |
|
|
indvdum@0
|
422 |
$template->assign_vars(array(
|
|
indvdum@0
|
423 |
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
indvdum@0
|
424 |
|
|
indvdum@0
|
425 |
'ICQ' => $data['icq'],
|
|
indvdum@0
|
426 |
'YIM' => $data['yim'],
|
|
indvdum@0
|
427 |
'AIM' => $data['aim'],
|
|
indvdum@0
|
428 |
'MSN' => $data['msn'],
|
|
indvdum@0
|
429 |
'JABBER' => $data['jabber'],
|
|
indvdum@0
|
430 |
'WEBSITE' => $data['website'],
|
|
indvdum@0
|
431 |
'LOCATION' => $data['location'],
|
|
indvdum@0
|
432 |
'OCCUPATION'=> $data['occupation'],
|
|
indvdum@0
|
433 |
'INTERESTS' => $data['interests'],
|
|
indvdum@0
|
434 |
));
|
|
indvdum@0
|
435 |
|
|
indvdum@0
|
436 |
// Get additional profile fields and assign them to the template block var 'profile_fields'
|
|
indvdum@0
|
437 |
$user->get_profile_fields($user->data['user_id']);
|
|
indvdum@0
|
438 |
|
|
indvdum@0
|
439 |
$cp->generate_profile_fields('profile', $user->get_iso_lang_id());
|
|
indvdum@0
|
440 |
|
|
indvdum@0
|
441 |
break;
|
|
indvdum@0
|
442 |
|
|
indvdum@0
|
443 |
case 'signature':
|
|
indvdum@0
|
444 |
|
|
indvdum@0
|
445 |
if (!$auth->acl_get('u_sig'))
|
|
indvdum@0
|
446 |
{
|
|
indvdum@0
|
447 |
trigger_error('NO_AUTH_SIGNATURE');
|
|
indvdum@0
|
448 |
}
|
|
indvdum@0
|
449 |
|
|
indvdum@0
|
450 |
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
|
indvdum@0
|
451 |
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
|
indvdum@0
|
452 |
|
|
indvdum@0
|
453 |
$enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $user->optionget('sig_bbcode') : false;
|
|
indvdum@0
|
454 |
$enable_smilies = ($config['allow_sig_smilies']) ? (bool) $user->optionget('sig_smilies') : false;
|
|
indvdum@0
|
455 |
$enable_urls = ($config['allow_sig_links']) ? (bool) $user->optionget('sig_links') : false;
|
|
indvdum@0
|
456 |
|
|
indvdum@0
|
457 |
$signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));
|
|
indvdum@0
|
458 |
|
|
indvdum@0
|
459 |
add_form_key('ucp_sig');
|
|
indvdum@0
|
460 |
|
|
indvdum@0
|
461 |
if ($submit || $preview)
|
|
indvdum@0
|
462 |
{
|
|
indvdum@0
|
463 |
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
|
|
indvdum@0
|
464 |
|
|
indvdum@0
|
465 |
$enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false;
|
|
indvdum@0
|
466 |
$enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false;
|
|
indvdum@0
|
467 |
$enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
|
|
indvdum@0
|
468 |
|
|
indvdum@0
|
469 |
if (!sizeof($error))
|
|
indvdum@0
|
470 |
{
|
|
indvdum@0
|
471 |
$message_parser = new parse_message($signature);
|
|
indvdum@0
|
472 |
|
|
indvdum@0
|
473 |
// Allowing Quote BBCode
|
|
indvdum@0
|
474 |
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig');
|
|
indvdum@0
|
475 |
|
|
indvdum@0
|
476 |
if (sizeof($message_parser->warn_msg))
|
|
indvdum@0
|
477 |
{
|
|
indvdum@0
|
478 |
$error[] = implode('<br />', $message_parser->warn_msg);
|
|
indvdum@0
|
479 |
}
|
|
indvdum@0
|
480 |
|
|
indvdum@0
|
481 |
if (!check_form_key('ucp_sig'))
|
|
indvdum@0
|
482 |
{
|
|
indvdum@0
|
483 |
$error[] = 'FORM_INVALID';
|
|
indvdum@0
|
484 |
}
|
|
indvdum@0
|
485 |
|
|
indvdum@0
|
486 |
if (!sizeof($error) && $submit)
|
|
indvdum@0
|
487 |
{
|
|
indvdum@0
|
488 |
$user->optionset('sig_bbcode', $enable_bbcode);
|
|
indvdum@0
|
489 |
$user->optionset('sig_smilies', $enable_smilies);
|
|
indvdum@0
|
490 |
$user->optionset('sig_links', $enable_urls);
|
|
indvdum@0
|
491 |
|
|
indvdum@0
|
492 |
$sql_ary = array(
|
|
indvdum@0
|
493 |
'user_sig' => (string) $message_parser->message,
|
|
indvdum@0
|
494 |
'user_options' => $user->data['user_options'],
|
|
indvdum@0
|
495 |
'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid,
|
|
indvdum@0
|
496 |
'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield
|
|
indvdum@0
|
497 |
);
|
|
indvdum@0
|
498 |
|
|
indvdum@0
|
499 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
indvdum@0
|
500 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
indvdum@0
|
501 |
WHERE user_id = ' . $user->data['user_id'];
|
|
indvdum@0
|
502 |
$db->sql_query($sql);
|
|
indvdum@0
|
503 |
|
|
indvdum@0
|
504 |
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
|
indvdum@0
|
505 |
trigger_error($message);
|
|
indvdum@0
|
506 |
}
|
|
indvdum@0
|
507 |
}
|
|
indvdum@0
|
508 |
|
|
indvdum@0
|
509 |
// Replace "error" strings with their real, localised form
|
|
indvdum@0
|
510 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
indvdum@0
|
511 |
}
|
|
indvdum@0
|
512 |
|
|
indvdum@0
|
513 |
$signature_preview = '';
|
|
indvdum@0
|
514 |
if ($preview)
|
|
indvdum@0
|
515 |
{
|
|
indvdum@0
|
516 |
// Now parse it for displaying
|
|
indvdum@0
|
517 |
$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
|
|
indvdum@0
|
518 |
unset($message_parser);
|
|
indvdum@0
|
519 |
}
|
|
indvdum@0
|
520 |
|
|
indvdum@0
|
521 |
decode_message($signature, $user->data['user_sig_bbcode_uid']);
|
|
indvdum@0
|
522 |
|
|
indvdum@0
|
523 |
$template->assign_vars(array(
|
|
indvdum@0
|
524 |
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
indvdum@0
|
525 |
'SIGNATURE' => $signature,
|
|
indvdum@0
|
526 |
'SIGNATURE_PREVIEW' => $signature_preview,
|
|
indvdum@0
|
527 |
|
|
indvdum@0
|
528 |
'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '',
|
|
indvdum@0
|
529 |
'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '',
|
|
indvdum@0
|
530 |
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '',
|
|
indvdum@0
|
531 |
|
|
indvdum@0
|
532 |
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
|
|
indvdum@0
|
533 |
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
|
indvdum@0
|
534 |
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
|
indvdum@0
|
535 |
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
|
indvdum@0
|
536 |
'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
|
|
indvdum@0
|
537 |
'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'],
|
|
indvdum@0
|
538 |
|
|
indvdum@0
|
539 |
'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
|
|
indvdum@0
|
540 |
|
|
indvdum@0
|
541 |
'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'],
|
|
indvdum@0
|
542 |
'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'],
|
|
indvdum@0
|
543 |
'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false,
|
|
indvdum@0
|
544 |
'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false,
|
|
indvdum@0
|
545 |
'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false)
|
|
indvdum@0
|
546 |
);
|
|
indvdum@0
|
547 |
|
|
indvdum@0
|
548 |
// Build custom bbcodes array
|
|
indvdum@0
|
549 |
display_custom_bbcodes();
|
|
indvdum@0
|
550 |
|
|
indvdum@0
|
551 |
break;
|
|
indvdum@0
|
552 |
|
|
indvdum@0
|
553 |
case 'avatar':
|
|
indvdum@0
|
554 |
|
|
indvdum@0
|
555 |
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
|
indvdum@0
|
556 |
|
|
indvdum@0
|
557 |
$display_gallery = request_var('display_gallery', '0');
|
|
indvdum@0
|
558 |
$avatar_select = basename(request_var('avatar_select', ''));
|
|
indvdum@0
|
559 |
$category = basename(request_var('category', ''));
|
|
indvdum@0
|
560 |
|
|
indvdum@0
|
561 |
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
|
|
indvdum@0
|
562 |
|
|
indvdum@0
|
563 |
add_form_key('ucp_avatar');
|
|
indvdum@0
|
564 |
|
|
indvdum@0
|
565 |
if ($submit)
|
|
indvdum@0
|
566 |
{
|
|
indvdum@0
|
567 |
if (check_form_key('ucp_avatar'))
|
|
indvdum@0
|
568 |
{
|
|
indvdum@0
|
569 |
if (avatar_process_user($error, false, $can_upload))
|
|
indvdum@0
|
570 |
{
|
|
indvdum@0
|
571 |
meta_refresh(3, $this->u_action);
|
|
indvdum@0
|
572 |
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
|
indvdum@0
|
573 |
trigger_error($message);
|
|
indvdum@0
|
574 |
}
|
|
indvdum@0
|
575 |
}
|
|
indvdum@0
|
576 |
else
|
|
indvdum@0
|
577 |
{
|
|
indvdum@0
|
578 |
$error[] = 'FORM_INVALID';
|
|
indvdum@0
|
579 |
}
|
|
indvdum@0
|
580 |
// Replace "error" strings with their real, localised form
|
|
indvdum@0
|
581 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
indvdum@0
|
582 |
}
|
|
indvdum@0
|
583 |
|
|
indvdum@0
|
584 |
if (!$config['allow_avatar'] && $user->data['user_avatar_type'])
|
|
indvdum@0
|
585 |
{
|
|
indvdum@0
|
586 |
$error[] = $user->lang['AVATAR_NOT_ALLOWED'];
|
|
indvdum@0
|
587 |
}
|
|
indvdum@0
|
588 |
else if ((($user->data['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) ||
|
|
indvdum@0
|
589 |
(($user->data['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) ||
|
|
indvdum@0
|
590 |
(($user->data['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local']))
|
|
indvdum@0
|
591 |
{
|
|
indvdum@0
|
592 |
$error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];
|
|
indvdum@0
|
593 |
}
|
|
indvdum@0
|
594 |
|
|
indvdum@0
|
595 |
$template->assign_vars(array(
|
|
indvdum@0
|
596 |
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
indvdum@0
|
597 |
'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height'], 'USER_AVATAR', true),
|
|
indvdum@0
|
598 |
'AVATAR_SIZE' => $config['avatar_filesize'],
|
|
indvdum@0
|
599 |
|
|
indvdum@0
|
600 |
'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=avatar&display_gallery=1'),
|
|
indvdum@0
|
601 |
|
|
indvdum@0
|
602 |
'S_FORM_ENCTYPE' => ($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '',
|
|
indvdum@0
|
603 |
|
|
indvdum@0
|
604 |
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
|
|
indvdum@0
|
605 |
));
|
|
indvdum@0
|
606 |
|
|
indvdum@0
|
607 |
if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'])
|
|
indvdum@0
|
608 |
{
|
|
indvdum@0
|
609 |
avatar_gallery($category, $avatar_select, 4);
|
|
indvdum@0
|
610 |
}
|
|
indvdum@0
|
611 |
else if ($config['allow_avatar'])
|
|
indvdum@0
|
612 |
{
|
|
indvdum@0
|
613 |
$avatars_enabled = (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) || ($auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false;
|
|
indvdum@0
|
614 |
|
|
indvdum@0
|
615 |
$template->assign_vars(array(
|
|
indvdum@0
|
616 |
'AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']),
|
|
indvdum@0
|
617 |
'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']),
|
|
indvdum@0
|
618 |
|
|
indvdum@0
|
619 |
'S_AVATARS_ENABLED' => $avatars_enabled,
|
|
indvdum@0
|
620 |
'S_UPLOAD_AVATAR_FILE' => ($can_upload && $config['allow_avatar_upload']) ? true : false,
|
|
indvdum@0
|
621 |
'S_UPLOAD_AVATAR_URL' => ($can_upload && $config['allow_avatar_remote_upload']) ? true : false,
|
|
indvdum@0
|
622 |
'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
|
|
indvdum@0
|
623 |
'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false)
|
|
indvdum@0
|
624 |
);
|
|
indvdum@0
|
625 |
}
|
|
indvdum@0
|
626 |
|
|
indvdum@0
|
627 |
break;
|
|
indvdum@0
|
628 |
}
|
|
indvdum@0
|
629 |
|
|
indvdum@0
|
630 |
$template->assign_vars(array(
|
|
indvdum@0
|
631 |
'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)],
|
|
indvdum@0
|
632 |
|
|
indvdum@0
|
633 |
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
|
indvdum@0
|
634 |
'S_UCP_ACTION' => $this->u_action)
|
|
indvdum@0
|
635 |
);
|
|
indvdum@0
|
636 |
|
|
indvdum@0
|
637 |
// Set desired template
|
|
indvdum@0
|
638 |
$this->tpl_name = 'ucp_profile_' . $mode;
|
|
indvdum@0
|
639 |
$this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
|
|
indvdum@0
|
640 |
}
|
|
indvdum@0
|
641 |
}
|
|
indvdum@0
|
642 |
|
|
indvdum@0
|
643 |
?> |