This is a screwy world! Screwy I tell you!

git-svn-id: file:///svn/phpbb/trunk@5927 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2006-05-17 21:37:05 +00:00
parent a0600f06be
commit bcdb8c2659

View file

@ -217,13 +217,31 @@ function mcp_post_details($id, $mode, $action)
} }
// Get other users who've posted under this IP // Get other users who've posted under this IP
$sql = 'SELECT u.user_id, u.username, COUNT(*) as postings
FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . " p // Firebird does not support ORDER BY on aliased columns
WHERE p.poster_id = u.user_id // MySQL does not support ORDER BY on functions
AND p.poster_ip = '{$post_info['poster_ip']}' switch (SQL_LAYER)
AND p.poster_id <> {$post_info['user_id']} {
GROUP BY u.user_id, u.username case 'firebird':
ORDER BY postings DESC"; $sql = 'SELECT u.user_id, u.username, COUNT(*) as postings
FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . " p
WHERE p.poster_id = u.user_id
AND p.poster_ip = '{$post_info['poster_ip']}'
AND p.poster_id <> {$post_info['user_id']}
GROUP BY u.user_id, u.username
ORDER BY COUNT(*) DESC";
break;
default:
$sql = 'SELECT u.user_id, u.username, COUNT(*) as postings
FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . " p
WHERE p.poster_id = u.user_id
AND p.poster_ip = '{$post_info['poster_ip']}'
AND p.poster_id <> {$post_info['user_id']}
GROUP BY u.user_id, u.username
ORDER BY postings DESC";
break;
}
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
@ -247,11 +265,27 @@ function mcp_post_details($id, $mode, $action)
$db->sql_freeresult($result); $db->sql_freeresult($result);
// Get other IP's this user has posted under // Get other IP's this user has posted under
$sql = 'SELECT poster_ip, COUNT(*) AS postings
FROM ' . POSTS_TABLE . ' // Firebird does not support ORDER BY on aliased columns
WHERE poster_id = ' . $post_info['poster_id'] . ' // MySQL does not support ORDER BY on functions
GROUP BY poster_ip switch (SQL_LAYER)
ORDER BY postings DESC'; {
case 'firebird':
$sql = 'SELECT poster_ip, COUNT(*) AS postings
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $post_info['poster_id'] . '
GROUP BY poster_ip
ORDER BY COUNT(*) DESC';
break;
default:
$sql = 'SELECT poster_ip, COUNT(*) AS postings
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $post_info['poster_id'] . '
GROUP BY poster_ip
ORDER BY postings DESC';
break;
}
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))