Welcome to Geeklog, Anonymous Saturday, April 20 2024 @ 06:32 am EDT

Geeklog Forums

lib-common.php -- COM_killJS


jhoke

Anonymous
I understand fully why this should be utilized for user entered information, but what I would like is to have StoryAdmins be able to enter onMouseOver events for pithy comments in the status bar... Is there any way to modify this code not to fire if the person entering the code is eiter a member of root group or story admins?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany

Well, you almost answered your own question :-)

You could simply add a check if the current user is in the Root group and make the function return the code unaltered:

Text Formatted Code
function COM_killJS( $Message )
{
    if( SEC_inGroup( 'Root' )))
    {
        return( $Message );
    }
    else
    {
        return( preg_replace( '/(\s)+[oO][nN](\w*) ?=/', '\1in\2=', $Message ));
    }
}

bye, Dirk

 Quote

jhoke

Anonymous
Thanks Dirk!
I thought I could... but wasnt sure if it would fly Wink
One thing... you have one too many ")" in your snippet... should read:
Text Formatted Code

function COM_killJS( $Message )
{
    if( SEC_inGroup( 'Root' )) //extra ')' was here ...
    {
        return( $Message );
    }
    else
    {
    return( preg_replace( '/(\s)+[oO][nN](\w*) ?=/', '\1in\2=', $Message ));
    }
}
 
Thanks again!

---
--John
http://www.slapd.net
http://john.hoke.org

 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Yeah, sorry. I just wrote that code down and didn't test it. bye, Dirk
 Quote

All times are EDT. The time is now 06:32 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content