6 * @copyright (c) 2005 phpBB Group
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 if (!defined('IN_PHPBB'))
21 * Changing profile settings
23 * @todo what about pertaining user_sig_options?
30 function main($id, $mode)
32 global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
34 $user->add_lang('posting');
36 $preview = (!empty($_POST['preview'])) ? true : false;
37 $submit = (!empty($_POST['submit'])) ? true : false;
38 $delete = (!empty($_POST['delete'])) ? true : false;
39 $error = $data = array();
40 $s_hidden_fields = '';
47 'username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)),
48 'email' => strtolower(request_var('email', $user->data['user_email'])),
49 'email_confirm' => strtolower(request_var('email_confirm', '')),
50 'new_password' => request_var('new_password', '', true),
51 'cur_password' => request_var('cur_password', '', true),
52 'password_confirm' => request_var('password_confirm', '', true),
55 add_form_key('ucp_reg_details');
59 // Do not check cur_password, it is the old one.
61 'new_password' => array(
62 array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
64 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
66 array('string', false, 6, 60),
68 'email_confirm' => array('string', true, 6, 60),
71 if ($auth->acl_get('u_chgname') && $config['allow_namechange'])
73 $check_ary['username'] = array(
74 array('string', false, $config['min_name_chars'], $config['max_name_chars']),
79 $error = validate_data($data, $check_ary);
81 if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'] && $data['email_confirm'] != $data['email'])
83 $error[] = ($data['email_confirm']) ? 'NEW_EMAIL_ERROR' : 'NEW_EMAIL_CONFIRM_EMPTY';
86 if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password'])
88 $error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY';
91 // Only check the new password against the previous password if there have been no errors
92 if (!sizeof($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && phpbb_check_hash($data['new_password'], $user->data['user_password']))
94 $error[] = 'SAME_PASSWORD_ERROR';
97 if (!phpbb_check_hash($data['cur_password'], $user->data['user_password']))
99 $error[] = ($data['cur_password']) ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY';
102 if (!check_form_key('ucp_reg_details'))
104 $error[] = 'FORM_INVALID';
110 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'],
111 'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'],
112 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'],
113 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'],
114 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? phpbb_hash($data['new_password']) : $user->data['user_password'],
115 'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0,
118 if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username'])
120 add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $data['username']);
123 if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !phpbb_check_hash($data['new_password'], $user->data['user_password']))
125 $user->reset_login_keys();
126 add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $data['username']);
129 if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email'])
131 add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $data['username'], $user->data['user_email'], $data['email']);
134 $message = 'PROFILE_UPDATED';
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))
138 $message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN';
140 include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
142 $server_url = generate_board_url();
144 $user_actkey = gen_rand_string(mt_rand(6, 10));
146 $messenger = new messenger(false);
148 $template_file = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate';
149 $messenger->template($template_file, $user->data['user_lang']);
151 $messenger->to($data['email'], $data['username']);
153 $messenger->anti_abuse_headers($config, $user);
155 $messenger->assign_vars(array(
156 'USERNAME' => htmlspecialchars_decode($data['username']),
157 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
160 $messenger->send(NOTIFY_EMAIL);
162 if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
164 // Grab an array of user_id's with a_user permissions ... these users can activate a user
165 $admin_ary = $auth->acl_get_list(false, 'a_user', false);
166 $admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
168 // Also include founders
169 $where_sql = ' WHERE user_type = ' . USER_FOUNDER;
171 if (sizeof($admin_ary))
173 $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
176 $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
177 FROM ' . USERS_TABLE . ' ' .
179 $result = $db->sql_query($sql);
181 while ($row = $db->sql_fetchrow($result))
183 $messenger->template('admin_activate', $row['user_lang']);
184 $messenger->to($row['user_email'], $row['username']);
185 $messenger->im($row['user_jabber'], $row['username']);
187 $messenger->assign_vars(array(
188 'USERNAME' => htmlspecialchars_decode($data['username']),
189 'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u={$user->data['user_id']}",
190 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
193 $messenger->send($row['user_notify_type']);
195 $db->sql_freeresult($result);
198 user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE);
200 // Because we want the profile to be reactivated we set user_newpasswd to empty (else the reactivation will fail)
201 $sql_ary['user_actkey'] = $user_actkey;
202 $sql_ary['user_newpasswd'] = '';
205 if (sizeof($sql_ary))
207 $sql = 'UPDATE ' . USERS_TABLE . '
208 SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
209 WHERE user_id = ' . $user->data['user_id'];
210 $db->sql_query($sql);
213 // Need to update config, forum, topic, posting, messages, etc.
214 if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])
216 user_update_name($user->data['username'], $data['username']);
219 // Now, we can remove the user completely (kill the session) - NOT BEFORE!!!
220 if (!empty($sql_ary['user_actkey']))
222 meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx));
223 $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid($phpbb_root_path . 'index.' . $phpEx) . '">', '</a>');
225 // Because the user gets deactivated we log him out too, killing his session
226 $user->session_kill();
230 meta_refresh(3, $this->u_action);
231 $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
234 trigger_error($message);
237 // Replace "error" strings with their real, localised form
238 $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
241 $template->assign_vars(array(
242 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
244 'USERNAME' => $data['username'],
245 'EMAIL' => $data['email'],
246 'PASSWORD_CONFIRM' => $data['password_confirm'],
247 'NEW_PASSWORD' => $data['new_password'],
248 'CUR_PASSWORD' => '',
250 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
251 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
253 'S_FORCE_PASSWORD' => ($auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) ? true : false,
254 'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false,
255 'S_CHANGE_EMAIL' => ($auth->acl_get('u_chgemail')) ? true : false,
256 'S_CHANGE_PASSWORD' => ($auth->acl_get('u_chgpasswd')) ? true : false)
262 include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
264 $cp = new custom_profile();
266 $cp_data = $cp_error = array();
269 'icq' => request_var('icq', $user->data['user_icq']),
270 'aim' => request_var('aim', $user->data['user_aim']),
271 'msn' => request_var('msn', $user->data['user_msnm']),
272 'yim' => request_var('yim', $user->data['user_yim']),
273 'jabber' => utf8_normalize_nfc(request_var('jabber', $user->data['user_jabber'], true)),
274 'website' => request_var('website', $user->data['user_website']),
275 'location' => utf8_normalize_nfc(request_var('location', $user->data['user_from'], true)),
276 'occupation' => utf8_normalize_nfc(request_var('occupation', $user->data['user_occ'], true)),
277 'interests' => utf8_normalize_nfc(request_var('interests', $user->data['user_interests'], true)),
280 if ($config['allow_birthdays'])
282 $data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0;
284 if ($user->data['user_birthday'])
286 list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']);
289 $data['bday_day'] = request_var('bday_day', $data['bday_day']);
290 $data['bday_month'] = request_var('bday_month', $data['bday_month']);
291 $data['bday_year'] = request_var('bday_year', $data['bday_year']);
292 $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);
295 add_form_key('ucp_profile_info');
299 $validate_array = array(
301 array('string', true, 3, 15),
302 array('match', true, '#^[0-9]+$#i')),
303 'aim' => array('string', true, 3, 255),
304 'msn' => array('string', true, 5, 255),
306 array('string', true, 5, 255),
308 'yim' => array('string', true, 5, 255),
310 array('string', true, 12, 255),
311 array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
312 'location' => array('string', true, 2, 100),
313 'occupation' => array('string', true, 2, 500),
314 'interests' => array('string', true, 2, 500),
317 if ($config['allow_birthdays'])
319 $validate_array = array_merge($validate_array, array(
320 'bday_day' => array('num', true, 1, 31),
321 'bday_month' => array('num', true, 1, 12),
322 'bday_year' => array('num', true, 1901, gmdate('Y', time()) + 50),
323 'user_birthday' => array('date', true),
327 $error = validate_data($data, $validate_array);
329 // validate custom profile fields
330 $cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error);
332 if (sizeof($cp_error))
334 $error = array_merge($error, $cp_error);
337 if (!check_form_key('ucp_profile_info'))
339 $error[] = 'FORM_INVALID';
344 $data['notify'] = $user->data['user_notify_type'];
346 if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')))
348 // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled)
349 // Disable notify by Jabber now for this user.
350 $data['notify'] = NOTIFY_EMAIL;
354 'user_icq' => $data['icq'],
355 'user_aim' => $data['aim'],
356 'user_msnm' => $data['msn'],
357 'user_yim' => $data['yim'],
358 'user_jabber' => $data['jabber'],
359 'user_website' => $data['website'],
360 'user_from' => $data['location'],
361 'user_occ' => $data['occupation'],
362 'user_interests'=> $data['interests'],
363 'user_notify_type' => $data['notify'],
366 if ($config['allow_birthdays'])
368 $sql_ary['user_birthday'] = $data['user_birthday'];
371 $sql = 'UPDATE ' . USERS_TABLE . '
372 SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
373 WHERE user_id = ' . $user->data['user_id'];
374 $db->sql_query($sql);
376 // Update Custom Fields
377 $cp->update_profile_field_data($user->data['user_id'], $cp_data);
379 meta_refresh(3, $this->u_action);
380 $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
381 trigger_error($message);
384 // Replace "error" strings with their real, localised form
385 $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
388 if ($config['allow_birthdays'])
390 $s_birthday_day_options = '<option value="0"' . ((!$data['bday_day']) ? ' selected="selected"' : '') . '>--</option>';
391 for ($i = 1; $i < 32; $i++)
393 $selected = ($i == $data['bday_day']) ? ' selected="selected"' : '';
394 $s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>";
397 $s_birthday_month_options = '<option value="0"' . ((!$data['bday_month']) ? ' selected="selected"' : '') . '>--</option>';
398 for ($i = 1; $i < 13; $i++)
400 $selected = ($i == $data['bday_month']) ? ' selected="selected"' : '';
401 $s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";
403 $s_birthday_year_options = '';
406 $s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';
407 for ($i = $now['year'] - 100; $i <= $now['year']; $i++)
409 $selected = ($i == $data['bday_year']) ? ' selected="selected"' : '';
410 $s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";
414 $template->assign_vars(array(
415 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
416 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options,
417 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options,
418 'S_BIRTHDAYS_ENABLED' => true,
422 $template->assign_vars(array(
423 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
425 'ICQ' => $data['icq'],
426 'YIM' => $data['yim'],
427 'AIM' => $data['aim'],
428 'MSN' => $data['msn'],
429 'JABBER' => $data['jabber'],
430 'WEBSITE' => $data['website'],
431 'LOCATION' => $data['location'],
432 'OCCUPATION'=> $data['occupation'],
433 'INTERESTS' => $data['interests'],
436 // Get additional profile fields and assign them to the template block var 'profile_fields'
437 $user->get_profile_fields($user->data['user_id']);
439 $cp->generate_profile_fields('profile', $user->get_iso_lang_id());
445 if (!$auth->acl_get('u_sig'))
447 trigger_error('NO_AUTH_SIGNATURE');
450 include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
451 include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
453 $enable_bbcode = ($config['allow_sig_bbcode']) ? (bool) $user->optionget('sig_bbcode') : false;
454 $enable_smilies = ($config['allow_sig_smilies']) ? (bool) $user->optionget('sig_smilies') : false;
455 $enable_urls = ($config['allow_sig_links']) ? (bool) $user->optionget('sig_links') : false;
457 $signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));
459 add_form_key('ucp_sig');
461 if ($submit || $preview)
463 include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
465 $enable_bbcode = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false;
466 $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false;
467 $enable_urls = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
471 $message_parser = new parse_message($signature);
473 // Allowing Quote BBCode
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');
476 if (sizeof($message_parser->warn_msg))
478 $error[] = implode('<br />', $message_parser->warn_msg);
481 if (!check_form_key('ucp_sig'))
483 $error[] = 'FORM_INVALID';
486 if (!sizeof($error) && $submit)
488 $user->optionset('sig_bbcode', $enable_bbcode);
489 $user->optionset('sig_smilies', $enable_smilies);
490 $user->optionset('sig_links', $enable_urls);
493 'user_sig' => (string) $message_parser->message,
494 'user_options' => $user->data['user_options'],
495 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid,
496 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield
499 $sql = 'UPDATE ' . USERS_TABLE . '
500 SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
501 WHERE user_id = ' . $user->data['user_id'];
502 $db->sql_query($sql);
504 $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
505 trigger_error($message);
509 // Replace "error" strings with their real, localised form
510 $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
513 $signature_preview = '';
516 // Now parse it for displaying
517 $signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
518 unset($message_parser);
521 decode_message($signature, $user->data['user_sig_bbcode_uid']);
523 $template->assign_vars(array(
524 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
525 'SIGNATURE' => $signature,
526 'SIGNATURE_PREVIEW' => $signature_preview,
528 'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '',
529 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '',
530 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '',
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>'),
533 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
534 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
535 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
536 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
537 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'],
539 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
541 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'],
542 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'],
543 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false,
544 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false,
545 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false)
548 // Build custom bbcodes array
549 display_custom_bbcodes();
555 include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
557 $display_gallery = request_var('display_gallery', '0');
558 $avatar_select = basename(request_var('avatar_select', ''));
559 $category = basename(request_var('category', ''));
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;
563 add_form_key('ucp_avatar');
567 if (check_form_key('ucp_avatar'))
569 if (avatar_process_user($error, false, $can_upload))
571 meta_refresh(3, $this->u_action);
572 $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
573 trigger_error($message);
578 $error[] = 'FORM_INVALID';
580 // Replace "error" strings with their real, localised form
581 $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
584 if (!$config['allow_avatar'] && $user->data['user_avatar_type'])
586 $error[] = $user->lang['AVATAR_NOT_ALLOWED'];
588 else if ((($user->data['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) ||
589 (($user->data['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) ||
590 (($user->data['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local']))
592 $error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];
595 $template->assign_vars(array(
596 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
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),
598 'AVATAR_SIZE' => $config['avatar_filesize'],
600 'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=avatar&display_gallery=1'),
602 'S_FORM_ENCTYPE' => ($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '',
604 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
607 if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'])
609 avatar_gallery($category, $avatar_select, 4);
611 else if ($config['allow_avatar'])
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;
615 $template->assign_vars(array(
616 'AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']),
617 'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']),
619 'S_AVATARS_ENABLED' => $avatars_enabled,
620 'S_UPLOAD_AVATAR_FILE' => ($can_upload && $config['allow_avatar_upload']) ? true : false,
621 'S_UPLOAD_AVATAR_URL' => ($can_upload && $config['allow_avatar_remote_upload']) ? true : false,
622 'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
623 'S_DISPLAY_GALLERY' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false)
630 $template->assign_vars(array(
631 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)],
633 'S_HIDDEN_FIELDS' => $s_hidden_fields,
634 'S_UCP_ACTION' => $this->u_action)
637 // Set desired template
638 $this->tpl_name = 'ucp_profile_' . $mode;
639 $this->page_title = 'UCP_PROFILE_' . strtoupper($mode);