2003-05-19 15:23:04 +00:00
|
|
|
<?php
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package ucp
|
|
|
|
* @version $Id$
|
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ucp_profile
|
|
|
|
* Changing profile settings
|
2006-06-13 21:06:29 +00:00
|
|
|
* @package ucp
|
2005-04-09 12:26:45 +00:00
|
|
|
*/
|
2005-10-04 21:31:35 +00:00
|
|
|
class ucp_profile
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
var $u_action;
|
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
function main($id, $mode)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-02-28 21:16:15 +00:00
|
|
|
$user->add_lang('posting');
|
|
|
|
|
2003-11-10 14:18:54 +00:00
|
|
|
$preview = (!empty($_POST['preview'])) ? true : false;
|
|
|
|
$submit = (!empty($_POST['submit'])) ? true : false;
|
|
|
|
$delete = (!empty($_POST['delete'])) ? true : false;
|
2003-09-08 12:42:32 +00:00
|
|
|
$error = $data = array();
|
2004-10-13 19:30:02 +00:00
|
|
|
$s_hidden_fields = '';
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2003-10-01 17:24:53 +00:00
|
|
|
switch ($mode)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
|
|
|
case 'reg_details':
|
|
|
|
|
2003-09-07 13:46:51 +00:00
|
|
|
if ($submit)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2003-09-08 12:42:32 +00:00
|
|
|
$var_ary = array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'username' => $user->data['username'],
|
|
|
|
'email' => $user->data['user_email'],
|
2003-09-08 12:42:32 +00:00
|
|
|
'email_confirm' => (string) '',
|
2004-09-01 15:47:46 +00:00
|
|
|
'new_password' => (string) '',
|
|
|
|
'cur_password' => (string) '',
|
|
|
|
'password_confirm' => (string) '',
|
2003-09-08 12:42:32 +00:00
|
|
|
);
|
2003-09-07 13:46:51 +00:00
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
foreach ($var_ary as $var => $default)
|
|
|
|
{
|
|
|
|
$data[$var] = request_var($var, $default);
|
|
|
|
}
|
2003-09-07 13:46:51 +00:00
|
|
|
|
2006-06-19 21:30:32 +00:00
|
|
|
// Do not check cur_password, it is the old one.
|
2003-09-08 12:42:32 +00:00
|
|
|
$var_ary = array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
|
|
|
'new_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
2003-09-08 12:42:32 +00:00
|
|
|
'email' => array(
|
2004-09-01 15:47:46 +00:00
|
|
|
array('string', false, 6, 60),
|
2004-10-13 19:30:02 +00:00
|
|
|
array('email', $data['email'])),
|
2004-09-01 15:47:46 +00:00
|
|
|
'email_confirm' => array('string', true, 6, 60),
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
2003-09-07 13:46:51 +00:00
|
|
|
|
2006-03-28 18:09:55 +00:00
|
|
|
if ($auth->acl_get('u_chgname') && $config['allow_namechange'])
|
|
|
|
{
|
|
|
|
$var_ary['username'] = array(
|
|
|
|
array('string', false, $config['min_name_chars'], $config['max_name_chars']),
|
|
|
|
array('username', $data['username']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
$error = validate_data($data, $var_ary);
|
|
|
|
extract($data);
|
|
|
|
unset($data);
|
2003-09-07 13:46:51 +00:00
|
|
|
|
2004-02-05 14:35:56 +00:00
|
|
|
if ($auth->acl_get('u_chgpasswd') && $new_password && $password_confirm != $new_password)
|
2003-09-08 12:42:32 +00:00
|
|
|
{
|
|
|
|
$error[] = 'NEW_PASSWORD_ERROR';
|
|
|
|
}
|
2004-02-05 14:35:56 +00:00
|
|
|
|
|
|
|
if (($new_password || ($auth->acl_get('u_chgemail') && $email != $user->data['user_email']) || ($username != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])) && md5($cur_password) != $user->data['user_password'])
|
2003-09-08 12:42:32 +00:00
|
|
|
{
|
|
|
|
$error[] = 'CUR_PASSWORD_ERROR';
|
|
|
|
}
|
2004-02-05 14:35:56 +00:00
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email'] && $email_confirm != $email)
|
|
|
|
{
|
|
|
|
$error[] = 'NEW_EMAIL_ERROR';
|
|
|
|
}
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if (!sizeof($error))
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
|
|
|
$sql_ary = array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $username : $user->data['username'],
|
|
|
|
'user_email' => ($auth->acl_get('u_chgemail')) ? $email : $user->data['user_email'],
|
|
|
|
'user_email_hash' => ($auth->acl_get('u_chgemail')) ? crc32(strtolower($email)) . strlen($email) : $user->data['user_email_hash'],
|
|
|
|
'user_password' => ($auth->acl_get('u_chgpasswd') && $new_password) ? md5($new_password) : $user->data['user_password'],
|
2006-03-17 12:51:32 +00:00
|
|
|
'user_passchg' => ($auth->acl_get('u_chgpasswd') && $new_password) ? time() : 0,
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
|
|
|
|
2006-03-17 12:51:32 +00:00
|
|
|
if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $username != $user->data['username'])
|
|
|
|
{
|
|
|
|
add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $username);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($auth->acl_get('u_chgpasswd') && $new_password && md5($new_password) != $user->data['user_password'])
|
|
|
|
{
|
2006-03-18 22:05:08 +00:00
|
|
|
$user->reset_login_keys();
|
2006-03-17 12:51:32 +00:00
|
|
|
add_log('user', $user->data['user_id'], 'LOG_USER_NEW_PASSWORD', $username);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($auth->acl_get('u_chgemail') && $email != $user->data['user_email'])
|
|
|
|
{
|
|
|
|
add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_EMAIL', $username, $user->data['user_email'], $email);
|
|
|
|
}
|
|
|
|
|
2003-11-10 14:18:54 +00:00
|
|
|
if ($config['email_enable'] && $email != $user->data['user_email'] && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))
|
|
|
|
{
|
|
|
|
include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
|
|
|
|
|
|
|
|
$server_url = generate_board_url();
|
|
|
|
|
|
|
|
$user_actkey = gen_rand_string(10);
|
|
|
|
$key_len = 54 - (strlen($server_url));
|
|
|
|
$key_len = ($key_len > 6) ? $key_len : 6;
|
|
|
|
$user_actkey = substr($user_actkey, 0, $key_len);
|
|
|
|
|
|
|
|
$messenger = new messenger();
|
|
|
|
|
2004-10-13 19:30:02 +00:00
|
|
|
$template_file = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate';
|
|
|
|
$messenger->template($template_file, $user->data['user_lang']);
|
2003-11-10 14:18:54 +00:00
|
|
|
|
2004-10-13 19:30:02 +00:00
|
|
|
$messenger->replyto($config['board_contact']);
|
2003-11-10 14:18:54 +00:00
|
|
|
$messenger->to($email, $username);
|
|
|
|
|
|
|
|
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
|
|
|
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
|
|
|
|
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
|
|
|
|
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
|
|
|
|
|
|
|
|
$messenger->assign_vars(array(
|
|
|
|
'SITENAME' => $config['sitename'],
|
2006-05-20 18:39:35 +00:00
|
|
|
'USERNAME' => html_entity_decode($username),
|
2003-11-10 14:18:54 +00:00
|
|
|
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
|
|
|
|
|
2004-10-13 19:30:02 +00:00
|
|
|
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
|
2003-11-10 14:18:54 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$messenger->send(NOTIFY_EMAIL);
|
|
|
|
|
|
|
|
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
|
|
|
|
{
|
|
|
|
// Grab an array of user_id's with a_user permissions
|
2004-05-02 13:06:57 +00:00
|
|
|
$admin_ary = $auth->acl_get_list(false, 'a_user', false);
|
2003-11-10 14:18:54 +00:00
|
|
|
|
2004-10-13 19:30:02 +00:00
|
|
|
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
|
2004-09-01 15:47:46 +00:00
|
|
|
FROM ' . USERS_TABLE . '
|
2003-11-10 14:18:54 +00:00
|
|
|
WHERE user_id IN (' . implode(', ', $admin_ary[0]['a_user']) .')';
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
2004-10-13 19:30:02 +00:00
|
|
|
$messenger->template('admin_activate', $row['user_lang']);
|
2003-11-10 14:18:54 +00:00
|
|
|
$messenger->replyto($config['board_contact']);
|
|
|
|
$messenger->to($row['user_email'], $row['username']);
|
|
|
|
$messenger->im($row['user_jabber'], $row['username']);
|
|
|
|
|
|
|
|
$messenger->assign_vars(array(
|
2006-05-20 18:39:35 +00:00
|
|
|
'USERNAME' => html_entity_decode($username),
|
2003-11-10 14:18:54 +00:00
|
|
|
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
|
2003-11-10 14:26:58 +00:00
|
|
|
|
2004-10-13 19:30:02 +00:00
|
|
|
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
|
2003-11-10 14:18:54 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$messenger->send($row['user_notify_type']);
|
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
}
|
|
|
|
|
2005-04-09 12:26:45 +00:00
|
|
|
$messenger->save_queue();
|
2003-11-10 14:18:54 +00:00
|
|
|
|
|
|
|
$sql_ary += array(
|
|
|
|
'user_type' => USER_INACTIVE,
|
|
|
|
'user_actkey' => $user_actkey
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-03-25 17:00:53 +00:00
|
|
|
if (sizeof($sql_ary))
|
|
|
|
{
|
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
|
WHERE user_id = ' . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
|
|
|
}
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2003-05-26 23:53:34 +00:00
|
|
|
// Need to update config, forum, topic, posting, messages, etc.
|
2003-09-08 12:42:32 +00:00
|
|
|
if ($username != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange'])
|
2003-05-26 23:53:34 +00:00
|
|
|
{
|
2004-02-03 02:28:24 +00:00
|
|
|
user_update_name($user->data['username'], $username);
|
2003-05-26 23:53:34 +00:00
|
|
|
}
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
meta_refresh(3, $this->u_action);
|
|
|
|
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
2003-05-19 21:41:55 +00:00
|
|
|
trigger_error($message);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
2004-10-13 19:30:02 +00:00
|
|
|
|
|
|
|
// Replace "error" strings with their real, localised form
|
|
|
|
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
2003-05-26 23:53:34 +00:00
|
|
|
$user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS');
|
|
|
|
|
2003-05-19 15:23:04 +00:00
|
|
|
$template->assign_vars(array(
|
2003-09-08 12:42:32 +00:00
|
|
|
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
'USERNAME' => (isset($username)) ? $username : $user->data['username'],
|
|
|
|
'EMAIL' => (isset($email)) ? $email : $user->data['user_email'],
|
|
|
|
'PASSWORD_CONFIRM' => (isset($password_confirm)) ? $password_confirm : '',
|
|
|
|
'NEW_PASSWORD' => (isset($new_password)) ? $new_password : '',
|
|
|
|
'CUR_PASSWORD' => '',
|
|
|
|
|
|
|
|
'L_USERNAME_EXPLAIN' => sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
|
|
|
|
'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang['CHANGE_PASSWORD_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
|
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
'S_FORCE_PASSWORD' => ($config['chg_passforce'] && $user->data['user_passchg'] < time() - $config['chg_passforce']) ? true : false,
|
2004-09-01 15:47:46 +00:00
|
|
|
'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false,
|
2003-06-02 17:27:38 +00:00
|
|
|
'S_CHANGE_EMAIL' => ($auth->acl_get('u_chgemail')) ? true : false,
|
|
|
|
'S_CHANGE_PASSWORD' => ($auth->acl_get('u_chgpasswd')) ? true : false)
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
2006-07-06 16:46:53 +00:00
|
|
|
break;
|
2003-05-19 15:23:04 +00:00
|
|
|
|
|
|
|
case 'profile_info':
|
|
|
|
|
2004-01-10 12:19:39 +00:00
|
|
|
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
2006-03-25 12:07:13 +00:00
|
|
|
|
2004-01-10 12:19:39 +00:00
|
|
|
$cp = new custom_profile();
|
|
|
|
|
|
|
|
$cp_data = $cp_error = array();
|
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if ($submit)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2003-09-08 12:42:32 +00:00
|
|
|
$var_ary = array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'icq' => (string) '',
|
|
|
|
'aim' => (string) '',
|
|
|
|
'msn' => (string) '',
|
|
|
|
'yim' => (string) '',
|
|
|
|
'jabber' => (string) '',
|
|
|
|
'website' => (string) '',
|
2003-09-08 12:42:32 +00:00
|
|
|
'location' => (string) '',
|
|
|
|
'occupation' => (string) '',
|
|
|
|
'interests' => (string) '',
|
|
|
|
'bday_day' => 0,
|
|
|
|
'bday_month' => 0,
|
|
|
|
'bday_year' => 0,
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
foreach ($var_ary as $var => $default)
|
|
|
|
{
|
2006-04-06 17:15:45 +00:00
|
|
|
$data[$var] = (in_array($var, array('location', 'occupation', 'interests'))) ? request_var($var, $default, true) : request_var($var, $default);
|
2003-09-08 12:42:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$var_ary = array(
|
|
|
|
'icq' => array(
|
2004-09-01 15:47:46 +00:00
|
|
|
array('string', true, 3, 15),
|
|
|
|
array('match', true, '#^[0-9]+$#i')),
|
2006-03-29 08:37:33 +00:00
|
|
|
'aim' => array('string', true, 3, 17),
|
2004-09-01 15:47:46 +00:00
|
|
|
'msn' => array('string', true, 5, 255),
|
2003-09-08 12:42:32 +00:00
|
|
|
'jabber' => array(
|
2004-09-01 15:47:46 +00:00
|
|
|
array('string', true, 5, 255),
|
2003-09-08 12:42:32 +00:00
|
|
|
array('match', true, '#^[a-z0-9\.\-_\+]+?@(.*?\.)*?[a-z0-9\-_]+?\.[a-z]{2,4}(/.*)?$#i')),
|
2004-09-01 15:47:46 +00:00
|
|
|
'yim' => array('string', true, 5, 255),
|
2003-09-08 12:42:32 +00:00
|
|
|
'website' => array(
|
2004-09-01 15:47:46 +00:00
|
|
|
array('string', true, 12, 255),
|
|
|
|
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
|
|
|
|
'location' => array('string', true, 2, 255),
|
|
|
|
'occupation' => array('string', true, 2, 500),
|
|
|
|
'interests' => array('string', true, 2, 500),
|
2003-09-08 12:42:32 +00:00
|
|
|
'bday_day' => array('num', true, 1, 31),
|
|
|
|
'bday_month' => array('num', true, 1, 12),
|
|
|
|
'bday_year' => array('num', true, 1901, gmdate('Y', time())),
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
$error = validate_data($data, $var_ary);
|
|
|
|
extract($data);
|
|
|
|
unset($data);
|
|
|
|
|
2004-01-10 12:19:39 +00:00
|
|
|
// validate custom profile fields
|
2004-09-16 18:33:22 +00:00
|
|
|
$cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error);
|
2004-01-10 12:19:39 +00:00
|
|
|
|
2004-09-16 18:33:22 +00:00
|
|
|
if (sizeof($cp_error))
|
|
|
|
{
|
|
|
|
$error = array_merge($error, $cp_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sizeof($error))
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
|
|
|
$sql_ary = array(
|
2003-09-08 12:42:32 +00:00
|
|
|
'user_icq' => $icq,
|
|
|
|
'user_aim' => $aim,
|
|
|
|
'user_msnm' => $msn,
|
|
|
|
'user_yim' => $yim,
|
|
|
|
'user_jabber' => $jabber,
|
|
|
|
'user_website' => $website,
|
|
|
|
'user_from' => $location,
|
|
|
|
'user_occ' => $occupation,
|
|
|
|
'user_interests'=> $interests,
|
|
|
|
'user_birthday' => sprintf('%2d-%2d-%4d', $bday_day, $bday_month, $bday_year),
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
2003-05-19 15:23:04 +00:00
|
|
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
|
WHERE user_id = ' . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
2004-01-10 12:19:39 +00:00
|
|
|
// Update Custom Fields
|
2004-01-12 13:13:00 +00:00
|
|
|
if (sizeof($cp_data))
|
2004-01-10 12:19:39 +00:00
|
|
|
{
|
2006-06-07 19:32:23 +00:00
|
|
|
$sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . '
|
2004-01-12 13:13:00 +00:00
|
|
|
SET ' . $db->sql_build_array('UPDATE', $cp_data) . '
|
|
|
|
WHERE user_id = ' . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
2004-02-08 15:18:44 +00:00
|
|
|
|
2004-01-12 13:13:00 +00:00
|
|
|
if (!$db->sql_affectedrows())
|
|
|
|
{
|
|
|
|
$cp_data['user_id'] = (int) $user->data['user_id'];
|
2004-02-08 15:18:44 +00:00
|
|
|
|
|
|
|
$db->return_on_error = true;
|
|
|
|
|
2006-06-07 19:32:23 +00:00
|
|
|
$sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp_data);
|
2004-02-08 15:18:44 +00:00
|
|
|
$db->sql_query($sql);
|
|
|
|
|
2004-01-12 13:13:00 +00:00
|
|
|
$db->return_on_error = false;
|
|
|
|
}
|
2004-01-10 12:19:39 +00:00
|
|
|
}
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
meta_refresh(3, $this->u_action);
|
|
|
|
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
2003-05-19 21:41:55 +00:00
|
|
|
trigger_error($message);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
2004-10-13 19:30:02 +00:00
|
|
|
|
|
|
|
// Replace "error" strings with their real, localised form
|
|
|
|
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
2006-06-16 16:54:51 +00:00
|
|
|
if (!isset($bday_day))
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-06-16 16:54:51 +00:00
|
|
|
if ($user->data['user_birthday'])
|
|
|
|
{
|
|
|
|
list($bday_day, $bday_month, $bday_year) = explode('-', $user->data['user_birthday']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$bday_day = $bday_month = $bday_year = 0;
|
|
|
|
}
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
2003-05-20 23:57:08 +00:00
|
|
|
$s_birthday_day_options = '<option value="0"' . ((!$bday_day) ? ' selected="selected"' : '') . '>--</option>';
|
2003-05-19 15:23:04 +00:00
|
|
|
for ($i = 1; $i < 32; $i++)
|
|
|
|
{
|
|
|
|
$selected = ($i == $bday_day) ? ' selected="selected"' : '';
|
|
|
|
$s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>";
|
|
|
|
}
|
|
|
|
|
2003-05-20 23:57:08 +00:00
|
|
|
$s_birthday_month_options = '<option value="0"' . ((!$bday_month) ? ' selected="selected"' : '') . '>--</option>';
|
2003-05-19 15:23:04 +00:00
|
|
|
for ($i = 1; $i < 13; $i++)
|
|
|
|
{
|
|
|
|
$selected = ($i == $bday_month) ? ' selected="selected"' : '';
|
|
|
|
$s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";
|
|
|
|
}
|
|
|
|
$s_birthday_year_options = '';
|
|
|
|
|
|
|
|
$now = getdate();
|
2003-05-20 23:57:08 +00:00
|
|
|
$s_birthday_year_options = '<option value="0"' . ((!$bday_year) ? ' selected="selected"' : '') . '>--</option>';
|
2003-05-19 15:23:04 +00:00
|
|
|
for ($i = $now['year'] - 100; $i < $now['year']; $i++)
|
|
|
|
{
|
|
|
|
$selected = ($i == $bday_year) ? ' selected="selected"' : '';
|
|
|
|
$s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";
|
|
|
|
}
|
|
|
|
unset($now);
|
|
|
|
|
|
|
|
$template->assign_vars(array(
|
2003-09-08 12:42:32 +00:00
|
|
|
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
'ICQ' => (isset($icq)) ? $icq : $user->data['user_icq'],
|
|
|
|
'YIM' => (isset($yim)) ? $yim : $user->data['user_yim'],
|
|
|
|
'AIM' => (isset($aim)) ? $aim : $user->data['user_aim'],
|
|
|
|
'MSN' => (isset($msn)) ? $msn : $user->data['user_msnm'],
|
|
|
|
'JABBER' => (isset($jabber)) ? $jabber : $user->data['user_jabber'],
|
|
|
|
'WEBSITE' => (isset($website)) ? $website : $user->data['user_website'],
|
|
|
|
'LOCATION' => (isset($location)) ? $location : $user->data['user_from'],
|
|
|
|
'OCCUPATION'=> (isset($occupation)) ? $occupation : $user->data['user_occ'],
|
|
|
|
'INTERESTS' => (isset($interests)) ? $interests : $user->data['user_interests'],
|
|
|
|
|
|
|
|
'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
|
|
|
|
'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options,
|
2003-05-19 15:23:04 +00:00
|
|
|
'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options,)
|
|
|
|
);
|
2004-09-01 15:47:46 +00:00
|
|
|
|
2004-01-10 12:19:39 +00:00
|
|
|
// Get additional profile fields and assign them to the template block var 'profile_fields'
|
|
|
|
$user->get_profile_fields($user->data['user_id']);
|
2004-02-08 15:18:44 +00:00
|
|
|
|
2004-09-16 18:33:22 +00:00
|
|
|
$cp->generate_profile_fields('profile', $user->get_iso_lang_id());
|
2004-01-10 12:19:39 +00:00
|
|
|
|
2006-07-06 16:46:53 +00:00
|
|
|
break;
|
2003-05-19 15:23:04 +00:00
|
|
|
|
|
|
|
case 'signature':
|
|
|
|
|
2004-11-06 14:22:04 +00:00
|
|
|
if (!$auth->acl_get('u_sig'))
|
2003-09-08 23:24:01 +00:00
|
|
|
{
|
2004-11-06 14:22:04 +00:00
|
|
|
trigger_error('NO_AUTH_SIGNATURE');
|
2003-09-08 23:24:01 +00:00
|
|
|
}
|
2004-11-06 14:22:04 +00:00
|
|
|
|
2006-07-06 16:46:53 +00:00
|
|
|
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
|
|
|
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-11-06 14:22:04 +00:00
|
|
|
$enable_bbcode = ($config['allow_sig_bbcode']) ? request_var('enable_bbcode', $user->optionget('bbcode')) : false;
|
2005-03-21 23:10:11 +00:00
|
|
|
$enable_smilies = ($config['allow_sig_smilies']) ? request_var('enable_smilies', $user->optionget('smilies')) : false;
|
2004-11-06 14:22:04 +00:00
|
|
|
$enable_urls = request_var('enable_urls', true);
|
2006-05-20 14:31:03 +00:00
|
|
|
$signature = request_var('signature', (string) $user->data['user_sig'], true);
|
2004-09-04 19:32:23 +00:00
|
|
|
|
|
|
|
if ($submit || $preview)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2004-09-04 19:32:23 +00:00
|
|
|
include($phpbb_root_path . 'includes/message_parser.'.$phpEx);
|
|
|
|
|
2003-05-19 15:23:04 +00:00
|
|
|
if (!sizeof($error))
|
|
|
|
{
|
2004-02-15 14:03:19 +00:00
|
|
|
$message_parser = new parse_message($signature);
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-09-04 19:32:23 +00:00
|
|
|
// Allowing Quote BBCode
|
2006-03-06 14:03:56 +00:00
|
|
|
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig');
|
2004-09-04 19:32:23 +00:00
|
|
|
|
|
|
|
if (sizeof($message_parser->warn_msg))
|
|
|
|
{
|
|
|
|
$error[] = implode('<br />', $message_parser->warn_msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sizeof($error) && $submit)
|
|
|
|
{
|
|
|
|
$sql_ary = array(
|
|
|
|
'user_sig' => (string) $message_parser->message,
|
|
|
|
'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid,
|
|
|
|
'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield
|
|
|
|
);
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-09-04 19:32:23 +00:00
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
|
WHERE user_id = ' . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
2004-09-04 19:32:23 +00:00
|
|
|
trigger_error($message);
|
|
|
|
}
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
2004-10-13 19:30:02 +00:00
|
|
|
|
|
|
|
// Replace "error" strings with their real, localised form
|
|
|
|
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$signature_preview = '';
|
2003-09-04 22:07:12 +00:00
|
|
|
if ($preview)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2004-09-04 19:32:23 +00:00
|
|
|
// Now parse it for displaying
|
2006-03-06 14:03:56 +00:00
|
|
|
$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
|
2004-09-04 19:32:23 +00:00
|
|
|
unset($message_parser);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
2004-09-04 19:32:23 +00:00
|
|
|
decode_message($signature, $user->data['user_sig_bbcode_uid']);
|
2003-09-08 23:24:01 +00:00
|
|
|
|
2003-05-19 15:23:04 +00:00
|
|
|
$template->assign_vars(array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
2003-05-19 15:23:04 +00:00
|
|
|
'SIGNATURE' => $signature,
|
2004-09-01 15:47:46 +00:00
|
|
|
'SIGNATURE_PREVIEW' => $signature_preview,
|
|
|
|
|
2003-05-19 15:23:04 +00:00
|
|
|
'S_BBCODE_CHECKED' => (!$enable_bbcode) ? 'checked="checked"' : '',
|
|
|
|
'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '',
|
|
|
|
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '',
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>'),
|
2004-11-06 14:22:04 +00:00
|
|
|
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
|
|
|
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
|
|
|
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-11-06 14:22:04 +00:00
|
|
|
'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'],
|
2006-06-08 20:26:03 +00:00
|
|
|
'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'],
|
|
|
|
'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false,
|
|
|
|
'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false)
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
2006-04-15 14:48:36 +00:00
|
|
|
|
|
|
|
// Build custom bbcodes array
|
2006-07-06 16:46:53 +00:00
|
|
|
display_custom_bbcodes();
|
2006-04-15 14:48:36 +00:00
|
|
|
|
|
|
|
break;
|
2003-05-19 15:23:04 +00:00
|
|
|
|
|
|
|
case 'avatar':
|
|
|
|
|
2005-12-04 20:25:51 +00:00
|
|
|
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
|
2004-09-04 19:32:23 +00:00
|
|
|
$delete = (isset($_POST['delete'])) ? true : false;
|
2005-12-04 20:25:51 +00:00
|
|
|
|
|
|
|
$avatar_select = basename(request_var('avatar_select', ''));
|
|
|
|
$category = basename(request_var('category', ''));
|
2003-10-15 17:43:07 +00:00
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
// Can we upload?
|
2003-10-13 21:24:03 +00:00
|
|
|
$can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false;
|
2003-06-02 17:27:38 +00:00
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if ($submit)
|
2003-05-20 13:24:23 +00:00
|
|
|
{
|
2003-09-08 12:42:32 +00:00
|
|
|
$var_ary = array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'uploadurl' => (string) '',
|
|
|
|
'remotelink' => (string) '',
|
2003-09-08 12:42:32 +00:00
|
|
|
'width' => (string) '',
|
2004-09-01 15:47:46 +00:00
|
|
|
'height' => (string) '',
|
2003-09-08 12:42:32 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($var_ary as $var => $default)
|
2003-05-20 13:24:23 +00:00
|
|
|
{
|
2003-09-08 12:42:32 +00:00
|
|
|
$data[$var] = request_var($var, $default);
|
2003-05-26 23:53:34 +00:00
|
|
|
}
|
2003-05-27 00:37:15 +00:00
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
$var_ary = array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'uploadurl' => array('string', true, 5, 255),
|
|
|
|
'remotelink' => array('string', true, 5, 255),
|
|
|
|
'width' => array('string', true, 1, 3),
|
|
|
|
'height' => array('string', true, 1, 3),
|
2003-09-08 12:42:32 +00:00
|
|
|
);
|
2003-05-27 00:37:15 +00:00
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
$error = validate_data($data, $var_ary);
|
|
|
|
|
|
|
|
if (!sizeof($error))
|
2003-05-26 23:53:34 +00:00
|
|
|
{
|
2003-10-15 17:43:07 +00:00
|
|
|
$data['user_id'] = $user->data['user_id'];
|
2005-12-04 20:25:51 +00:00
|
|
|
|
2005-03-21 23:10:11 +00:00
|
|
|
if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload)
|
2003-09-08 12:42:32 +00:00
|
|
|
{
|
2004-02-03 02:28:24 +00:00
|
|
|
list($type, $filename, $width, $height) = avatar_upload($data, $error);
|
2003-09-08 12:42:32 +00:00
|
|
|
}
|
|
|
|
else if ($data['remotelink'] && $auth->acl_get('u_chgavatar') && $config['allow_avatar_remote'])
|
|
|
|
{
|
2004-02-03 02:28:24 +00:00
|
|
|
list($type, $filename, $width, $height) = avatar_remote($data, $error);
|
2003-09-08 12:42:32 +00:00
|
|
|
}
|
2005-12-04 20:25:51 +00:00
|
|
|
else if ($avatar_select && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'])
|
2004-09-04 19:32:23 +00:00
|
|
|
{
|
|
|
|
$type = AVATAR_GALLERY;
|
2005-12-04 20:25:51 +00:00
|
|
|
$filename = $avatar_select;
|
|
|
|
|
|
|
|
// check avatar gallery
|
|
|
|
if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category))
|
|
|
|
{
|
2005-12-21 18:18:12 +00:00
|
|
|
$filename = '';
|
|
|
|
$type = $width = $height = 0;
|
2005-12-04 20:25:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
list($width, $height) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $filename);
|
|
|
|
$filename = $category . '/' . $filename;
|
|
|
|
}
|
2004-09-04 19:32:23 +00:00
|
|
|
}
|
2003-09-08 12:42:32 +00:00
|
|
|
else if ($delete && $auth->acl_get('u_chgavatar'))
|
|
|
|
{
|
2005-12-19 18:55:52 +00:00
|
|
|
$filename = '';
|
|
|
|
$type = $width = $height = 0;
|
2003-09-08 12:42:32 +00:00
|
|
|
}
|
2006-04-29 01:18:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$data = array();
|
|
|
|
}
|
2003-05-20 13:24:23 +00:00
|
|
|
}
|
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if (!sizeof($error))
|
2003-05-26 23:53:34 +00:00
|
|
|
{
|
2003-05-27 00:46:10 +00:00
|
|
|
// Do we actually have any data to update?
|
|
|
|
if (sizeof($data))
|
2003-05-27 00:37:15 +00:00
|
|
|
{
|
2003-05-27 00:46:10 +00:00
|
|
|
$sql_ary = array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'user_avatar' => $filename,
|
|
|
|
'user_avatar_type' => $type,
|
|
|
|
'user_avatar_width' => $width,
|
|
|
|
'user_avatar_height' => $height,
|
2003-05-27 00:46:10 +00:00
|
|
|
);
|
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
2003-05-27 00:46:10 +00:00
|
|
|
WHERE user_id = ' . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
|
|
|
// Delete old avatar if present
|
2004-09-04 19:32:23 +00:00
|
|
|
if ($user->data['user_avatar'] && $filename != $user->data['user_avatar'] && $user->data['user_avatar_type'] != AVATAR_GALLERY)
|
2003-05-27 00:46:10 +00:00
|
|
|
{
|
2003-11-10 14:18:54 +00:00
|
|
|
avatar_delete($user->data['user_avatar']);
|
2003-05-27 00:46:10 +00:00
|
|
|
}
|
2003-05-27 00:37:15 +00:00
|
|
|
}
|
2003-05-20 13:24:23 +00:00
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
meta_refresh(3, $this->u_action);
|
|
|
|
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
2003-05-26 23:53:34 +00:00
|
|
|
trigger_error($message);
|
2003-05-20 13:24:23 +00:00
|
|
|
}
|
2003-05-26 23:53:34 +00:00
|
|
|
|
|
|
|
extract($data);
|
|
|
|
unset($data);
|
2004-09-04 19:32:23 +00:00
|
|
|
|
|
|
|
// Replace "error" strings with their real, localised form
|
2004-10-13 19:30:02 +00:00
|
|
|
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
2003-05-20 13:24:23 +00:00
|
|
|
}
|
|
|
|
|
2003-06-02 17:27:38 +00:00
|
|
|
// Generate users avatar
|
2003-05-26 23:53:34 +00:00
|
|
|
$avatar_img = '';
|
2005-12-04 20:25:51 +00:00
|
|
|
|
2003-05-26 23:53:34 +00:00
|
|
|
if ($user->data['user_avatar'])
|
|
|
|
{
|
|
|
|
switch ($user->data['user_avatar_type'])
|
|
|
|
{
|
|
|
|
case AVATAR_UPLOAD:
|
2003-10-15 17:43:07 +00:00
|
|
|
$avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
|
2005-12-04 20:25:51 +00:00
|
|
|
break;
|
|
|
|
|
2003-05-26 23:53:34 +00:00
|
|
|
case AVATAR_GALLERY:
|
2003-10-15 17:43:07 +00:00
|
|
|
$avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
|
2005-12-04 20:25:51 +00:00
|
|
|
break;
|
2003-05-26 23:53:34 +00:00
|
|
|
}
|
|
|
|
$avatar_img .= $user->data['user_avatar'];
|
2003-09-08 23:24:01 +00:00
|
|
|
|
2005-12-04 20:25:51 +00:00
|
|
|
$avatar_img = '<img src="' . $avatar_img . '" width="' . $user->data['user_avatar_width'] . '" height="' . $user->data['user_avatar_height'] . '" alt="" />';
|
2003-05-26 23:53:34 +00:00
|
|
|
}
|
2003-05-20 13:24:23 +00:00
|
|
|
|
2003-05-19 15:23:04 +00:00
|
|
|
$template->assign_vars(array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
|
|
'AVATAR' => $avatar_img,
|
|
|
|
'AVATAR_SIZE' => $config['avatar_filesize'],
|
2003-10-15 17:43:07 +00:00
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '',
|
2003-10-15 17:43:07 +00:00
|
|
|
|
|
|
|
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),)
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
|
|
|
|
2003-10-15 17:43:07 +00:00
|
|
|
if ($display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'])
|
|
|
|
{
|
2005-12-04 20:25:51 +00:00
|
|
|
avatar_gallery($category, $avatar_select, 4);
|
2003-10-15 17:43:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$template->assign_vars(array(
|
2004-09-01 15:47:46 +00:00
|
|
|
'AVATAR' => $avatar_img,
|
|
|
|
'AVATAR_SIZE' => $config['avatar_filesize'],
|
|
|
|
'WIDTH' => (isset($width)) ? $width : $user->data['user_avatar_width'],
|
|
|
|
'HEIGHT' => (isset($height)) ? $height : $user->data['user_avatar_height'],
|
2003-10-15 17:43:07 +00:00
|
|
|
|
|
|
|
'S_UPLOAD_AVATAR_FILE' => $can_upload,
|
2004-09-01 15:47:46 +00:00
|
|
|
'S_UPLOAD_AVATAR_URL' => $can_upload,
|
|
|
|
'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
|
2005-12-04 20:25:51 +00:00
|
|
|
'S_GALLERY_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false)
|
2003-10-15 17:43:07 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-07-06 16:46:53 +00:00
|
|
|
break;
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$template->assign_vars(array(
|
2004-05-26 20:16:20 +00:00
|
|
|
'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)],
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2003-10-15 17:43:07 +00:00
|
|
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
2006-06-06 20:53:46 +00:00
|
|
|
'S_UCP_ACTION' => $this->u_action)
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
// Set desired template
|
|
|
|
$this->tpl_name = 'ucp_profile_' . $mode;
|
2006-06-12 22:16:27 +00:00
|
|
|
$this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|