mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 11:13:59 +02:00
Majority are UCP related updates ... avatars should now work, aside from gallery, fixed a few other issues, updated schema/basic
git-svn-id: file:///svn/phpbb/trunk@4062 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -17,9 +17,7 @@
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
class ucp_activate extends ucp
|
||||
{
|
||||
@@ -42,7 +40,7 @@ class ucp_activate extends ucp
|
||||
else if ($row['user_actkey'] == $_GET['k'])
|
||||
{
|
||||
$sql_update_pass = ($row['user_newpasswd'] != '') ? ", user_password = '" . $db->sql_escape($row['user_newpasswd']) . "', user_newpasswd = ''" : '';
|
||||
|
||||
z
|
||||
$sql = "UPDATE " . USERS_TABLE . "
|
||||
SET user_active = 1, user_actkey = ''" . $sql_update_pass . "
|
||||
WHERE user_id = " . $row['user_id'];
|
||||
|
@@ -144,8 +144,92 @@ class ucp_main extends ucp
|
||||
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
*/
|
||||
|
||||
$user_id = $user->data['user_id'];
|
||||
|
||||
// Grab all the relevant data
|
||||
$sql = "SELECT COUNT(p.post_id) AS num_posts
|
||||
FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f
|
||||
WHERE p.poster_id = $user_id
|
||||
AND f.forum_id = p.forum_id
|
||||
$post_count_sql";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$num_real_posts = min($row['user_posts'], $db->sql_fetchfield('num_posts', 0, $result));
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "SELECT f.forum_id, f.forum_name, COUNT(post_id) AS num_posts
|
||||
FROM " . POSTS_TABLE . " p, " . FORUMS_TABLE . " f
|
||||
WHERE p.poster_id = $user_id
|
||||
AND f.forum_id = p.forum_id
|
||||
$post_count_sql
|
||||
GROUP BY f.forum_id, f.forum_name
|
||||
ORDER BY num_posts DESC";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
|
||||
$active_f_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = "SELECT t.topic_id, t.topic_title, COUNT(p.post_id) AS num_posts
|
||||
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
|
||||
WHERE p.poster_id = $user_id
|
||||
AND t.topic_id = p.topic_id
|
||||
AND f.forum_id = t.forum_id
|
||||
$post_count_sql
|
||||
GROUP BY t.topic_id, t.topic_title
|
||||
ORDER BY num_posts DESC";
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
|
||||
$active_t_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Do the relevant calculations
|
||||
$memberdays = max(1, round((time() - $row['user_regdate']) / 86400));
|
||||
$posts_per_day = $row['user_posts'] / $memberdays;
|
||||
$percentage = ($config['num_posts']) ? min(100, ($num_real_posts / $config['num_posts']) * 100) : 0;
|
||||
|
||||
$active_f_name = $active_f_id = $active_f_count = $active_f_pct = '';
|
||||
if (!empty($active_f_row['num_posts']))
|
||||
{
|
||||
$active_f_name = $active_f_row['forum_name'];
|
||||
$active_f_id = $active_f_row['forum_id'];
|
||||
$active_f_count = $active_f_row['num_posts'];
|
||||
$active_f_pct = ($active_f_count / $row['user_posts']) * 100;
|
||||
}
|
||||
unset($active_f_row);
|
||||
|
||||
$active_t_name = $active_t_id = $active_t_count = $active_t_pct = '';
|
||||
if (!empty($active_t_row['num_posts']))
|
||||
{
|
||||
$active_t_name = $active_t_row['topic_title'];
|
||||
$active_t_id = $active_t_row['topic_id'];
|
||||
$active_t_count = $active_t_row['num_posts'];
|
||||
$active_t_pct = ($active_t_count / $row['user_posts']) * 100;
|
||||
}
|
||||
unset($active_t_row);
|
||||
|
||||
$template->assign_vars(show_profile($row));
|
||||
|
||||
$template->assign_vars(array(
|
||||
'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
|
||||
'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
|
||||
'ACTIVE_FORUM' => $active_f_name,
|
||||
'ACTIVE_FORUM_POSTS'=> ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count),
|
||||
'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct),
|
||||
'ACTIVE_TOPIC' => $active_t_name,
|
||||
'ACTIVE_TOPIC_POSTS'=> ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count),
|
||||
'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct),
|
||||
|
||||
'OCCUPATION' => (!empty($row['user_occ'])) ? $row['user_occ'] : '',
|
||||
'INTERESTS' => (!empty($row['user_interests'])) ? $row['user_interests'] : '',
|
||||
|
||||
'S_PROFILE_ACTION' => "groupcp.$phpEx$SID",
|
||||
'S_GROUP_OPTIONS' => $group_options,
|
||||
|
||||
'U_ACTIVE_FORUM' => "viewforum.$phpEx$SID&f=$active_f_id",
|
||||
'U_ACTIVE_TOPIC' => "viewtopic.$phpEx$SID&t=$active_t_id",)
|
||||
);
|
||||
*/
|
||||
break;
|
||||
|
||||
case 'watched':
|
||||
|
@@ -64,7 +64,7 @@ class ucp_prefs extends ucp
|
||||
if (!sizeof($this->error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'user_viewemail' => $data['viewemail'],
|
||||
'user_allow_viewemail' => $data['viewemail'],
|
||||
'user_allow_viewonline' => !$data['hideonline'],
|
||||
'user_notify_pm' => $data['notifypm'],
|
||||
'user_popup_pm' => $data['popuppm'],
|
||||
@@ -90,7 +90,7 @@ class ucp_prefs extends ucp
|
||||
unset($data);
|
||||
}
|
||||
|
||||
$view_email = (isset($viewemail)) ? $viewemail : $user->data['user_viewemail'];
|
||||
$view_email = (isset($viewemail)) ? $viewemail : $user->data['user_allow_viewemail'];
|
||||
$view_email_yes = ($viewemail) ? ' checked="checked"' : '';
|
||||
$view_email_no = (!$viewemail) ? ' checked="checked"' : '';
|
||||
$hideonline = (isset($hideonline)) ? $hideonline : !$user->data['user_allow_viewonline'];
|
||||
|
@@ -45,23 +45,29 @@ class ucp_profile extends ucp
|
||||
$data = array();
|
||||
$normalise = array(
|
||||
'string' => array(
|
||||
'username' => '2,30',
|
||||
'username' => $config['min_name_chars'] . ',' . $config['max_name_chars'],
|
||||
'password_confirm' => $config['min_pass_chars'] . ',' . $config['max_pass_chars'],
|
||||
'new_password' => $config['min_pass_chars'] . ',' . $config['max_pass_chars'],
|
||||
'cur_password' => $config['min_pass_chars'] . ',' . $config['max_pass_chars'],
|
||||
'email' => '7,60',
|
||||
'email_confirm' => '7,60',
|
||||
'password_confirm' => '6,255',
|
||||
'new_password' => '6,255',
|
||||
'cur_password' => '6,255',
|
||||
)
|
||||
);
|
||||
$data = $this->normalise_data($_POST, $normalise);
|
||||
|
||||
// md5 current password for checking
|
||||
$data['cur_password'] = md5($data['cur_password']);
|
||||
|
||||
$validate = array(
|
||||
'reqd' => array('username', 'email'),
|
||||
'compare' => array(
|
||||
'password_confirm' => ($data['new_password']) ? $data['new_password'] : '',
|
||||
'cur_password' => ($data['new_password'] || $data['email'] != $user->data['user_email']) ? $user->data['user_password'] : '',
|
||||
'cur_password' => ($data['new_password'] || $data['email'] != $user->data['user_email'] || $data['username'] != $user->data['username']) ? $user->data['user_password'] : '',
|
||||
'email_confirm' => ($data['email'] != $user->data['user_email']) ? $data['email'] : '',
|
||||
),
|
||||
'match' => array(
|
||||
'username' => ($data['username'] != $user->data['username']) ? '#^' . str_replace('\\\\', '\\', $config['allow_name_chars']) . '$#iu' : '',
|
||||
),
|
||||
'function' => array(
|
||||
'username' => ($data['username'] != $user->data['username']) ? 'validate_username' : '',
|
||||
'email' => ($data['email'] != $user->data['user_email']) ? 'validate_email' : '',
|
||||
@@ -82,6 +88,12 @@ class ucp_profile extends ucp
|
||||
WHERE user_id = ' . $user->data['user_id'];
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Need to update config, forum, topic, posting, messages, etc.
|
||||
if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') & $config['allow_namechange'])
|
||||
{
|
||||
$this->update_username($user->data['username'], $data['username']);
|
||||
}
|
||||
|
||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
||||
trigger_error($message);
|
||||
@@ -92,14 +104,19 @@ class ucp_profile extends ucp
|
||||
unset($data);
|
||||
}
|
||||
|
||||
$user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS');
|
||||
|
||||
$template->assign_vars(array(
|
||||
'ERROR' => (sizeof($this->error)) ? implode('<br />', $this->error) : '',
|
||||
|
||||
'USERNAME' => (isset($username)) ? $username : $user->data['username'],
|
||||
'EMAIL' => (isset($email)) ? $email : $user->data['user_email'],
|
||||
'NEW_PASSWORD' => (isset($new_password)) ? $new_password : '',
|
||||
'USERNAME' => (isset($username)) ? stripslashes($username) : $user->data['username'],
|
||||
'EMAIL' => (isset($email)) ? stripslashes($email) : $user->data['user_email'],
|
||||
'NEW_PASSWORD' => (isset($new_password)) ? stripslashes($new_password) : '',
|
||||
'CUR_PASSWORD' => '',
|
||||
'PASSWORD_CONFIRM' => (isset($password_confirm)) ? $password_confirm : '',
|
||||
'PASSWORD_CONFIRM' => (isset($password_confirm)) ? stripslashes($password_confirm) : '',
|
||||
|
||||
'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']),
|
||||
|
||||
'S_CHANGE_USERNAME' => $config['allow_namechange'] & $auth->acl_get('u_chgname'),
|
||||
'S_CHANGE_EMAIL' => $auth->acl_get('u_chgemail'),
|
||||
@@ -329,85 +346,123 @@ class ucp_profile extends ucp
|
||||
|
||||
case 'avatar':
|
||||
|
||||
$dir = @opendir($config['avatar_gallery_path']);
|
||||
|
||||
$avatar_images = array();
|
||||
while( $file = @readdir($dir) )
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
if( $file != '.' && $file != '..' && !is_file($config['avatar_gallery_path'] . '/' . $file) && !is_link($config['avatar_gallery_path'] . '/' . $file) )
|
||||
$data = array();
|
||||
if (!empty($_FILES['uploadfile']['tmp_name']))
|
||||
{
|
||||
$sub_dir = @opendir($config['avatar_gallery_path'] . '/' . $file);
|
||||
|
||||
$avatar_row_count = 0;
|
||||
$avatar_col_count = 0;
|
||||
while( $sub_file = @readdir($sub_dir) )
|
||||
{
|
||||
if( preg_match('#(\.gif$|\.png$|\.jpg|\.jpeg)$#i', $sub_file) )
|
||||
{
|
||||
$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file;
|
||||
$avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));
|
||||
|
||||
$avatar_col_count++;
|
||||
if( $avatar_col_count == 4 )
|
||||
{
|
||||
$avatar_row_count++;
|
||||
$avatar_col_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->avatar_upload($data);
|
||||
}
|
||||
}
|
||||
|
||||
@closedir($dir);
|
||||
|
||||
@ksort($avatar_images);
|
||||
@reset($avatar_images);
|
||||
|
||||
$category = (isset($_POST['avatarcat'])) ? htmlspecialchars($_POST['avatarcat']) : '';
|
||||
if( empty($category) )
|
||||
{
|
||||
list($category, ) = each($avatar_images);
|
||||
}
|
||||
@reset($avatar_images);
|
||||
|
||||
$s_categories = '';
|
||||
while( list($key) = each($avatar_images) )
|
||||
{
|
||||
$selected = ( $key == $category ) ? ' selected="selected"' : '';
|
||||
if( count($avatar_images[$key]) )
|
||||
else if (!empty($_POST['uploadurl']))
|
||||
{
|
||||
$s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>';
|
||||
$normalise = array(
|
||||
'string' => array(
|
||||
'uploadurl' => '1,255',
|
||||
)
|
||||
);
|
||||
$data = $this->normalise_data($_POST, $normalise);
|
||||
$this->avatar_upload($data);
|
||||
}
|
||||
else if (!empty($_POST['remotelink']))
|
||||
{
|
||||
$normalise = array(
|
||||
'string' => array(
|
||||
'remotelink' => '1,255',
|
||||
'width' => '1,3',
|
||||
'height' => '1,3',
|
||||
)
|
||||
);
|
||||
$data = $this->normalise_data($_POST, $normalise);
|
||||
$this->avatar_remote($data);
|
||||
}
|
||||
else if (!empty($_POST['delete']))
|
||||
{
|
||||
$data['filename'] = $data['width'] = $data['height'] = '';
|
||||
$this->avatar_delete();
|
||||
}
|
||||
|
||||
if (!sizeof($this->error))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'user_avatar' => $data['filename'],
|
||||
'user_avatar_type' => $data['type'],
|
||||
'user_avatar_width' => $data['width'],
|
||||
'user_avatar_height' => $data['height'],
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_id = ' . $user->data['user_id'];
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Delete an existing avatar if present
|
||||
$this->avatar_delete();
|
||||
|
||||
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$submode");
|
||||
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&i=$id&mode=$submode\">", '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
//
|
||||
extract($data);
|
||||
unset($data);
|
||||
}
|
||||
|
||||
$s_colspan = 0;
|
||||
for($i = 0; $i < count($avatar_images[$category]); $i++)
|
||||
/*
|
||||
for ($i = 0; $i < count($avatar_images[$category]); $i++)
|
||||
{
|
||||
$template->assign_block_vars('avatar_row', array());
|
||||
|
||||
$s_colspan = max($s_colspan, count($avatar_images[$category][$i]));
|
||||
|
||||
for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
|
||||
for ($j = 0; $j < count($avatar_images[$category][$i]); $j++)
|
||||
{
|
||||
$template->assign_block_vars('avatar_row.avatar_column', array(
|
||||
"AVATAR_IMAGE" => $config['avatar_gallery_path'] . '/' . $avatar_images[$category][$i][$j],
|
||||
"AVATAR_NAME" => $avatar_name[$category][$i][$j])
|
||||
'AVATAR_IMAGE' => $config['avatar_gallery_path'] . '/' . $avatar_images[$category][$i][$j],
|
||||
'AVATAR_NAME' => $avatar_name[$category][$i][$j])
|
||||
);
|
||||
|
||||
$template->assign_block_vars('avatar_row.avatar_option_column', array(
|
||||
"S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
|
||||
'S_OPTIONS_AVATAR' => $avatar_images[$category][$i][$j])
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$avatar_img = '';
|
||||
if ($user->data['user_avatar'])
|
||||
{
|
||||
switch ($user->data['user_avatar_type'])
|
||||
{
|
||||
case AVATAR_UPLOAD:
|
||||
$avatar_img = $config['avatar_path'] . '/';
|
||||
break;
|
||||
case AVATAR_GALLERY:
|
||||
$avatar_img = $config['avatar_gallery_path'] . '/';
|
||||
break;
|
||||
}
|
||||
$avatar_img .= $user->data['user_avatar'];
|
||||
|
||||
$avatar_img = '<img src="' . $avatar_img . '" width="' . $user->data['user_avatar_width'] . '" height="' . $user->data['user_avatar_height'] . '" border="0" alt="" />';
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'AVATAR' => '<img src="images/avatars/upload/' . $user->data['user_avatar'] . '" />',
|
||||
'ERROR' => (sizeof($this->error)) ? implode('<br />', $this->error) : '',
|
||||
|
||||
'S_AVATAR_CAT_OPTIONS' => $s_categories,
|
||||
'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) ? $avatar_img : ''),
|
||||
'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' => ' enctype="multipart/form-data"',
|
||||
'S_UPLOAD_AVATAR_FILE' => true,
|
||||
'S_UPLOAD_AVATAR_URL' => true,
|
||||
'S_LINK_AVATAR' => true,
|
||||
'S_GALLERY_AVATAR' => true,)
|
||||
'S_GALLERY_AVATAR' => false,
|
||||
'S_AVATAR_CAT_OPTIONS' => $s_categories,
|
||||
'S_AVATAR_PAGE_OPTIONS' => $s_pages,)
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -427,27 +482,6 @@ class ucp_profile extends ucp
|
||||
$this->display($user->lang['UCP_PROFILE'], 'ucp_profile.html');
|
||||
}
|
||||
|
||||
function check_image_type(&$type)
|
||||
{
|
||||
global $user;
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'jpeg':
|
||||
case 'pjpeg':
|
||||
case 'jpg':
|
||||
return '.jpg';
|
||||
case 'gif':
|
||||
return '.gif';
|
||||
case 'png':
|
||||
return '.png';
|
||||
case 'bmp':
|
||||
return '.bmp';
|
||||
}
|
||||
|
||||
$this->error[] = $user->lang['INVALID_IMAGETYPE'];
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -73,13 +73,13 @@ class ucp_register extends ucp
|
||||
{
|
||||
$normalise = array(
|
||||
'string' => array(
|
||||
'username' => '2,30',
|
||||
'username' => $config['min_name_chars'] . ',' . $config['max_name_chars'],
|
||||
'password_confirm' => $config['min_pass_chars'] . ',' . $config['max_pass_chars'],
|
||||
'new_password' => $config['min_pass_chars'] . ',' . $config['max_pass_chars'],
|
||||
'lang' => '1,50',
|
||||
'confirm_code' => '6,6',
|
||||
'email' => '7,60',
|
||||
'email_confirm' => '7,60',
|
||||
'new_password' => '6,255',
|
||||
'password_confirm' => '6,255',
|
||||
'lang' => '1,50',
|
||||
'confirm_code' => '6,6'
|
||||
),
|
||||
'int' => array('tz')
|
||||
);
|
||||
@@ -91,6 +91,9 @@ class ucp_register extends ucp
|
||||
'password_confirm' => $data['new_password'],
|
||||
'email_confirm' => $data['email'],
|
||||
),
|
||||
'match' => array(
|
||||
'username' => '#^' . str_replace('\\\\', '\\', $config['allow_name_chars']) . '$#iu',
|
||||
),
|
||||
'function' => array(
|
||||
'username' => 'validate_username',
|
||||
'email' => 'validate_email',
|
||||
@@ -139,8 +142,9 @@ class ucp_register extends ucp
|
||||
{
|
||||
$server_url = generate_board_url();
|
||||
|
||||
if ($coppa && ($config['require_activation'] == USER_ACTIVATION_SELF ||
|
||||
$config['require_activation'] == USER_ACTIVATION_ADMIN))
|
||||
if (($coppa ||
|
||||
$config['require_activation'] == USER_ACTIVATION_SELF ||
|
||||
$config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable'])
|
||||
{
|
||||
$user_actkey = $this->gen_rand_string(10);
|
||||
$key_len = 54 - (strlen($server_url));
|
||||
@@ -161,7 +165,7 @@ class ucp_register extends ucp
|
||||
'user_ip' => $user->ip,
|
||||
'user_regdate' => time(),
|
||||
'username' => $data['username'],
|
||||
'user_password' => $data['new_password'],
|
||||
'user_password' => md5($data['new_password']),
|
||||
'user_email' => $data['email'],
|
||||
'user_allow_pm' => 1,
|
||||
'user_timezone' => (float) $data['tz'],
|
||||
@@ -175,8 +179,10 @@ class ucp_register extends ucp
|
||||
|
||||
$user_id = $db->sql_nextid();
|
||||
|
||||
// Place into appropriate group, either REGISTERED or INACTIVE depending on config
|
||||
$group_name = ($config['require_activation'] == USER_ACTIVATION_NONE) ? 'REGISTERED' : 'INACTIVE';
|
||||
// Place into appropriate group, either REGISTERED(_COPPA) or INACTIVE(_COPPA) depending on config
|
||||
$group_reg = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';
|
||||
$group_inactive = ($coppa) ? 'INACTIVE_COPPA' : 'INACTIVE';
|
||||
$group_name = ($config['require_activation'] == USER_ACTIVATION_NONE) ? $group_reg : $group_inactive;
|
||||
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)
|
||||
SELECT $user_id, group_id, 0
|
||||
FROM " . GROUPS_TABLE . "
|
||||
@@ -186,17 +192,17 @@ class ucp_register extends ucp
|
||||
|
||||
$db->sql_transaction('commit');
|
||||
|
||||
if ($coppa)
|
||||
if ($coppa && $config['email_enable'])
|
||||
{
|
||||
$message = $user->lang['ACCOUNT_COPPA'];
|
||||
$email_template = 'coppa_welcome_inactive';
|
||||
}
|
||||
else if ($config['require_activation'] == USER_ACTIVATION_SELF)
|
||||
else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable'])
|
||||
{
|
||||
$message = $user->lang['ACCOUNT_INACTIVE'];
|
||||
$email_template = 'user_welcome_inactive';
|
||||
}
|
||||
else if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
|
||||
else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable'])
|
||||
{
|
||||
$message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
|
||||
$email_template = 'admin_welcome_inactive';
|
||||
@@ -235,7 +241,7 @@ class ucp_register extends ucp
|
||||
'SITENAME' => $config['sitename'])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$emailer->send();
|
||||
$emailer->reset();
|
||||
|
||||
@@ -257,7 +263,7 @@ class ucp_register extends ucp
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['require_activation'] == USER_ACTIVATION_NONE)
|
||||
if ($config['require_activation'] == USER_ACTIVATION_NONE || !$config['email_enable'])
|
||||
{
|
||||
set_config('newest_user_id', $user_id);
|
||||
set_config('newest_username', $data['username']);
|
||||
@@ -311,7 +317,7 @@ class ucp_register extends ucp
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['attempts'] > 5)
|
||||
if ($row['attempts'] > 3)
|
||||
{
|
||||
trigger_error($user->lang['TOO_MANY_REGISTERS']);
|
||||
}
|
||||
@@ -342,6 +348,8 @@ class ucp_register extends ucp
|
||||
break;
|
||||
}
|
||||
|
||||
$user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS');
|
||||
|
||||
//
|
||||
$template->assign_vars(array(
|
||||
'USERNAME' => $username,
|
||||
@@ -352,8 +360,10 @@ class ucp_register extends ucp
|
||||
'CONFIRM_IMG' => $confirm_image,
|
||||
'ERROR' => (sizeof($this->error)) ? implode('<br />', $this->error) : '',
|
||||
|
||||
'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlentities($config['board_contact']) . '">', '</a>'),
|
||||
'L_ITEMS_REQUIRED' => $l_reg_cond,
|
||||
'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlentities($config['board_contact']) . '">', '</a>'),
|
||||
'L_ITEMS_REQUIRED' => $l_reg_cond,
|
||||
'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_NEW_PASSWORD_EXPLAIN'=> sprintf($user->lang['NEW_PASSWORD_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
|
||||
|
||||
'S_LANG_OPTIONS' => language_select($lang),
|
||||
'S_TZ_OPTIONS' => tz_select($tz),
|
||||
|
Reference in New Issue
Block a user