Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Restrict [code] and [php] to registered members only Details »»
Restrict [code] and [php] to registered members only
Version: 1.00, by Dean C Dean C is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 11-03-2003 Last Update: Never Installs: 3
 
No support by the author.

Hi,

Long time since I release a hack and this was only a little one I brushed up. Still useful nevertheless.

What does it do?
It allows you to restrict the content of the [ php] and [ code] tags to registered members only. If the user is not registered then they get a 'Sorry you must be registered to view this code.' displayed in the boxes

Instructions:

In admin/functions.php find:

PHP Code:
return "</normalfont><blockquote><code><smallfont>PHP:</smallfont><hr>$buffer<hr></code></blockquote><normalfont>"
Replace with:

PHP Code:
if($bbuserinfo['userid'] != 0)

{

    
$newbuffer $buffer;

}

else

{

    
$newbuffer 'Sorry you must be registered to view this code.';

}

return 
"</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$newbuffer<hr></pre></blockquote><normalfont>";

Find:

PHP Code:
return "</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>" str_replace("<br>"""str_replace("<br />"""$foundcode) ) . "<hr></pre></blockquote><normalfont>"
Replace with:

PHP Code:

if($bbuserinfo['userid'] != 0)

{

      
$newfoundcode $foundcode;

}

else

{

      
$newfoundcode 'Sorry you must be registered to view this code.';
}
  
return 
"</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>" str_replace("<br>"""str_replace("<br />"""$newfoundcode) ) . "<hr></pre></blockquote><normalfont>"
Find:

PHP Code:
function stripbrsfromcode($foundcode) { 
Below it add:
PHP Code:
global $bbuserinfo
Find:

PHP Code:
function phphighlite($code) { 
Below it add:

PHP Code:
global $bbuserinfo
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+

In search.php find:

PHP Code:
$searchresult[posttitle]=str_replace("<","&lt;",$searchresult[posttitle]); 
Below it add:

PHP Code:
if($bbuserinfo['userid'] == 0)
{
    
$searchresult['pagetext'] = preg_replace('#\[(php|code)](\r\n)*(.*)\[/\1]#''[$1]Sorry you must be registered to view this code[/$1]'$searchresult['pagetext']);

---------------------
Enjoy !
- Dean

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 11-05-2003, 09:10 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very odd t c - i tested this on my localboard and it worked fine

@Stefan - i'll have a crack at fixing that tonight
Reply With Quote
  #13  
Old 11-05-2003, 02:58 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ewww i made the fix for searching but look at the bottom php code box - ignore it for now until the bug on vb.org is fixed
Reply With Quote
  #14  
Old 11-05-2003, 07:00 PM
MindTrix's Avatar
MindTrix MindTrix is offline
 
Join Date: Apr 2002
Location: United Kingdom
Posts: 1,833
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lmao @ the code box error up there. Nice mod anyway Mist, Thank!

Could that error be there because vB.org is not a vB2 board? Or wouldnt this matter.
Reply With Quote
  #15  
Old 11-06-2003, 01:52 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's a vb3 bug MindTrix I've reported it at vb.com
Reply With Quote
  #16  
Old 11-06-2003, 03:20 PM
MindTrix's Avatar
MindTrix MindTrix is offline
 
Join Date: Apr 2002
Location: United Kingdom
Posts: 1,833
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh ok sorry, Cheers for clearing it up for me
Reply With Quote
  #17  
Old 11-08-2003, 04:19 AM
Mr. HillBilly Mr. HillBilly is offline
 
Join Date: Oct 2003
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mist, could you maybe make a hack to restrict 'ALL' vB code to registered members only?
Reply With Quote
  #18  
Old 11-08-2003, 05:31 AM
atomic fireball's Avatar
atomic fireball atomic fireball is offline
 
Join Date: Apr 2003
Location: California
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was hoping for a similar thing.

I'd like to make it so that guests would see a replacement image instead of the actual imbedded image that would do the same thing. Then Admins could create any image they wanted that also said words to the effect of "Sorry, you must register in order to view this image."

Would it be difficult/possible to convert this hack to the IMG tag instead?
Reply With Quote
  #19  
Old 11-08-2003, 10:39 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's possible - my time is too limited right now though sorry - make a request in the 'Requests' forum
Reply With Quote
  #20  
Old 11-08-2003, 09:51 PM
atomic fireball's Avatar
atomic fireball atomic fireball is offline
 
Join Date: Apr 2003
Location: California
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No problem Mist, thanks for the reply.
I posted it a week or so ago on the requests forum, but no one was interested.
Reply With Quote
  #21  
Old 11-08-2003, 10:36 PM
Dan's Avatar
Dan Dan is offline
 
Join Date: Dec 2002
Location: Titusville, Florida
Posts: 1,787
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice hack dean
Reply With Quote
Reply


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 07:25 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07663 seconds
  • Memory Usage 2,321KB
  • Queries Executed 25 (?)
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
  • (10)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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