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

Chen helped me rewrite the code to compensate for the vb3 "bogus" bug as they're calling it and also this is a lot cleaner. So this hack is fully functional now !
Reply With Quote
  #23  
Old 11-10-2003, 12:35 AM
ap0c's Avatar
ap0c ap0c is offline
 
Join Date: Mar 2003
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any change of getting a text file? I'd like to install this. All I see right now is Codedisplayerror: (Update license status) You cannot view codes as long as you haven't proven your license status!

which is not the case
Reply With Quote
  #24  
Old 11-10-2003, 05:29 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well you'll need to contact the administrators privately about that issue if there are problems with your licensing status. Seems as you posted here you are licensed alright
Reply With Quote
  #25  
Old 11-20-2003, 10:48 PM
nawialkair nawialkair is offline
 
Join Date: Oct 2002
Location: No where
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi All

I tried to install the hack on my 2.3.2 forum and the result was:

Parse error: parse error in /home/safwaci1/public_html/testforum/admin/functions.php on line 967

Fatal error: Call to undefined function: vbdate() in /home/safwaci1/public_html/testforum/admin/sessions.php on line 400

Can you please tell me what the problem is??

Thanks
Reply With Quote
  #26  
Old 11-21-2003, 04:10 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You applied the hack incorrectly ^^ reapply the changes.
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:30 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.06862 seconds
  • Memory Usage 2,271KB
  • Queries Executed 20 (?)
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
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)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