Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 12-17-2005, 06:23 PM
kau kau is offline
 
Join Date: Jul 2002
Posts: 253
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I stop parsing of BB code?

Right now on my current version I hacked it so function handle_bbcode_img($bbcode, $dobbimagecode) does not work unless you are a certain user group, to stop trolls.

Now with 3.5 this is gone. I can't update until I find where this code is now.

What file is the parsing of the IMG tag in now???????
Reply With Quote
  #2  
Old 12-17-2005, 08:22 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

class_bbcode
Reply With Quote
  #3  
Old 12-17-2005, 09:46 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should be able to use a plugin to achieve what you want.
Reply With Quote
  #4  
Old 12-18-2005, 12:22 AM
kau kau is offline
 
Join Date: Jul 2002
Posts: 253
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How would I use a plugin to do that? I'm not very technical.

I looked throughout class_bbcode and I can't see a clear cut function that does it. Can someone point me to which function in that file handles the parsing of the IMG tag or explain how to setup a plugin to do what I need.
Reply With Quote
  #5  
Old 12-18-2005, 12:56 AM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

File class_bbcode.php, around line 1714:

PHP Code:
    /**
    * Handles an [img] tag.
    *
    * @param    string    The text to search for an image in.
    * @param    string    Whether to parse matching images into pictures or just links.
    *
    * @return    string    HTML representation of the tag.
    */
    
function handle_bbcode_img($bbcode$do_imgcode$has_img_code false
Reply With Quote
  #6  
Old 12-18-2005, 01:16 AM
kau kau is offline
 
Join Date: Jul 2002
Posts: 253
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great! Thanks very much.
Reply With Quote
  #7  
Old 12-18-2005, 01:21 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wait. Thats not the best method. (modifying code when you dont have to is baaad )

plugin bbcode_parse_start,

PHP Code:
if(is_member_of($this->registry->userinfoX)) { 
$dobbimagecode true
}
else
{
$dobbimagecode false;

Reply With Quote
  #8  
Old 12-18-2005, 01:24 AM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I didn't say that it's a best method. I just pointed at a location. As for your method, which is definitely better, the most error-proof solution would be simply:

PHP Code:
if(!(is_member_of($this->registry->userinfoX) OR is_member_of($this->registry->userinfoY)))
{
    
$dobbimagecode false;

Whereas the "true" assignment in your code might cause unexpected behavior in some cases when imgcode should not be parsed.

The easiest to use modify code would be:

PHP Code:
$usergroupids_no_img 'X,Y,Z';
$usergroupids_no_img explode(','$usergroupids_no_img);

foreach (
$usergroupids_no_img as $usergroupid)
{
    if(!
is_member_of($this->registry->userinfo$usergroupid))
    {
        
$dobbimagecode false;
        break;
    }

The reason there is a break statement is to stop checking for usergroups once a restricted one has been found - in other words, for optimization.

Reply With Quote
  #9  
Old 12-18-2005, 01:27 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is unnecessary to use multiple is_member_of calls. You can pass an array of usergroupids.
Reply With Quote
  #10  
Old 12-18-2005, 01:29 AM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Really? I didn't know. Thanks for pointing that out It's not really an "array", though. Rather an expanded list of parameters.

Code:
if(!is_member_of($this->registry->userinfo, X, Y, Z)) 
{ 
    $dobbimagecode = false; 
}
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:03 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03889 seconds
  • Memory Usage 2,246KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete