Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Rudolf on June 30, 2006, 04:28:36 AM

Title: trackUser bugs
Post by: Rudolf on June 30, 2006, 04:28:36 AM
Bug 1
In Profile.template.php this part:

// Lists of IP addresses used in messages / error messages.
echo '
<tr>
<td class="windowbg2" align="left">', $txt['ips_in_messages'], ':</td>
<td class="windowbg2" align="left">
', (count($context['ips']) > 0 ? implode(', ', $context['ips']) : '(' . $txt['none'] . ')'), '
</td>
</tr><tr>
<td class="windowbg2" align="left">', $txt['ips_in_errors'], ':</td>
<td class="windowbg2" align="left">
', (count($context['ips']) > 0 ? implode(', ', $context['error_ips']) : '(' . $txt['none'] . ')'), '
</td>
</tr>';


on second tr second td sould be:
', (count($context['error_ips']) > 0 ? implode(', ', $context['error_ips']) : '(' . $txt['none'] . ')'), '

I haven't confirmed yet 100%, but it seems that if the user has no ips assigned (no messages posted), but has errors the error IP's won't be displayed.

Bug 2
In Profile.php the $ips array remains empty if the user has no messages and no generated errors:
The following code will give an empty result, even if there are users with the same ip.

// Find other users that might use the same IP.
$ips = array_unique($ips);
$context['members_in_range'] = array();
if (!empty($ips))
{
$request = db_query("
SELECT ID_MEMBER, realName
FROM {$db_prefix}members
WHERE ID_MEMBER != $memID
AND memberIP IN ('" . implode("', '", $ips) . "')", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
while ($row = mysql_fetch_assoc($request))
$context['members_in_range'][$row['ID_MEMBER']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';
mysql_free_result($request);

$request = db_query("
SELECT mem.ID_MEMBER, mem.realName
FROM ({$db_prefix}messages AS m, {$db_prefix}members AS mem)
WHERE mem.ID_MEMBER = m.ID_MEMBER
AND mem.ID_MEMBER != $memID
AND m.posterIP IN ('" . implode("', '", $ips) . "')", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
while ($row = mysql_fetch_assoc($request))
$context['members_in_range'][$row['ID_MEMBER']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';
mysql_free_result($request);
}


A workaround is to replace (in trackUser function):
$ips = array();
with
$ips = array($context['last_ip']);

®udolf
Title: Re: trackUser bugs
Post by: Rudolf on June 30, 2006, 06:31:17 AM
a small and possibly dangerous typo in Profile.php
// Permissions for removing stuff...
$context['can_delete_posts'] = !$context['user']['is_owner'] && allowedto('moderate_forum');

// Permissions for removing stuff...
$context['can_delete_posts'] = !$context['user']['is_owner'] && allowedTo('moderate_forum');
Title: Re: trackUser bugs
Post by: Rudolf on July 07, 2006, 05:59:34 PM
I'm bumping this because I'm not sure if anyone from the team read this.
I know that team members are busy, but it's really discouraging to don't get a reply after one week. At least a note saying that it was seen and it is being (or it will be as time permits) investigated.
The bugs are there i tested for days, the typo is there.

This made me wonder about a place where to submit bugs. Bugzilla type of project where one can submit a bug and follow it's course.
Or it would be relatively easy to make a special board where you could post something and see if any "team member"(user from specific membergroup) looked at the topic. So that we mortals know that we're being heard(read). Edit: I'm saying this because I understand that the time of the developers is precious and even if they did read it and are working on it they might not have the time to actually reply saying that they are doing it. So the system would automatically notify/give feedback.
Title: Re: trackUser bugs
Post by: Trekkie101 on September 15, 2006, 11:18:35 AM
Added to bug tracker.
Title: Re: trackUser bugs
Post by: Trekkie101 on September 17, 2006, 11:47:36 AM
Fixed

Quote from: Thantos! Automatically include the know IPs when tracking a user and looking for other members with the same IP. (Profile.php)
* The IPs used in error messages was checking the wrong context value. (Profile template)