Thread: Administrative and Maintenance Tools - Advanced BBCode Permissions
View Single Post
  #248  
Old 07-23-2009, 06:27 PM
inciarco's Avatar
inciarco inciarco is offline
 
Join Date: Mar 2007
Posts: 758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A Interesting Way to Hide Images and Display Only Smilies, From Thread "preg_replace - Exclude Text in Search Code Line".

Quote:
Originally Posted by inciarco View Post
--------------- Added [DATE]1248376965[/DATE] at [TIME]1248376965[/TIME] ---------------

I'd like to Share a Solution I Found for the Previously Explained Problem; now the Images are Replaced by a Text and the Smilies and other Images on the image Folder are being Displayed. :up:

On the File /includes/class_postbit.php

you should add at the End of it, right after the "}" of the Last Function:

PHP Code:
// #############################################################################

function check_img_src($tag$src


$whitelisted = array( 
                
'website.com/forum/images'
                
'website.com/forum/location2',
                
'website.com/forum/location3',
                ); 

        foreach (
$whitelisted as $bl
        { 
            if (
strstr($src$bl)) 
            { 
                return 
stripslashes($tag); 
            } 
        } 

        return 
'Text Or Code Displayed Instead Of The Images Inserted With IMG Tag';


You Should Create a Plugin as Follows:

Product: vBulletin
Hook Location: postbit_display_complete
Title: IMG BBCode Permissions For Usergroups - postbit_display_complete
(or the one you wish)
Execution Order: 5
Active Plugin: Yes

PHP Code:

PHP Code:
if (is_member_of($this->registry->userinfo1,3,4,8))

{


$this->post['message'] = preg_replace("#(<img[^>](.*)(</img>|\/>))#e""check_img_src('\\1', '\\2')"$this->post['message']);  



You can Replace the 1,3,4,8 with the Usergroup Numbers you wish the Images Not to be Displayed, but Yes the Smilies.

And Thats It... Enjoy.

My Best Regards.



--------------- Added [DATE]1248377122[/DATE] at [TIME]1248377122[/TIME] ---------------

I Appreciate the Help of Deceptor for Providing the Code I Could Take as a Great Idea to Edit and Post my Solution, and to Dismounted who gave me on his Post the Idea to Include the Function in the php File. :up:

Of course, if you could share a Better Way to do this I'd appreciate it a Lot.

My Best Regards to Both of You. :up:

Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01399 seconds
  • Memory Usage 1,794KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete