IP View Permission

Started by SONSiVRi, September 04, 2008, 11:48:18 PM

Previous topic - Next topic

SONSiVRi

Link to Mod

Brief:

  • This mod gives you (seperated) safer version of Moderate forum members permission. In default installation, you can grant IP viewing option by Moderate forum members permission. But it comes with extra rights and assigned membergroup will also have powerful options. Use this mod and give only IP viewing option.
  • You will have original and limited version same time, so its no problem if you are using original one.
  • If you want to hide some of members IPs (administrators...), you can mask them. Nobody (except members granted by original permission) can see masked members IPs.
  • Compare permission lists shown as below.

Moderate forum members (Original permission):

  • access to registration management
  • access to the view/delete members screen
  • extensive profile info, including track IP/user and (hidden) online status
  • activate accounts
  • get approval notifications and approve accounts
  • immune to ignore PM
  • several small things

Moderate (Limited) forum members (New permission):

  • extensive profile info, including track IP/user and (hidden) online status
  • show hidden mail addresses

Version Info:

  • Its only working with smf 1.1.x versions.

How To Use:

  • After you installed this mod you will have permission named Moderate (Limited) forum members under
    "Admin (Top menu) -> Permissions (Lef handed menu) -> Moderator (example) -> Member administration (main group)".
  • Assign this permission on membergroups (Global Moderator, Moderator) those who will view IP.
  • Use "Don't show IP's of these user(s)" to mask special users informations. To do this;
    "Admin (Top menu) -> Permissions (Lef handed menu) -> Settings (Upper menu)".

How To Install:

  • Download mod file (View_IP_x.x.zip) and place it in packages folder and then begin the setup process within admin panel.
  • This mod changing lots of file (19). It will painful to change file permissions manually.
  • If you are using custom theme, you should manually edit your "Display.template.php", "ManagePermissions.template.php", "MessageIndex.template.php". Ignore if you dont have these files in custom theme. But if you have one of them, use Manual Install Instructions for SMF listbox in the mod download page to manual edit.
  • If everything went ok, you have new mod working.

How To Upgrade:

  • Simply uninstall previous version of this mod and install new one.
    No membergroup record would be deleted, new version will take same settings as you set.
  • If you made changing on custom theme, you should reflect new changings also.
    Delete old changings and add changings from new mod. Use Manual Install Instructions for SMF listbox in the mod download page to manual edit.

Note:

  • This mod simply creates moderate_forum2 permission based from moderate_forum and changes allowedTo('moderate_forum') into (allowedTo('moderate_forum') || allowedTo('moderate_forum2')) in proper conditions.

Version History:

  • v1.4 (11-11-2008)

    • Bug fixed (Error when member masking is empty).
  • v1.3 (10-10-2008)

    • New feature added (member masking).
  • v1.2 (25-9-2008)

    • Bugs fixed in news.php (miscoded).
  • v1.1 (5-9-2008)

    • Bugs fixed.
    • Some little arrangements.
  • v1.0 (3-9-2008)

    • Initial release.
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Kimojuno

I might be missing something here, but while looking over your code I found some things that made me unsure.

Original:


// Being news, this actually makes sense in rss format.
if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'description' => cdata_parse($row['body']),
'author' => (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !allowedTo('moderate_forum')) ? null : $row['posterEmail'],


Your change:


// Being news, this actually makes sense in rss format.
if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'description' => cdata_parse($row['body']),
'author' => (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !(allowedTo('moderate_forum') || allowedTo('moderate_forum2'))) ? null : $row['posterEmail'],


Any reason why allowedTo('moderate_forum2'))) is not !allowedTo('moderate_forum2')) ? The reason I ask is because I notice the moderate_forum begins with an '!' yet the moderate_forum2 does not. I went over that field and it seems (at least from studying it for a few moments) that it is unsetting/not allowing those properties (as 'the is_guest' makes it look like that is for guests). I could be wrong here but wanted to check before using this.

-------

Original:


// Doesn't work as well as news, but it kinda does..
if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'],
'description' => cdata_parse($row['body']),
'author' => (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !allowedTo('moderate_forum')) ? null : $row['posterEmail'],


Your change:


// Doesn't work as well as news, but it kinda does..
if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'],
'description' => cdata_parse($row['body']),
'author' => (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !(allowedTo('moderate_forum') || allowedTo('moderate_forum'))) ? null : $row['posterEmail'],


Shouldn't the second 'moderate_forum' be 'moderate_forum2'?

Also, same questions as above.

Don't get me wrong, I love the idea but I wanted to ask.

Thank you for writing for and sharing with the community,
Jeffrey.

SONSiVRi

Thanks Jeffrey,
bug fixed now (moderate_forum to moderate_forum2).

And about your question, its nature of logical equation.
Former code was checking isnt user having moderate_forum rights? then do not show content to him/her.
If you need to add second operand in this equation, you cant break checking algorithm style.
this is old one => !right1 => means if right1 isn't true
this is new one => !(right1 || right2) => means either right1 or right2 isn't true
In my mod, content is showing to user if one of permissions (original permission or new permission) is set.

