aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorHenry Sudhof <kellanved@phpbb.com>2007-05-25 16:03:40 +0000
committerHenry Sudhof <kellanved@phpbb.com>2007-05-25 16:03:40 +0000
commit20993d5cf1abdb448eb57c8b0de6c0f36bfc6f70 (patch)
tree0b217a8cf2f6945baccdc3e3fefe572db41adecd /phpBB/includes
parent17315b69c69fba5bad5f78bc1d38c301692f9904 (diff)
downloadforums-20993d5cf1abdb448eb57c8b0de6c0f36bfc6f70.tar
forums-20993d5cf1abdb448eb57c8b0de6c0f36bfc6f70.tar.gz
forums-20993d5cf1abdb448eb57c8b0de6c0f36bfc6f70.tar.bz2
forums-20993d5cf1abdb448eb57c8b0de6c0f36bfc6f70.tar.xz
forums-20993d5cf1abdb448eb57c8b0de6c0f36bfc6f70.zip
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
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_forums.php8
-rw-r--r--phpBB/includes/functions_admin.php8
-rw-r--r--phpBB/includes/functions_user.php6
-rw-r--r--phpBB/includes/mcp/mcp_post.php3
4 files changed, 19 insertions, 6 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index 0f38d6663b..3e5ca705da 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -1710,8 +1710,14 @@ 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);
}
}
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 97fc9ba73b..042e0bae03 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -659,8 +659,14 @@ 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);
}
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index cab9d8bc25..2c733a9ebd 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -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);
}
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 8dbbdba92e..7556f3270d 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -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 . '