Enable HTML Only For Admins ( & Mods ) [updated] »  Show posts from    to     

Icy Phoenix


Old Customizations - Enable HTML Only For Admins ( & Mods ) [updated]



Yros [ Thu 29 Oct, 2009 18:11 ]
Post subject: Enable HTML Only For Admins ( & Mods ) [updated]
Hello,

I was searching for something like that when I found ( after many searches ) this topic. As it was something I found useful, I thought it could be great to adapt it to the latest version of IP.
First of all, Thanks to the author, Zuker, for his mod. I just adapted his own mod ( wasn't difficult at all ).

Well that's just a little mod but I hope it will help some guys.

PS : I did not check the code of Zuker but it seems right because I tested it on my board with some other mods and I had nothing wrong.

Ps² : If someone could check if everything is right ( in the code ) and is secured, it would be fine, thx.

EDIT : I just modified a bit the code of Zuker : after some lessons in php, I just compiled his code to make it faster.

Changed :
Code: [Hide]
  1. #
  2. #-----[ REPLACE BY ]--------------------------------------------
  3. #
  4. # If you want to allow only Administrators to use HTML on your board,
  5. # find ( in the following part ) :
  6. # if ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD) && ( $is_auth['auth_mod'] ))
  7. # and replace by :
  8. # if ($userdata['user_level'] == ADMIN) && ( $is_auth['auth_mod'] ))
  9.  
  10. // Mod for ALLOW HTML to Admins and Moderators - This Mod esclude HTML code for Users and Anonymous - BEGIN
  11.  
  12. if ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD) && ( $is_auth['auth_mod'] ))
  13. {
  14. // Set toggles for various options
  15. if ( !$board_config['allow_html'] )
  16. {
  17. $html_on = 0;
  18. }
  19. else
  20. {
  21. $html_on = ( $submit || $refresh ) ? ( ( !empty($_POST['disable_html']) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
  22. }
  23. }
  24. else
  25. {
  26. if ( !$board_config['allow_html'] )
  27. {
  28. $html_on = ( $submit || $refresh ) ? ( ( !empty($_POST['disable_html']) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
  29.  
  30. }
  31. else
  32. {
  33. $html_on = 0;
  34. }
  35. }
  36. // Mod for ALLOW HTML to Admins and Moderators - This Mod exlude HTML code for Users and Anonymous - END


TO :
Code: [Hide]
  1. #
  2. #-----[ REPLACE BY ]--------------------------------------------
  3. #
  4. # If you want to allow only Administrators to use HTML on your board,
  5. # find ( in the following part ) :
  6. # $userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD)
  7. # and replace by :
  8. # $userdata['user_level'] == ADMIN)
  9.  
  10. // Set toggles for various options
  11. // Mod for ALLOW HTML to Admins and Moderators - This Mod esclude HTML code for Users and Anonymous - BEGIN
  12. if ( !$board_config['allow_html'] )
  13. {
  14. $html_on = 0;
  15. }
  16. elseif ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD) && ( $is_auth['auth_mod'] ))
  17. {
  18. $html_on = ( $submit || $refresh ) ? ( ( !empty($_POST['disable_html']) ) ? 0 : true ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
  19. }
  20. // Mod for ALLOW HTML to Admins and Moderators - This Mod exlude HTML code for Users and Anonymous - END


Mighty Gorgon [ Mon 02 Nov, 2009 12:26 ]
Post subject: Re: Enable HTML Only For Admins ( & Mods ) [updated]
Thanks, I will make things easier in the new package for those who wants to do this...




Powered by Icy Phoenix