aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/auth/auth_apache.php4
-rw-r--r--phpBB/includes/auth/auth_db.php4
-rw-r--r--phpBB/includes/auth/auth_ldap.php4
-rw-r--r--phpBB/includes/functions.php9
-rw-r--r--phpBB/includes/functions_user.php48
-rw-r--r--phpBB/includes/session.php103
-rw-r--r--phpBB/includes/ucp/ucp_activate.php124
-rw-r--r--phpBB/includes/ucp/ucp_profile.php89
-rw-r--r--phpBB/includes/ucp/ucp_register.php6
-rw-r--r--phpBB/includes/ucp/ucp_remind.php7
10 files changed, 269 insertions, 129 deletions
diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php
index d9b00f5435..3a9fa90cd9 100644
--- a/phpBB/includes/auth/auth_apache.php
+++ b/phpBB/includes/auth/auth_apache.php
@@ -20,7 +20,7 @@ function login_apache(&$username, &$password)
if ($php_auth_user && $php_auth_pw)
{
- $sql = ' user_id, username, user_password, user_passchg, user_email, user_active
+ $sql = ' user_id, username, user_password, user_passchg, user_email, user_type
FROM ' . USERS_TABLE . "
WHERE username = '" . $db->sql_escape($username) . "'";
$result = $db->sql_query($sql);
@@ -28,7 +28,7 @@ function login_apache(&$username, &$password)
if ($row = $db->sql_fetchrow($result))
{
$db->sql_freeresult($result);
- return (empty($row['user_active'])) ? 0 : $row;
+ return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? 0 : $row;
}
}
diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php
index 927c3ecfe7..998565ede5 100644
--- a/phpBB/includes/auth/auth_db.php
+++ b/phpBB/includes/auth/auth_db.php
@@ -14,7 +14,7 @@ function login_db(&$username, &$password)
{
global $db, $config;
- $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_active
+ $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
FROM ' . USERS_TABLE . "
WHERE username = '" . $db->sql_escape($username) . "'";
$result = $db->sql_query($sql);
@@ -24,7 +24,7 @@ function login_db(&$username, &$password)
$db->sql_freeresult($result);
if (md5($password) == $row['user_password'])
{
- return (empty($row['user_active'])) ? 0 : $row;
+ return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? 0 : $row;
}
}
diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php
index 1b89a02d20..13b3d2b0b1 100644
--- a/phpBB/includes/auth/auth_ldap.php
+++ b/phpBB/includes/auth/auth_ldap.php
@@ -34,7 +34,7 @@ function login_ldap(&$username, &$password)
{
@ldap_close($ldap);
- $sql ='SELECT user_id, username, user_password, user_passchg, user_email, user_active
+ $sql ='SELECT user_id, username, user_password, user_passchg, user_email, user_type
FROM ' . USERS_TABLE . "
WHERE username = '" . $db->sql_escape($username) . "'";
$result = $db->sql_query($sql);
@@ -42,7 +42,7 @@ function login_ldap(&$username, &$password)
if ($row = $db->sql_fetchrow($result))
{
$db->sql_freeresult($result);
- return (empty($row['user_active'])) ? 0 : $row;
+ return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? 0 : $row;
}
}
}
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 09971fc92e..dac19939ba 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1236,16 +1236,15 @@ function page_header($page_title = '')
if (!empty($config['load_online']) && !empty($config['load_online_time']))
{
$userlist_ary = $userlist_visible = array();
- $logged_visible_online = $logged_hidden_online = $guests_online = 0;
-
- $prev_user_id = 0;
+ $logged_visible_online = $logged_hidden_online = $guests_online = $prev_user_id = 0;
$prev_user_ip = $reading_sql = '';
+
if (!empty($_REQUEST['f']))
{
$reading_sql = "AND s.session_page LIKE '%f=" . intval($_REQUEST['f']) . "%'";
}
- $sql = 'SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_colour, s.session_ip, s.session_allow_viewonline
+ $sql = 'SELECT u.username, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour, s.session_ip, s.session_allow_viewonline
FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . ' s
WHERE s.session_time >= ' . (time() - (intval($config['load_online_time']) * 60)) . "
$reading_sql
@@ -1279,7 +1278,7 @@ function page_header($page_title = '')
if ($row['user_allow_viewonline'] || $auth->acl_get('u_viewonline'))
{
- $user_online_link = "<a href=\"memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '">' . $user_online_link . '</a>';
+ $user_online_link = ($row['user_type'] <> USER_IGNORE) ? "<a href=\"memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '">' . $user_online_link . '</a>' : $user_online_link;
$online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;
}
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index bab4ccf08a..1c501b0430 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -357,7 +357,7 @@ function avatar_upload($data, &$error)
}
unset($url_ary);
- $tmp_path = (!@ini_get('safe_mode')) ? false : $phpbb_root_path . 'cache/tmp';
+ $tmp_path = (!@ini_get('safe_mode')) ? false : $phpbb_root_path . 'cache';
$filename = tempnam($tmp_path, uniqid(rand()) . '-');
if (!($fp = @fopen($filename, 'wb')))
@@ -389,7 +389,7 @@ function avatar_upload($data, &$error)
// Replace any chars which may cause us problems with _
$bad_chars = array(' ', '/', ':', '*', '?', '"', '<', '>', '|');
- $data['filename'] = $user->data['user_id'] . '_' . str_replace($bad_chars, '_', $realname) . '.' . $filetype;
+ $data['filename'] = $data['user_id'] . '_' . str_replace($bad_chars, '_', $realname) . '.' . $filetype;
$data['width'] = $width;
$data['height'] = $height;
@@ -415,6 +415,48 @@ function avatar_upload($data, &$error)
return $data;
}
+function avatar_gallery($category, &$error)
+{
+ global $config;
+
+ $path = $phpbb_root_path . $config['avatar_gallery_path'];
+
+ // To be replaced with SQL ... before M3 completion
+ $dp = @opendir($path);
+
+ $data = array();
+ $avatar_row_count = $avatar_col_count = 0;
+ while ($file = readdir($dp))
+ {
+ if ($file{0} != '.' && is_dir("$path/$file"))
+ {
+ $dp2 = @opendir("$path/$file");
+
+ while ($sub_file = readdir($dp2))
+ {
+ if (preg_match('#\.(gif$|png$|jpg|jpeg)$#i', $sub_file))
+ {
+ $data[$file][$avatar_row_count][$avatar_col_count]['file'] = "$file/$sub_file";
+ $data[$file][$avatar_row_count][$avatar_col_count]['name'] = ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $sub_file)));
+
+ $avatar_col_count++;
+ if ($avatar_col_count == 4)
+ {
+ $avatar_row_count++;
+ $avatar_col_count = 0;
+ }
+ }
+ }
+ closedir($dp2);
+ }
+ }
+ closedir($dp);
+
+ @ksort($data);
+
+ return $data;
+}
+
// Generates an alphanumeric random string of given length
function gen_rand_string($num_chars)
{
@@ -444,7 +486,7 @@ function add_to_group($action, $group_id, $user_id_ary, $username_ary, $colour,
$which_ary = ($user_id_ary) ? 'user_id_ary' : 'username_ary';
- if ($$which_ary && !is_array($$which_ary ))
+ if ($$which_ary && !is_array($$which_ary))
{
$user_id_ary = array($user_id_ary);
}
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 84f45dca3b..709e1c378c 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -137,23 +137,39 @@ class session
$sessiondata = array();
$current_time = time();
+ $bot = false;
- if ($config['active_sessions'])
- {
- // Limit sessions in 1 minute period
- $sql = 'SELECT COUNT(*) AS sessions
- FROM ' . SESSIONS_TABLE . '
- WHERE session_time >= ' . ($current_time - 60);
- $result = $db->sql_query($sql);
+ // Pull bot information from DB and loop through it
+ $sql = 'SELECT user_id, bot_agent, bot_ip
+ FROM phpbb_bots
+ WHERE bot_active = 1';
+ $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if ($row['bot_agent'] && $row['bot_agent'] == $this->browser)
+ {
+ $bot = $row['user_id'];
+ }
+ if ($row['bot_ip'] && (!$row['bot_agent'] || $bot))
+ {
+ foreach (explode(',', $row['bot_ip']) as $bot_ip)
+ {
+ if (strpos($this->ip, $bot_ip) === 0)
+ {
+ $bot = $row['user_id'];
+ break;
+ }
+ }
+ }
- if (intval($row['sessions']) > intval($config['active_sessions']))
+ if ($bot)
{
- trigger_error('BOARD_UNAVAILABLE');
+ $user_id = $bot;
+ break;
}
}
+ $db->sql_freeresult($result);
// Garbage collection ... remove old sessions updating user information
// if necessary. It means (potentially) 11 queries but only infrequently
@@ -163,7 +179,7 @@ class session
}
// Grab user data ... join on session if it exists for session time
- $sql = 'SELECT u.*, s.session_time
+ $sql = 'SELECT u.*, s.session_time, s.session_id
FROM (' . USERS_TABLE . ' u
LEFT JOIN ' . SESSIONS_TABLE . " s ON s.session_user_id = u.user_id)
WHERE u.user_id = $user_id
@@ -174,14 +190,37 @@ class session
$db->sql_freeresult($result);
// Check autologin request, is it valid?
- if (empty($this->data) || ($this->data['user_password'] != $autologin && !$set_autologin) || !$this->data['user_active'])
+ if (empty($this->data) || ($this->data['user_password'] != $autologin && !$set_autologin) || ($this->data['user_type'] == USER_INACTIVE && !$bot))
{
$autologin = '';
$this->data['user_id'] = $user_id = ANONYMOUS;
}
+ // If we're a bot then we'll re-use an existing id if available
+ if ($bot && $this->data['session_id'])
+ {
+ $this->session_id = $this->data['session_id'];
+ }
+
+ if (!$this->data['session_time'] && $config['active_sessions'])
+ {
+ // Limit sessions in 1 minute period
+ $sql = 'SELECT COUNT(*) AS sessions
+ FROM ' . SESSIONS_TABLE . '
+ WHERE session_time >= ' . ($current_time - 60);
+ $result = $db->sql_query($sql);
+
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if (intval($row['sessions']) > intval($config['active_sessions']))
+ {
+ trigger_error('BOARD_UNAVAILABLE');
+ }
+ }
+
// Is user banned? Are they excluded?
- if (!$this->data['user_founder'])
+ if (!$this->data['user_type'] != USER_FOUNDER && !$bot)
{
$banned = false;
@@ -259,18 +298,25 @@ class session
}
$db->sql_return_on_error(false);
- $this->data['session_id'] = $this->session_id;
+ if (!$bot)
+ {
+ $this->data['session_id'] = $this->session_id;
- $sessiondata['autologinid'] = ($autologin && $user_id != ANONYMOUS) ? $autologin : '';
- $sessiondata['userid'] = $user_id;
+ $sessiondata['autologinid'] = ($autologin && $user_id != ANONYMOUS) ? $autologin : '';
+ $sessiondata['userid'] = $user_id;
- $this->set_cookie('data', serialize($sessiondata), $current_time + 31536000);
- $this->set_cookie('sid', $this->session_id, 0);
- $SID = '?sid=' . $this->session_id;
+ $this->set_cookie('data', serialize($sessiondata), $current_time + 31536000);
+ $this->set_cookie('sid', $this->session_id, 0);
+ $SID = '?sid=' . $this->session_id;
- if ($this->data['user_id'] != ANONYMOUS)
+ if ($this->data['user_id'] != ANONYMOUS)
+ {
+ // Trigger EVT_NEW_SESSION
+ }
+ }
+ else
{
- // Trigger EVT_NEW_SESSION
+ $SID = '?sid=';
}
return true;
@@ -729,7 +775,7 @@ class auth
$db->sql_freeresult($result);
// If this user is founder we're going to force fill the admin options ...
- if ($userdata['user_founder'])
+ if ($userdata['user_type'] == USER_FOUNDER)
{
foreach ($this->acl_options['global'] as $opt => $id)
{
@@ -833,15 +879,8 @@ class auth
$autologin = (!empty($autologin)) ? md5($password) : '';
- if ($login['user_active'])
- {
- // Trigger EVENT_LOGIN
- return $user->create($login['user_id'], $autologin, true, $viewonline);
- }
- else
- {
- return false;
- }
+ // Trigger EVENT_LOGIN
+ return $user->create($login['user_id'], $autologin, true, $viewonline);
}
}
diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php
index dbd992fbf2..43d04eda4a 100644
--- a/phpBB/includes/ucp/ucp_activate.php
+++ b/phpBB/includes/ucp/ucp_activate.php
@@ -3,7 +3,7 @@
//
// $Id$
//
-// FILENAME : usercp_activate.php
+// FILENAME : ucp_activate.php
// STARTED : Mon May 19, 2003
// COPYRIGHT : © 2001, 2003 phpBB Group
// WWW : http://www.phpbb.com/
@@ -13,74 +13,86 @@
class ucp_activate extends module
{
- function main($module_id)
+ function ucp_activate($id, $mode)
{
global $censors, $config, $db, $user, $auth, $SID, $template, $phpbb_root_path, $phpEx;
- $user_id = (isset($_REQUEST['u'])) ? intval($_REQUEST['u']) : false;
+ $user_id = request_var('u', 0);
+ $key = request_var('k', '');
- $sql = 'SELECT user_id, username, user_active, user_email, user_newpasswd, user_lang, user_actkey
+ $sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey
FROM ' . USERS_TABLE . "
WHERE user_id = $user_id";
$result = $db->sql_query($sql);
- if ($row = $db->sql_fetchrow($result))
+ if (!($row = $db->sql_fetchrow($result)))
{
- if ($row['user_active'] && $row['user_actkey'] == '')
- {
- meta_refresh(3, "index.$phpEx$SID");
- trigger_error($user->lang['Already_activated']);
- }
- else if ($row['user_actkey'] == $_GET['k'])
- {
- $sql_update_pass = ($row['user_newpasswd'] != '') ? ", user_password = '" . $db->sql_escape($row['user_newpasswd']) . "', user_newpasswd = ''" : '';
-
- $sql = 'UPDATE ' . USERS_TABLE . "
- SET user_active = 1, user_actkey = ''" . $sql_update_pass . "
- WHERE user_id = " . $row['user_id'];
- $result = $db->sql_query($sql);
-
- if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass == '')
- {
- $this->include_file('includes/emailer');
- $emailer = new emailer($config['smtp_delivery']);
-
- $emailer->use_template('admin_welcome_activated', $row['user_lang']);
- $emailer->to($row['user_email']);
-
- $emailer->assign_vars(array(
- 'SITENAME' => $config['sitename'],
- 'USERNAME' => $row['username'],
- 'PASSWORD' => $password_confirm,
- 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']))
- );
- $emailer->send();
- $emailer->reset();
-
- meta_refresh(3, "index.$phpEx$SID");
- trigger_error($user->lang['Account_active_admin']);
- }
- else
- {
- meta_refresh(3, "index.$phpEx$SID");
- $message = (!$sql_update_pass) ? $user->lang['ACCOUNT_ACTIVE'] : $user->lang['PASSWORD_ACTIVATED'];
- trigger_error($message);
- }
-
- set_config('newest_user_id', $row['user_id']);
- set_config('newest_username', $row['username']);
- set_config('num_users', $config['num_users'] + 1, TRUE);
- }
- else
- {
- trigger_error($user->lang['Wrong_activation']);
- }
+ trigger_error($user->lang['NO_USER']);
+ }
+ $db->sql_freeresult($result);
+
+ if ($row['user_type'] <> USER_INACTIVE && !$row['user_newpasswd'])
+ {
+ meta_refresh(3, "index.$phpEx$SID");
+ trigger_error($user->lang['ALREADY_ACTIVATED']);
+ }
+
+ if ($row['user_actkey'] != $key)
+ {
+ trigger_error($user->lang['WRONG_ACTIVATION']);
+ }
+
+ $sql_update_pass = ($row['user_newpasswd']) ? ", user_password = '" . $db->sql_escape($row['user_newpasswd']) . "', user_newpasswd = ''" : '';
+
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_type = ' . USER_NORMAL . ", user_actkey = ''$sql_update_pass
+ WHERE user_id = " . $row['user_id'];
+ $result = $db->sql_query($sql);
+
+ if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass)
+ {
+ include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
+
+ $messenger = new messenger();
+
+ $messenger->template('admin_welcome_activated', $row['user_lang']);
+ $messenger->subject($subject);
+
+ $messenger->replyto($user->data['board_contact']);
+ $messenger->to($row['user_email'], $row['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'],
+ 'USERNAME' => $row['username'],
+ 'PASSWORD' => $password_confirm,
+ 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']))
+ );
+
+ $messenger->send($row['user_notify_type']);
+ $messenger->queue->save();
+
+ $message = 'ACCOUNT_ACTIVE_ADMIN';
+
}
else
{
- trigger_error($user->lang['NO_USER']);
+ $message = (!$sql_update_pass) ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED';
}
- $db->sql_freeresult($result);
+
+ if (!$sql_update_pass)
+ {
+ set_config('newest_user_id', $row['user_id']);
+ set_config('newest_username', $row['username']);
+ set_config('num_users', $config['num_users'] + 1, TRUE);
+ }
+
+ meta_refresh(3, "index.$phpEx$SID");
+ trigger_error($user->lang[$message]);
}
}
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index 367c0dd6d5..f78ae8c5db 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -91,6 +91,9 @@ class ucp_profile extends module
update_username($user->data['username'], $username);
}
+ // TODO
+ // If email changed and email activation enabled, deactivate and notify
+
meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode");
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode\">", '</a>');
trigger_error($message);
@@ -358,6 +361,9 @@ class ucp_profile extends module
case 'avatar':
+ $display_gallery = (isset($_POST['displaygallery'])) ? true : false;
+ $avatar_category = request_var('category', '');
+
// Can we upload?
$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;
@@ -386,6 +392,8 @@ class ucp_profile extends module
if (!sizeof($error))
{
+ $data['user_id'] = $user->data['user_id'];
+
if (!empty($_FILES['uploadfile']['tmp_name']) && $can_upload)
{
$data = avatar_upload($data, $error);
@@ -444,10 +452,10 @@ class ucp_profile extends module
switch ($user->data['user_avatar_type'])
{
case AVATAR_UPLOAD:
- $avatar_img = $config['avatar_path'] . '/';
+ $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
break;
case AVATAR_GALLERY:
- $avatar_img = $config['avatar_gallery_path'] . '/';
+ $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
break;
}
$avatar_img .= $user->data['user_avatar'];
@@ -457,37 +465,76 @@ class ucp_profile extends module
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
-
'AVATAR' => $avatar_img,
'AVATAR_SIZE' => $config['avatar_filesize'],
- 'AVATAR_URL' => (isset($uploadurl)) ? $uploadurl : '',
- 'AVATAR_REMOTE' => (isset($remotelink)) ? $remotelink : (($user->data['user_avatar_type'] == AVATAR_REMOTE) ? $user->data['user_avatar'] : ''),
- 'WIDTH' => (isset($width)) ? $width : $user->data['user_avatar_width'],
- 'HEIGHT' => (isset($height)) ? $height : $user->data['user_avatar_height'],
-
- 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),
-
- 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '',
- 'S_UPLOAD_AVATAR_FILE' => $can_upload,
- 'S_UPLOAD_AVATAR_URL' => $can_upload,
- 'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
- 'S_GALLERY_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false,
- 'S_AVATAR_CAT_OPTIONS' => $s_categories,
- 'S_AVATAR_PAGE_OPTIONS' => $s_pages,)
+
+ 'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '',
+
+ 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),)
);
+ if ($display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'])
+ {
+ $avatar_list = avatar_gallery($category, $error);
+
+ $category = (!$category) ? key($avatar_list) : $category;
+
+ $s_category_options = '';
+ foreach (array_keys($avatar_list) as $cat)
+ {
+ $s_category_options .= '<option value="' . $cat . '">' . $cat . '</option>';
+ }
+
+ $template->assign_vars(array(
+ 'S_DISPLAY_GALLERY' => true,
+ 'S_CAT_OPTIONS' => $s_category_options)
+ );
+
+ foreach ($avatar_list[$category] as $avatar_row_ary)
+ {
+ $template->assign_block_vars('avatar_row', array());
+
+ foreach ($avatar_row_ary as $avatar_col_ary)
+ {
+ $template->assign_block_vars('avatar_row.avatar_column', array(
+ 'AVATAR_IMAGE' => $phpbb_root_path . $config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'],
+ 'AVATAR_NAME' => $avatar_col_ary['name'])
+ );
+
+ $template->assign_block_vars('avatar_row.avatar_option_column', array(
+ 'AVATAR_IMAGE' => $phpbb_root_path . $config['avatar_gallery_path'] . '/' . $avatar_col_ary['file'],)
+ );
+ }
+ }
+ }
+ else
+ {
+ $template->assign_vars(array(
+ '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'],
+
+ 'S_UPLOAD_AVATAR_FILE' => $can_upload,
+ 'S_UPLOAD_AVATAR_URL' => $can_upload,
+ 'S_LINK_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) ? true : false,
+ 'S_GALLERY_AVATAR' => ($auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) ? true : false,
+ 'S_AVATAR_CAT_OPTIONS' => $s_categories,
+ 'S_AVATAR_PAGE_OPTIONS' => $s_pages,)
+ );
+ }
+
break;
}
$template->assign_vars(array(
'L_TITLE' => $user->lang['UCP_' . strtoupper($mode)],
- 'S_DISPLAY_' . strtoupper($mode) => true,
- 'S_HIDDEN_FIELDS' => $s_hidden_fields,
- 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode")
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields,
+ 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id&amp;mode=$mode")
);
- $this->display($user->lang['UCP_PROFILE'], 'ucp_profile.html');
+ $this->display($user->lang['UCP_PROFILE'], 'ucp_profile_' . $mode . '.html');
}
}
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index a6742d8687..c6be2e8b05 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -152,11 +152,11 @@ class ucp_register extends module
$key_len = 54 - (strlen($server_url));
$key_len = ($key_len > 6) ? $key_len : 6;
$user_actkey = substr($user_actkey, 0, $key_len);
- $user_active = 0;
+ $user_type = USER_INACTIVE;
}
else
{
- $user_active = 1;
+ $user_type = USER_NORMAL;
$user_actkey = '';
}
@@ -170,7 +170,7 @@ class ucp_register extends module
'user_timezone' => (float) $tz,
'user_lang' => $lang,
'user_allow_pm' => 1,
- 'user_active' => $user_active,
+ 'user_type' => $user_type,
'user_actkey' => $user_actkey,
'user_ip' => $user->ip,
'user_regdate' => time(),
diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php
index 98b44640c1..80b863b321 100644
--- a/phpBB/includes/ucp/ucp_remind.php
+++ b/phpBB/includes/ucp/ucp_remind.php
@@ -24,7 +24,7 @@ class ucp_remind extends module
$username = request_var('username', '');
$email = request_var('email', '');
- $sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type, user_active, user_lang
+ $sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type, user_type, user_lang
FROM ' . USERS_TABLE . "
WHERE user_email = '" . $db->sql_escape($email) . "'
AND username = '" . $db->sql_escape($username) . "'";
@@ -39,13 +39,14 @@ class ucp_remind extends module
}
$db->sql_freeresult($result);
- if (!$row['user_active'])
+ if ($row['user_type'] == USER_INACTIVE)
{
trigger_error($lang['ACCOUNT_INACTIVE']);
}
$server_url = generate_board_url();
$username = $row['username'];
+ $user_id = $row['user_id'];
$key_len = 54 - strlen($server_url);
$key_len = ($str_len > 6) ? $key_len : 6;
@@ -74,7 +75,7 @@ class ucp_remind extends module
'PASSWORD' => $user_password,
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
- 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&k=$user_actkey")
+ 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
);
$messenger->send($row['user_notify_type']);