Introduced checks to stop negative postcounts (Bug #11561, #11421)

Allow IP v4/v6 urls for remote avatars (Bug #11633)
 Delete avatar files automatically (Bug #11631)
 Automatically add selected columsn to group by statements in the converter (Bug #11465)


git-svn-id: file:///svn/phpbb/trunk@7677 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof 2007-05-25 16:03:40 +00:00
parent 17315b69c6
commit 20993d5cf1
6 changed files with 39 additions and 10 deletions

View file

@ -202,14 +202,19 @@ p a {
<li>[Fix] Check global purge setting (Bug #11555)</li>
<li>[Fix] Improper magic url parsing applied to already parsed [url=] bbcode tag (Bug #11429)</li>
<li>[Fix] Renamed two indicies for Oracle support (Bug #11457)</li>
<li>[Fix] Added support for ISO-8859-8-i in the character set convertor</li>
<li>[Fix] Added support for ISO-8859-8-i in the character set convertor (Bug #11265)</li>
<li>[Fix] Added support for Oracle's "easy connect naming"</li>
<li>[Fix] Let Mark/Unmark All work in Manage Drafts (Bug #11679)</li>
<li>[Fix] Display correct message if no attachments found in user administration (Bug #11629)</li>
<li>[Fix] Let the "Delete all board cookies" being displayed for guests too (only prosilver) (Bug #11603)</li>
<li>[Fix] Do not display view topic link in MCP while there is no link present (Bug #11573)</li>
<li>[Fix] MySQL now properly sorts by post_subject (Bug #11637)</li>
</ul>
<li>[Fix] Introduced checks to stop negative postcounts (Bug #11561, #11421)</li>
<li>[Fix] Allow IP v4/v6 urls for remote avatars (Bug #11633)</li>
<li>[Fix] Delete avatar files automatically (Bug #11631)</li>
<li>[Fix] Automatically add selected columsn to group by statements in the converter (Bug #11465)</li>
</ul>
</div>
<a href="#top">Top</a>

View file

@ -1709,9 +1709,15 @@ class acp_forums
{
foreach ($post_counts as $poster_id => $substract)
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = 0
WHERE user_id = ' . $poster_id . '
AND user_posts < ' . $substract;
$db->sql_query($sql);
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = user_posts - ' . $substract . '
WHERE user_id = ' . $poster_id;
WHERE user_id = ' . $poster_id . '
AND user_posts >= ' . $substract;
$db->sql_query($sql);
}
}

View file

@ -658,9 +658,15 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
{
foreach ($post_counts as $poster_id => $substract)
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = 0
WHERE user_id = ' . $poster_id . '
AND user_posts < ' . $substract;
$db->sql_query($sql);
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = user_posts - ' . $substract . '
WHERE user_id = ' . $poster_id;
WHERE user_id = ' . $poster_id . '
AND user_posts >= ' . $substract;
$db->sql_query($sql);
}
}

View file

@ -1595,8 +1595,7 @@ function avatar_remote($data, &$error)
{
$data['remotelink'] = 'http://' . $data['remotelink'];
}
if (!preg_match('#^(http|https|ftp)://(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}:?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $data['remotelink']))
if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.(gif|jpg|jpeg|png)$#i', $data['remotelink']))
{
$error[] = $user->lang['AVATAR_URL_INVALID'];
return false;
@ -2023,7 +2022,8 @@ function avatar_process_user(&$error, $custom_userdata = false)
$userdata = ($custom_userdata === false) ? $user->data : $custom_userdata;
// Delete old avatar if present
if ($userdata['user_avatar'] && empty($sql_ary['user_avatar']) && $userdata['user_avatar_type'] != AVATAR_GALLERY)
if ((!empty($userdata['user_avatar']) && empty($sql_ary['user_avatar']) && $userdata['user_avatar_type'] == AVATAR_UPLOAD)
|| ( !empty($userdata['user_avatar']) && !empty($sql_ary['user_avatar']) && $userdata['user_avatar_type'] == AVATAR_UPLOAD && $sql_ary['user_avatar_type'] != AVATAR_UPLOAD))
{
avatar_delete('user', $userdata);
}

View file

@ -403,7 +403,8 @@ function change_poster(&$post_info, $userdata)
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = user_posts - 1
WHERE user_id = ' . $post_info['user_id'];
WHERE user_id = ' . $post_info['user_id'] .'
AND user_posts > 0';
$db->sql_query($sql);
$sql = 'UPDATE ' . USERS_TABLE . '

View file

@ -1157,7 +1157,18 @@ class install_convert extends module
$sql .= (!empty($schema['where'])) ? "\nWHERE (" . $schema['where'] . ')' : '';
// Group By
$sql .= (!empty($schema['group_by'])) ? "\nGROUP BY " . $schema['group_by'] : '';
if (!empty($schema['group_by']))
{
$schema['group_by'] = array($schema['group_by']);
foreach($sql_data['select_fields'] as $select)
{
if (!in_array($select, $schema['group_by']))
{
$schema['group_by'][] = $select;
}
}
}
$sql .= (!empty($schema['group_by'])) ? "\nGROUP BY " . implode(', ', $schema['group_by']) : '';
// Having
$sql .= (!empty($schema['having'])) ? "\nHAVING " . $schema['having'] : '';