I can give clear examples if you still dont get it.
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Kimojuno

Quote from: SONSiVRi on September 25, 2008, 03:43:58 PM
Thanks Jeffrey,
bug fixed now (moderate_forum to moderate_forum2).

And about your question, its nature of logical equation.
Former code was checking isnt user having moderate_forum rights? then do not show content to him/her.
If you need to add second operand in this equation, you cant break checking algorithm style.
this is old one => !right1 => means if right1 isn't true
this is new one => !(right1 || right2) => means either right1 or right2 isn't true
In my mod, content is showing to user if one of permissions (original permission or new permission) is set.

I can give clear examples if you still dont get it.

Ah, an either-or equation. I understand, thanks! =)

vagrant

Nice mod and thank you for your time and work.

However, on my main forums users are by the nature of the forums very anon and i would like a mod to restrict access rather than grant more.

SONSiVRi

Quote from: vagrant on September 26, 2008, 09:50:34 PM
Nice mod and thank you for your time and work.

However, on my main forums users are by the nature of the forums very anon and i would like a mod to restrict access rather than grant more.

In fact with this mod you can restrict either. You asked that or you explaining it?
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Sander

When my "Don't show IP's of these user(s)" list is empty, I get syntax errors.

E.g. in this line (Profile.php):

AND NOT ID_MEMBER IN (" . implode(',', unserialize($modSettings['masked_members'])) . ")", __FILE__, __LINE__);

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4".

Obviously, the error is caused because (" . implode(',', unserialize($modSettings['masked_members'])) . ") leads to something weird when $modSettings['masked_members'] is empty, but I can't figure out how to resolve this (except for putting a username in the list, of course ;) ).

Anyone?


And now for something completely different.

SONSiVRi

My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Sander

And now for something completely different.

Sabre™

Any update on this SONSiVRi?
Is it possible to stop my moderators from viewing all IPs with this mod?
Or only grant my global mods permission to see IPs?

Thank you
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


SONSiVRi

I think I didnt get you clear, I will answer as I think what you are asking.
If you want to stop moderators to viewing IP, dont give them this permission.
If you want stop viewing of moderator's IP by other members (who can view IP), then use mask option exist in new release (1.3).
Type each moderator nick into related area and their IP's will be hidden.

Is this what you asking?
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Sabre™

Quote from: SONSiVRi on November 10, 2008, 07:26:19 AM
If you want to stop moderators to viewing IP, dont give them this permission.

Excellent buddy, thats all I needed to know.  Thank you :)

Quote from: Sander on November 04, 2008, 07:27:48 AM
When my "Don't show IP's of these user(s)" list is empty, I get syntax errors.

Have you ironed this out yet mate?
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


SONSiVRi

for the error, its in the queue.
Lots of other codes are awaiting to done.
I hope I will handle this error tomorrow.
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Sabre™

Brilliant, I will wait till youve completed it to implement this mod then.

Thanks for you good work mate :)
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


SONSiVRi

Quote from: Sander on November 04, 2008, 07:27:48 AM
When my "Don't show IP's of these user(s)" list is empty, I get syntax errors.

Thanks for informing me, it's solved now.
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Sander

But you introduced a new bug. :)

In Profile.php, query below "// Get some totals for pagination." (somewhere near line 1900)

$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}messages AS m
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = m.ID_BOARD)
WHERE $user_info[query_see_board]
AND m.posterIP $dbip " . (sizeof($id_members) > 0 ? sprintf('AND NOT mem.ID_MEMBER IN (%s)', implode(',', $id_members)) : '') . "", __FILE__, __LINE__);


Should be
$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}messages AS m
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = m.ID_BOARD)
WHERE $user_info[query_see_board]
AND m.posterIP $dbip " . (sizeof($id_members) > 0 ? sprintf('AND NOT m.ID_MEMBER IN (%s)', implode(',', $id_members)) : '') . "", __FILE__, __LINE__);


mem.ID_MEMBER should be m.ID_MEMBER, that is.

Besides that, $id_members is not defined yet, in your mode-code it is defined at a later stage in the code (just before the next query that is changed by your mod).

And now for something completely different.

SONSiVRi

"Sander"

Error was issued bacause of there were same pattern twice and installer changed two of them. I didnt wanted first one and also "$id_members" wasn't defined for that. I expanded pattern and its won't mix up again. I changed mod file, would you try again?
My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

Sander

Seems to work OK now, thanks.
And now for something completely different.

SONSiVRi

My Mods - IP View Permission - Recycle Bin Cleaner - Ip to Country
www.sonsivri.com - microcontrollers
- Houston, we have a problem.

DarkForce

first of all thank you for this great mod ;)

but i have a question...is it possible to hide the email-adress of specific users? (like hiding the ip of specific users)

DarkForce

Advertisement: