diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_attachments.php | 20 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_groups.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_language.php | 14 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_main.php | 3 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 11 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 4 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 3 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 1 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 12 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 32 | ||||
-rw-r--r-- | phpBB/includes/functions_module.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 11 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 58 | ||||
-rwxr-xr-x | phpBB/includes/search/fulltext_native.php | 2 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_groups.php | 2 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 6 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 34 |
17 files changed, 144 insertions, 75 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 956afdd7ae..f9fe924b39 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -535,10 +535,12 @@ class acp_attachments } $cat_lang = array( - ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], - ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], - ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'] + ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], + ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], + ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], + ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'], + ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], + ATTACHMENT_CATEGORY_QUICKTIME => $user->lang['CAT_QUICKTIME_FILES'], ); $group_id = request_var('g', 0); @@ -1016,10 +1018,12 @@ class acp_attachments global $db, $user; $types = array( - ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], - ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], - ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'] + ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], + ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], + ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], + ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'], + ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], + ATTACHMENT_CATEGORY_QUICKTIME => $user->lang['CAT_QUICKTIME_FILES'], ); if ($group_id) diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index f4c869c40c..a390bd8212 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -317,7 +317,7 @@ class acp_groups { if (isset($group_row['group_avatar']) && $group_row['group_avatar']) { - avatar_delete($group_row['group_avatar']); + avatar_delete('group', $group_row); } } diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 896dc75f69..c901c73ddc 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -47,8 +47,10 @@ class acp_language $missing_file = request_var('missing_file', array('' => 0)); list($_REQUEST['language_file'], ) = array_keys($missing_file); } - - list($this->language_directory, $this->language_file) = explode('|', request_var('language_file', '|common.' . $phpEx)); + + $selected_lang_file = request_var('language_file', '|common.' . $phpEx); + + list($this->language_directory, $this->language_file) = explode('|', $selected_lang_file); $this->language_directory = basename($this->language_directory); $this->language_file = basename($this->language_file); @@ -201,7 +203,7 @@ class acp_language if (!$fp) { - trigger_error(sprintf($user->lang['UNABLE_TO_WRITE_FILE'], $filename) . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error(sprintf($user->lang['UNABLE_TO_WRITE_FILE'], $filename) . adm_back_link($this->u_action . '&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); } if ($this->language_directory == 'email') @@ -285,6 +287,8 @@ class acp_language $file = request_var('file', ''); $dir = request_var('dir', ''); + $selected_lang_file = $dir . '|' . $file; + $old_file = '/' . $this->get_filename($row['lang_iso'], $dir, $file, false, true); $lang_path = 'language/' . $row['lang_iso'] . '/' . (($dir) ? $dir . '/' : ''); @@ -308,7 +312,7 @@ class acp_language if (($result = $transfer->open_session()) !== true) { - trigger_error($user->lang[$result] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($user->lang[$result] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file)), E_USER_WARNING); } $transfer->rename($lang_path . $file, $lang_path . $file . '.bak'); @@ -320,7 +324,7 @@ class acp_language add_log('admin', 'LOG_LANGUAGE_FILE_REPLACED', $file); - trigger_error($user->lang['UPLOAD_COMPLETED'] . adm_back_link($this->u_action)); + trigger_error($user->lang['UPLOAD_COMPLETED'] . adm_back_link($this->u_action . '&action=details&id=' . $lang_id . '&language_file=' . urlencode($selected_lang_file))); } $action = 'details'; diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 4bd230458b..4506c8f7c7 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -276,7 +276,8 @@ class acp_main { $sql = 'SELECT COUNT(attach_id) AS total_orphan FROM ' . ATTACHMENTS_TABLE . ' - WHERE is_orphan = 1'; + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60); $result = $db->sql_query($sql); $total_orphan = (int) $db->sql_fetchfield('total_orphan'); $db->sql_freeresult($result); diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 1ba433a777..9e49e986e7 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -397,9 +397,12 @@ pagination_sep = \'{PAGINATION_SEP}\' } unset($cfg_data); - $sql = 'UPDATE ' . STYLES_IMAGESET_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " - WHERE imageset_id = $style_id"; - $db->sql_query($sql); + if (sizeof($sql_ary)) + { + $sql = 'UPDATE ' . STYLES_IMAGESET_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE imageset_id = $style_id"; + $db->sql_query($sql); + } $cache->destroy('sql', STYLES_IMAGESET_TABLE); @@ -1845,7 +1848,7 @@ pagination_sep = \'{PAGINATION_SEP}\' { foreach ($key_array as $key) { - $imageset_cfg .= "\n" . $key . ' = ' . str_replace("styles/{$style_row['imageset_path']}/imageset/", '{PATH}', $style_row[$key]); + $imageset_cfg .= "\nimg_" . $key . ' = ' . str_replace("styles/{$style_row['imageset_path']}/imageset/", '{PATH}', $style_row[$key]); } } diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 94d24e6505..7cdd86d612 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -389,7 +389,7 @@ class acp_users // Delete old avatar if present if ($user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY) { - avatar_delete($user_row['user_avatar']); + avatar_delete('user', $user_row); } add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']); @@ -1476,7 +1476,7 @@ class acp_users // Delete old avatar if present if ($user_row['user_avatar'] && $filename != $user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY) { - avatar_delete($user_row['user_avatar']); + avatar_delete('user', $user_row); } } diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index ae121fa017..652bda40a6 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -130,7 +130,8 @@ define('ATTACHMENT_CATEGORY_IMAGE', 1); // Inline Images define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming define('ATTACHMENT_CATEGORY_THUMB', 4); // Not used within the database, only while displaying posts -//define('SWF_CAT', 5); // Replaced by [flash]? or an additional possibility? +define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files +define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files // BBCode UID length define('BBCODE_UID_LEN', 5); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 58f5c5e4a6..b0d76fff4c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1945,6 +1945,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), 'S_DISPLAY_FULL_LOGIN' => ($s_display) ? true : false, + 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, 'S_LOGIN_ACTION' => (!$admin) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("index.$phpEx", false, true, $user->session_id), // Needs to stay index.$phpEx because we are within the admin directory 'S_HIDDEN_FIELDS' => $s_hidden_fields, diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index eebd0e2ad5..ceb14d42e1 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2006,6 +2006,12 @@ function cache_moderators() foreach ($hold_ary as $user_id => $forum_id_ary) { + // Do not continue if user does not exist + if (!isset($usernames_ary[$user_id])) + { + continue; + } + foreach ($forum_id_ary as $forum_id => $auth_ary) { $sql_ary[] = array( @@ -2047,6 +2053,12 @@ function cache_moderators() foreach ($hold_ary as $group_id => $forum_id_ary) { + // If there is no group, we do not assign it... + if (!isset($groupnames_ary[$group_id])) + { + continue; + } + foreach ($forum_id_ary as $forum_id => $auth_ary) { $flag = false; diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a5579c40f5..dd9b1d7afa 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -837,6 +837,8 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_ $download_link = (!$force_physical && $attachment['attach_id']) ? append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&f=' . $forum_id) : $filename; + $download_link_full = (!$force_physical && $attachment['attach_id']) ? generate_board_url() . append_sid("/download.$phpEx", 'id=' . $attachment['attach_id'] . '&f=' . $forum_id) : generate_board_url() . $filename; + switch ($display_cat) { // Images @@ -865,53 +867,51 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_ case ATTACHMENT_CATEGORY_WM: $l_downloaded_viewed = $user->lang['VIEWED']; - // The download link is slightly different, because somehow phpBB is not able to get the correct results if called - // within the wmp object (cookies are not present). - // $download_link = (!$force_physical && $attachment['attach_id']) ? generate_board_url() . append_sid("/download.$phpEx", 'id=' . $attachment['attach_id'] . '&f=' . $forum_id, false, $user->session_id) : $filename; - // Giving the filename directly because within the wm object all variables are in local context making it impossible // to validate against a valid session (all params can differ) $download_link = $filename; $block_array += array( + 'U_FORUM' => generate_board_url(), 'S_WM_FILE' => true, ); - // Viewed/Heared File ... update the download count (download.php is not called here) + // Viewed/Heared File ... update the download count $update_count[] = $attachment['attach_id']; break; // Real Media Streams case ATTACHMENT_CATEGORY_RM: + case ATTACHMENT_CATEGORY_QUICKTIME: $l_downloaded_viewed = $user->lang['VIEWED']; $block_array += array( - 'S_RM_FILE' => true, - 'U_FORUM' => generate_board_url(), - 'ATTACH_ID' => $attachment['attach_id'], + 'S_RM_FILE' => ($display_cat == ATTACHMENT_CATEGORY_RM) ? true : false, + 'S_QUICKTIME_FILE' => ($display_cat == ATTACHMENT_CATEGORY_QUICKTIME) ? true : false, + 'U_FORUM' => generate_board_url(), + 'ATTACH_ID' => $attachment['attach_id'], ); - // Viewed/Heared File ... update the download count (download.php is not called here) + // Viewed/Heared File ... update the download count $update_count[] = $attachment['attach_id']; break; -/* // Macromedia Flash Files - case SWF_CAT: - list($width, $height) = swf_getdimension($filename); + // Macromedia Flash Files + case ATTACHMENT_CATEGORY_FLASH: + list($width, $height) = @getimagesize($filename); $l_downloaded_viewed = $user->lang['VIEWED']; - $download_link = $filename; $block_array += array( - 'S_SWF_FILE' => true, + 'S_FLASH_FILE' => true, 'WIDTH' => $width, 'HEIGHT' => $height, ); - // Viewed/Heared File ... update the download count (download.php is not called here) + // Viewed/Heared File ... update the download count $update_count[] = $attachment['attach_id']; break; -*/ + default: $l_downloaded_viewed = $user->lang['DOWNLOADED']; diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 5d5f004064..89dda74700 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -256,9 +256,9 @@ class p_master // If no category or module selected, go active for first module in first category if ( (($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && (($item_ary['mode'] == $mode && !$item_ary['cat']) || ($icat && $item_ary['cat']))) || - ($item_ary['parent'] === $category && !$item_ary['cat'] && !$icat) || + ($item_ary['parent'] === $category && !$item_ary['cat'] && !$icat && $item_ary['display']) || (($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && !$mode && !$item_ary['cat']) || - (!$id && !$mode && !$item_ary['cat']) + (!$id && !$mode && !$item_ary['cat'] && $item_ary['display']) ) { if ($item_ary['cat']) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 2bdc109b96..fccad678a9 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -111,7 +111,7 @@ function update_post_information($type, $ids, $return_update_sql = false) $ids = array($ids); } - $update_sql = $empty_forums = array(); + $update_sql = $empty_forums = $not_empty_forums = array(); if (sizeof($ids) == 1) { @@ -140,7 +140,12 @@ function update_post_information($type, $ids, $return_update_sql = false) if ($type == 'forum') { - $empty_forums[] = $row['forum_id']; + $not_empty_forums[] = $row['forum_id']; + + if (empty($row['last_post_id'])) + { + $empty_forums[] = $row['forum_id']; + } } $last_post_ids[] = $row['last_post_id']; @@ -149,7 +154,7 @@ function update_post_information($type, $ids, $return_update_sql = false) if ($type == 'forum') { - $empty_forums = array_diff($ids, $empty_forums); + $empty_forums = array_merge($empty_forums, array_diff($ids, $not_empty_forums)); foreach ($empty_forums as $void => $forum_id) { diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index c9f5b5faf7..f851fde3e0 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -344,7 +344,7 @@ function user_delete($mode, $user_id, $post_username = false) break; } - $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE); + $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE); foreach ($table_ary as $table) { @@ -353,6 +353,8 @@ function user_delete($mode, $user_id, $post_username = false) $db->sql_query($sql); } + $cache->destroy('sql', MODERATOR_CACHE_TABLE); + include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); // Remove any undelivered mails... @@ -1241,13 +1243,23 @@ function validate_email($email) /** * Remove avatar */ -function avatar_delete($id) +function avatar_delete($mode, $row) { global $phpbb_root_path, $config, $db, $user; - if (file_exists($phpbb_root_path . $config['avatar_path'] . '/' . basename($id))) + // Check if the users avatar is actually *not* a group avatar + if ($mode == 'user') { - @unlink($phpbb_root_path . $config['avatar_path'] . '/' . basename($id)); + if (strpos($row['user_avatar'], 'g' . $row['group_id'] . '_') === 0 || strpos($row['user_avatar'], $row['user_id'] . '_') !== 0) + { + return false; + } + } + + if (file_exists($phpbb_root_path . $config['avatar_path'] . '/' . basename($row[$mode . '_avatar']))) + { + @unlink($phpbb_root_path . $config['avatar_path'] . '/' . basename($row[$mode . '_avatar'])); + return true; } return false; @@ -1616,7 +1628,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow */ function group_delete($group_id, $group_name = false) { - global $db; + global $db, $phpbb_root_path, $phpEx; if (!$group_name) { @@ -1668,6 +1680,11 @@ function group_delete($group_id, $group_name = false) $db->sql_query($sql); // Re-cache moderators + if (!function_exists('cache_moderators')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + cache_moderators(); add_log('admin', 'LOG_GROUP_DELETE', $group_name); @@ -2056,7 +2073,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal if (in_array('user_avatar', array_keys($sql_ary))) { // Ok, get the original avatar data from users having an uploaded one (we need to remove these from the filesystem) - $sql = 'SELECT user_id, user_avatar + $sql = 'SELECT user_id, group_id, user_avatar FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $user_id_ary) . ' AND user_avatar_type = ' . AVATAR_UPLOAD; @@ -2064,7 +2081,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal while ($row = $db->sql_fetchrow($result)) { - avatar_delete($row['user_avatar']); + avatar_delete('user', $row); } $db->sql_freeresult($result); } @@ -2073,18 +2090,21 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal WHERE ' . $db->sql_in_set('user_id', $user_id_ary); $db->sql_query($sql); - // Update any cached colour information for these users - $sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' - WHERE " . $db->sql_in_set('forum_last_poster_id', $user_id_ary); - $db->sql_query($sql); + if (in_array('user_colour', array_keys($sql_ary))) + { + // Update any cached colour information for these users + $sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('forum_last_poster_id', $user_id_ary); + $db->sql_query($sql); - $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' - WHERE " . $db->sql_in_set('topic_poster', $user_id_ary); - $db->sql_query($sql); + $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('topic_poster', $user_id_ary); + $db->sql_query($sql); - $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' - WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary); - $db->sql_query($sql); + $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary); + $db->sql_query($sql); + } } /** @@ -2224,6 +2244,10 @@ function group_update_listings($group_id) if ($mod_permissions) { + if (!function_exists('cache_moderators')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } cache_moderators(); } diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index a845a64016..3669e9ad02 100755 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -199,7 +199,7 @@ class fulltext_native extends search_backend { if ($row['word_common']) { - $this->common_words[] = $row['wort_text']; + $this->common_words[] = $row['word_text']; continue; } diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 2d867177d5..810fe4c7ee 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -496,7 +496,7 @@ class ucp_groups { if (isset($group_row['group_avatar']) && $group_row['group_avatar']) { - avatar_delete($group_row['group_avatar']); + avatar_delete('group', $group_row); } } diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index cabe813f96..376573d059 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -597,11 +597,7 @@ class ucp_profile // Delete old avatar if present if ($user->data['user_avatar'] && $filename != $user->data['user_avatar'] && $user->data['user_avatar_type'] != AVATAR_GALLERY) { - // Check if the users avatar is actually a group avatar - if (strpos($user->data['user_avatar'], 'g' . $user->data['group_id'] . '_') !== 0 && strpos($user->data['user_avatar'], $user->data['user_id'] . '_') === 0) - { - avatar_delete($user->data['user_avatar']); - } + avatar_delete('user', $user->data); } } diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index e3e1315721..22f9c86f40 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -47,6 +47,9 @@ class ucp_register $user->lang_path = $phpbb_root_path . 'language/' . $lang . '/'; $user->lang = array(); $user->add_lang(array('common', 'ucp')); + + // Setting back agreed to let the user view the agreement in his/her language + $agreed = (empty($_GET['change_lang'])) ? 0 : $agreed; } else { @@ -61,6 +64,8 @@ class ucp_register // if (!$agreed) { + $add_lang = ($change_lang) ? '&change_lang=' . urlencode($change_lang) : ''; + if ($coppa === false && $config['coppa_enable']) { $now = getdate(); @@ -71,11 +76,12 @@ class ucp_register 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), - 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0'), - 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1'), + 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0' . $add_lang), + 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1' . $add_lang), 'S_SHOW_COPPA' => true, - 'S_REGISTER_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register')) + 'S_HIDDEN_FIELDS' => ($confirm_id) ? '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />' : '', + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang)) ); } else @@ -85,7 +91,8 @@ class ucp_register 'S_SHOW_COPPA' => false, 'S_REGISTRATION' => true, - 'S_REGISTER_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register')) + 'S_HIDDEN_FIELDS' => ($confirm_id) ? '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />' : '', + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_lang)) ); } @@ -93,6 +100,16 @@ class ucp_register return; } + // Try to manually determine the timezone + $timezone = date('Z') / 3600; + $is_dst = date('I'); + $timezone = ($is_dst) ? $timezone - 1 : $timezone; + + if (!isset($user->lang['tz_zones'][(string) $timezone])) + { + $timezone = $config['board_timezone']; + } + $var_ary = array( 'username' => (string) '', 'password_confirm' => (string) '', @@ -101,8 +118,8 @@ class ucp_register 'email' => (string) '', 'email_confirm' => (string) '', 'confirm_code' => (string) '', - 'lang' => (string) $config['default_lang'], - 'tz' => (float) $config['board_timezone'], + 'lang' => (string) $user->lang_name, + 'tz' => (float) $timezone, ); // If we change the language inline, we do not want to display errors, but pre-fill already filled out values @@ -263,6 +280,7 @@ class ucp_register 'user_email' => $email, 'group_id' => (int) $group_id, 'user_timezone' => (float) $tz, + 'user_dst' => $is_dst, 'user_lang' => $lang, 'user_type' => $user_type, 'user_actkey' => $user_actkey, @@ -351,7 +369,7 @@ class ucp_register if (sizeof($admin_ary)) { - $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']); + $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary); } $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type @@ -472,7 +490,7 @@ class ucp_register $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); $lang = (isset($lang)) ? $lang : $config['default_lang']; - $tz = (isset($tz)) ? $tz : $config['board_timezone']; + $tz = (isset($tz)) ? $tz : $timezone; // $template->assign_vars(array( |